[asterisk-commits] bebuild: tag 10.2.1 r359771 - in /tags/10.2.1: ./ apps/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 15 15:11:48 CDT 2012


Author: bebuild
Date: Thu Mar 15 15:11:44 2012
New Revision: 359771

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=359771
Log:
Merge 359694,359707 for 10.2.1

Removed:
    tags/10.2.1/asterisk-10.2.0-summary.html
    tags/10.2.1/asterisk-10.2.0-summary.txt
Modified:
    tags/10.2.1/   (props changed)
    tags/10.2.1/.version
    tags/10.2.1/ChangeLog
    tags/10.2.1/apps/app_milliwatt.c
    tags/10.2.1/main/utils.c

Propchange: tags/10.2.1/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Propchange: tags/10.2.1/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 15 15:11:44 2012
@@ -1,1 +1,1 @@
-/branches/10:353372,353397,353916,354000,354496,354543,354548,355733,356476,357095,357667
+/branches/10:353372,353397,353916,354000,354496,354543,354548,355733,356476,357095,357667,359694,359707

Modified: tags/10.2.1/.version
URL: http://svnview.digium.com/svn/asterisk/tags/10.2.1/.version?view=diff&rev=359771&r1=359770&r2=359771
==============================================================================
--- tags/10.2.1/.version (original)
+++ tags/10.2.1/.version Thu Mar 15 15:11:44 2012
@@ -1,1 +1,1 @@
-10.2.0
+10.2.1

Modified: tags/10.2.1/ChangeLog
URL: http://svnview.digium.com/svn/asterisk/tags/10.2.1/ChangeLog?view=diff&rev=359771&r1=359770&r2=359771
==============================================================================
--- tags/10.2.1/ChangeLog (original)
+++ tags/10.2.1/ChangeLog Thu Mar 15 15:11:44 2012
@@ -1,3 +1,11 @@
+2012-03-05  Asterisk Development Team <asteriskteam at digium.com>
+
+	* Asterisk 10.2.1 Released.
+
+	* AST-2012-002
+
+	* AST-2012-003
+
 2012-03-05  Asterisk Development Team <asteriskteam at digium.com>
 
 	* Asterisk 10.2.0 Released.

