[svn-commits] seanbright: branch 1.8 r316919 - /branches/1.8/main/http.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed May 4 21:30:50 CDT 2011


Author: seanbright
Date: Wed May  4 21:30:45 2011
New Revision: 316919

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=316919
Log:
Use the correct HTTP method when generating our digest, otherwise we always fail.

When calculating the 'A2' portion of our digest for verification, we need the
HTTP method that is currently in use.  Unfortunately our mapping function was
incorrect, resulting in invalid hashes being generated and, in turn, failures
in authentication.

(closes issue #18598)
Reported by: ksn

Modified:
    branches/1.8/main/http.c

Modified: branches/1.8/main/http.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/http.c?view=diff&rev=316919&r1=316918&r2=316919
==============================================================================
--- branches/1.8/main/http.c (original)
+++ branches/1.8/main/http.c Wed May  4 21:30:45 2011
@@ -132,7 +132,7 @@
 
 static const struct ast_cfhttp_methods_text {
 	enum ast_http_method method;
-	const char text[];
+	const char *text;
 } ast_http_methods_text[] = {
 	{ AST_HTTP_UNKNOWN,     "UNKNOWN" },
 	{ AST_HTTP_GET,         "GET" },
@@ -143,7 +143,15 @@
 
 const char *ast_get_http_method(enum ast_http_method method)
 {
-	return ast_http_methods_text[method].text;
+	int x;
+
+	for (x = 0; x < ARRAY_LEN(ast_http_methods_text); x++) {
+		if (ast_http_methods_text[x].method == method) {
+			return ast_http_methods_text[x].text;
+		}
+	}
+
+	return NULL;
 }
 
 const char *ast_http_ftype2mtype(const char *ftype)




More information about the svn-commits mailing list