Modified: tags/10.2.1/apps/app_milliwatt.c
URL: http://svnview.digium.com/svn/asterisk/tags/10.2.1/apps/app_milliwatt.c?view=diff&rev=359771&r1=359770&r2=359771
==============================================================================
--- tags/10.2.1/apps/app_milliwatt.c (original)
+++ tags/10.2.1/apps/app_milliwatt.c Thu Mar 15 15:11:44 2012
@@ -78,7 +78,7 @@
 static int milliwatt_generate(struct ast_channel *chan, void *data, int len, int samples)
 {
 	unsigned char buf[AST_FRIENDLY_OFFSET + 640];
-	const int maxsamples = ARRAY_LEN(buf);
+	const int maxsamples = ARRAY_LEN(buf) - (AST_FRIENDLY_OFFSET / sizeof(buf[0]));
 	int i, *indexp = (int *) data;
 	struct ast_frame wf = {
 		.frametype = AST_FRAME_VOICE,

Modified: tags/10.2.1/main/utils.c
URL: http://svnview.digium.com/svn/asterisk/tags/10.2.1/main/utils.c?view=diff&rev=359771&r1=359770&r2=359771
==============================================================================
--- tags/10.2.1/main/utils.c (original)
+++ tags/10.2.1/main/utils.c Thu Mar 15 15:11:44 2012
@@ -1989,9 +1989,28 @@
  * pedantic arg can be set to nonzero if we need to do addition Digest check.
  */
 int ast_parse_digest(const char *digest, struct ast_http_digest *d, int request, int pedantic) {
-	int i;
-	char *c, key[512], val[512];
+	char *c;
 	struct ast_str *str = ast_str_create(16);
+
+	/* table of recognised keywords, and places where they should be copied */
+	const struct x {
+		const char *key;
+		const ast_string_field *field;
+	} *i, keys[] = {
+		{ "username=", &d->username },
+		{ "realm=", &d->realm },
+		{ "nonce=", &d->nonce },
+		{ "uri=", &d->uri },
+		{ "domain=", &d->domain },
+		{ "response=", &d->response },
+		{ "cnonce=", &d->cnonce },
+		{ "opaque=", &d->opaque },
+		/* Special cases that cannot be directly copied */
+		{ "algorithm=", NULL },
+		{ "qop=", NULL },
+		{ "nc=", NULL },
+		{ NULL, 0 },
+	};
 
 	if (ast_strlen_zero(digest) || !d || !str) {
 		ast_free(str);
@@ -2010,72 +2029,55 @@
 	c += strlen("Digest ");
 
 	/* lookup for keys/value pair */
-	while (*c && *(c = ast_skip_blanks(c))) {
+	while (c && *c && *(c = ast_skip_blanks(c))) {
 		/* find key */
-		i = 0;
-		while (*c && *c != '=' && *c != ',' && !isspace(*c)) {
-			key[i++] = *c++;
-		}
-		key[i] = '\0';
-		c = ast_skip_blanks(c);
-		if (*c == '=') {
-			c = ast_skip_blanks(++c);
-			i = 0;
-			if (*c == '\"') {
-				/* in quotes. Skip first and look for last */
-				c++;
-				while (*c && *c != '\"') {
-					if (*c == '\\' && c[1] != '\0') { /* unescape chars */
-						c++;
+		for (i = keys; i->key != NULL; i++) {
+			char *src, *separator;
+			int unescape = 0;
+			if (strncasecmp(c, i->key, strlen(i->key)) != 0) {
+				continue;
+			}
+
+			/* Found. Skip keyword, take text in quotes or up to the separator. */
+			c += strlen(i->key);
+			if (*c == '"') {
+				src = ++c;
+				separator = "\"";
+				unescape = 1;
+			} else {
+				src = c;
+				separator = ",";
+			}
+			strsep(&c, separator); /* clear separator and move ptr */
+			if (unescape) {
+				ast_unescape_c(src);
+			}
+			if (i->field) {
+				ast_string_field_ptr_set(d, i->field, src);
+			} else {
+				/* Special cases that require additional procesing */
+				if (!strcasecmp(i->key, "algorithm=")) {
+					if (strcasecmp(src, "MD5")) {
+						ast_log(LOG_WARNING, "Digest algorithm: \"%s\" not supported.\n", src);
+						ast_free(str);
+						return -1;
 					}
-					val[i++] = *c++;
-				}
-			} else {
-				/* token */
-				while (*c && *c != ',' && !isspace(*c)) {
-					val[i++] = *c++;
+				} else if (!strcasecmp(i->key, "qop=") && !strcasecmp(src, "auth")) {
+					d->qop = 1;
+				} else if (!strcasecmp(i->key, "nc=")) {
+					unsigned long u;
+					if (sscanf(src, "%30lx", &u) != 1) {
+						ast_log(LOG_WARNING, "Incorrect Digest nc value: \"%s\".\n", src);
+						ast_free(str);
+						return -1;
+					}
+					ast_string_field_set(d, nc, src);
 				}
 			}
-			val[i] = '\0';
-		}
-
-		while (*c && *c != ',') {
-			c++;
-		}
-		if (*c) {
-			c++;
-		}
-
-		if (!strcasecmp(key, "username")) {
-			ast_string_field_set(d, username, val);
-		} else if (!strcasecmp(key, "realm")) {
-			ast_string_field_set(d, realm, val);
-		} else if (!strcasecmp(key, "nonce")) {
-			ast_string_field_set(d, nonce, val);
-		} else if (!strcasecmp(key, "uri")) {
-			ast_string_field_set(d, uri, val);
-		} else if (!strcasecmp(key, "domain")) {
-			ast_string_field_set(d, domain, val);
-		} else if (!strcasecmp(key, "response")) {
-			ast_string_field_set(d, response, val);
-		} else if (!strcasecmp(key, "algorithm")) {
-			if (strcasecmp(val, "MD5")) {
-				ast_log(LOG_WARNING, "Digest algorithm: \"%s\" not supported.\n", val);
-				return -1;
-			}
-		} else if (!strcasecmp(key, "cnonce")) {
-			ast_string_field_set(d, cnonce, val);
-		} else if (!strcasecmp(key, "opaque")) {
-			ast_string_field_set(d, opaque, val);
-		} else if (!strcasecmp(key, "qop") && !strcasecmp(val, "auth")) {
-			d->qop = 1;
-		} else if (!strcasecmp(key, "nc")) {
-			unsigned long u;
-			if (sscanf(val, "%30lx", &u) != 1) {
-				ast_log(LOG_WARNING, "Incorrect Digest nc value: \"%s\".\n", val);
-				return -1;
-			}
-			ast_string_field_set(d, nc, val);
+			break;
+		}
+		if (i->key == NULL) { /* not found, try ',' */
+			strsep(&c, ",");
 		}
 	}
 	ast_free(str);




More information about the asterisk-commits mailing list