[Asterisk-cvs] asterisk/pbx dundi-parser.c, 1.8, 1.9 dundi-parser.h, 1.4, 1.5 pbx_dundi.c, 1.39, 1.40

kpfleming kpfleming
Fri Sep 2 15:14:10 CDT 2005


Update of /usr/cvsroot/asterisk/pbx
In directory mongoose.digium.com:/tmp/cvs-serv13716/pbx

Modified Files:
	dundi-parser.c dundi-parser.h pbx_dundi.c 
Log Message:
use native-sign characters for strings (issue #5105)


Index: dundi-parser.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx/dundi-parser.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- dundi-parser.c	6 Jun 2005 22:12:19 -0000	1.8
+++ dundi-parser.c	2 Sep 2005 19:15:03 -0000	1.9
@@ -507,7 +507,7 @@
 	return 0;
 }
 
-int dundi_ie_append_cause(struct dundi_ie_data *ied, unsigned char ie, unsigned char cause, unsigned char *data)
+int dundi_ie_append_cause(struct dundi_ie_data *ied, unsigned char ie, unsigned char cause, char *data)
 {
 	char tmp[256];
 	int datalen = data ? strlen(data) + 1 : 1;
@@ -524,7 +524,7 @@
 	return 0;
 }
 
-int dundi_ie_append_hint(struct dundi_ie_data *ied, unsigned char ie, unsigned short flags, unsigned char *data)
+int dundi_ie_append_hint(struct dundi_ie_data *ied, unsigned char ie, unsigned short flags, char *data)
 {
 	char tmp[256];
 	int datalen = data ? strlen(data) + 2 : 2;
@@ -563,7 +563,7 @@
 	return 0;
 }
 
-int dundi_ie_append_answer(struct dundi_ie_data *ied, unsigned char ie, dundi_eid *eid, unsigned char protocol, unsigned short flags, unsigned short weight, unsigned char *data)
+int dundi_ie_append_answer(struct dundi_ie_data *ied, unsigned char ie, dundi_eid *eid, unsigned char protocol, unsigned short flags, unsigned short weight, char *data)
 {
 	char tmp[256];
 	int datalen = data ? strlen(data) + 11 : 11;
@@ -609,7 +609,7 @@
 	return dundi_ie_append_raw(ied, ie, &newval, (int)sizeof(newval));
 }
 
-int dundi_ie_append_str(struct dundi_ie_data *ied, unsigned char ie, unsigned char *str)
+int dundi_ie_append_str(struct dundi_ie_data *ied, unsigned char ie, char *str)
 {
 	return dundi_ie_append_raw(ied, ie, str, strlen(str));
 }
@@ -676,10 +676,10 @@
 				ies->reqeid = (dundi_eid *)(data + 2);
 			break;
 		case DUNDI_IE_CALLED_CONTEXT:
-			ies->called_context = data + 2;
+			ies->called_context = (char *)data + 2;
 			break;
 		case DUNDI_IE_CALLED_NUMBER:
-			ies->called_number = data + 2;
+			ies->called_number = (char *)data + 2;
 			break;
 		case DUNDI_IE_ANSWER:
 			if (len < sizeof(struct dundi_answer)) {
@@ -731,7 +731,7 @@
 		case DUNDI_IE_CAUSE:
 			if (len >= 1) {
 				ies->cause = data[2];
-				ies->causestr = data + 3;
+				ies->causestr = (char *)data + 3;
 			} else {
 				snprintf(tmp, (int)sizeof(tmp), "Expected at least one byte cause, but was %d long\n", len);
 				errorf(tmp);
@@ -746,28 +746,28 @@
 			}
 			break;
 		case DUNDI_IE_DEPARTMENT:
-			ies->q_dept = data + 2;
+			ies->q_dept = (char *)data + 2;
 			break;
 		case DUNDI_IE_ORGANIZATION:
-			ies->q_org = data + 2;
+			ies->q_org = (char *)data + 2;
 			break;
 		case DUNDI_IE_LOCALITY:
-			ies->q_locality = data + 2;
+			ies->q_locality = (char *)data + 2;
 			break;
 		case DUNDI_IE_STATE_PROV:
-			ies->q_stateprov = data + 2;
+			ies->q_stateprov = (char *)data + 2;
 			break;
 		case DUNDI_IE_COUNTRY:
-			ies->q_country = data + 2;
+			ies->q_country = (char *)data + 2;
 			break;
 		case DUNDI_IE_EMAIL:
-			ies->q_email = data + 2;
+			ies->q_email = (char *)data + 2;
 			break;
 		case DUNDI_IE_PHONE:
-			ies->q_phone = data + 2;
+			ies->q_phone = (char *)data + 2;
 			break;
 		case DUNDI_IE_IPADDR:
-			ies->q_ipaddr = data + 2;
+			ies->q_ipaddr = (char *)data + 2;
 			break;
 		case DUNDI_IE_ENCDATA:
 			/* Recalculate len as the remainder of the message, regardless of

Index: dundi-parser.h
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx/dundi-parser.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dundi-parser.h	21 Apr 2005 06:02:44 -0000	1.4
+++ dundi-parser.h	2 Sep 2005 19:15:03 -0000	1.5
@@ -34,15 +34,15 @@
 	int unknowncmd;
 	unsigned char *pubkey;
 	int cause;
-	unsigned char *q_dept;
-	unsigned char *q_org;
-	unsigned char *q_locality;
-	unsigned char *q_stateprov;
-	unsigned char *q_country;
-	unsigned char *q_email;
-	unsigned char *q_phone;
-	unsigned char *q_ipaddr;
-	unsigned char *causestr;
+	char *q_dept;
+	char *q_org;
+	char *q_locality;
+	char *q_stateprov;
+	char *q_country;
+	char *q_email;
+	char *q_phone;
+	char *q_ipaddr;
+	char *causestr;
 	unsigned char *encsharedkey;
 	unsigned char *encsig;
 	unsigned long keycrc32;
@@ -68,11 +68,11 @@
 extern int dundi_ie_append_addr(struct dundi_ie_data *ied, unsigned char ie, struct sockaddr_in *sin);
 extern int dundi_ie_append_int(struct dundi_ie_data *ied, unsigned char ie, unsigned int value);
 extern int dundi_ie_append_short(struct dundi_ie_data *ied, unsigned char ie, unsigned short value);
-extern int dundi_ie_append_str(struct dundi_ie_data *ied, unsigned char ie, unsigned char *str);
+extern int dundi_ie_append_str(struct dundi_ie_data *ied, unsigned char ie, char *str);
 extern int dundi_ie_append_eid(struct dundi_ie_data *ied, unsigned char ie, dundi_eid *eid);
-extern int dundi_ie_append_cause(struct dundi_ie_data *ied, unsigned char ie, unsigned char cause, unsigned char *desc);
-extern int dundi_ie_append_hint(struct dundi_ie_data *ied, unsigned char ie, unsigned short flags, unsigned char *data);
-extern int dundi_ie_append_answer(struct dundi_ie_data *ied, unsigned char ie, dundi_eid *eid, unsigned char protocol, unsigned short flags, unsigned short weight, unsigned char *desc);
+extern int dundi_ie_append_cause(struct dundi_ie_data *ied, unsigned char ie, unsigned char cause, char *desc);
+extern int dundi_ie_append_hint(struct dundi_ie_data *ied, unsigned char ie, unsigned short flags, char *data);
+extern int dundi_ie_append_answer(struct dundi_ie_data *ied, unsigned char ie, dundi_eid *eid, unsigned char protocol, unsigned short flags, unsigned short weight, char *desc);
 extern int dundi_ie_append_encdata(struct dundi_ie_data *ied, unsigned char ie, unsigned char *iv, void *data, int datalen);
 extern int dundi_ie_append_byte(struct dundi_ie_data *ied, unsigned char ie, unsigned char dat);
 extern int dundi_ie_append(struct dundi_ie_data *ied, unsigned char ie);

Index: pbx_dundi.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx/pbx_dundi.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- pbx_dundi.c	15 Jul 2005 23:00:47 -0000	1.39
+++ pbx_dundi.c	2 Sep 2005 19:15:03 -0000	1.40
@@ -909,7 +909,7 @@
 			/* Make sure it's not already there */
 			for (z=0;z<trans->parent->respcount;z++) {
 				if ((trans->parent->dr[z].techint == ies->answers[x]->protocol) &&
-				    !strcmp(trans->parent->dr[z].dest, ies->answers[x]->data)) 
+				    !strcmp(trans->parent->dr[z].dest, (char *)ies->answers[x]->data)) 
 						break;
 			}
 			if (z == trans->parent->respcount) {
@@ -925,7 +925,7 @@
 				dundi_eid_to_str(trans->parent->dr[trans->parent->respcount].eid_str, 
 					sizeof(trans->parent->dr[trans->parent->respcount].eid_str),
 					&ies->answers[x]->eid);
-				strncpy(trans->parent->dr[trans->parent->respcount].dest, ies->answers[x]->data,
+				strncpy(trans->parent->dr[trans->parent->respcount].dest, (char *)ies->answers[x]->data,
 					sizeof(trans->parent->dr[trans->parent->respcount].dest));
 					strncpy(trans->parent->dr[trans->parent->respcount].tech, tech2str(ies->answers[x]->protocol),
 					sizeof(trans->parent->dr[trans->parent->respcount].tech));
@@ -1304,7 +1304,7 @@
 			ast_log(LOG_NOTICE, "Whoa, got a weird encrypt size (%d != %d)!\n", res, 128);
 			return -1;
 		}
-		if ((res = ast_sign_bin(skey, peer->txenckey, 128, peer->txenckey + 128))) {
+		if ((res = ast_sign_bin(skey, (char *)peer->txenckey, 128, peer->txenckey + 128))) {
 			ast_log(LOG_NOTICE, "Failed to sign key (%d)!\n", res);
 			return -1;
 		}
@@ -1475,7 +1475,7 @@
 	}
 
 	/* First check signature */
-	res = ast_check_signature_bin(skey, newkey, 128, newsig);
+	res = ast_check_signature_bin(skey, (char *)newkey, 128, newsig);
 	if (res) 
 		return 0;
 
@@ -1644,7 +1644,7 @@
 							/* Make sure it's not already there */
 							for (z=0;z<trans->parent->respcount;z++) {
 								if ((trans->parent->dr[z].techint == ies.answers[x]->protocol) &&
-								    !strcmp(trans->parent->dr[z].dest, ies.answers[x]->data)) 
+								    !strcmp(trans->parent->dr[z].dest, (char *)ies.answers[x]->data)) 
 										break;
 							}
 							if (z == trans->parent->respcount) {
@@ -1660,7 +1660,7 @@
 								dundi_eid_to_str(trans->parent->dr[trans->parent->respcount].eid_str, 
 									sizeof(trans->parent->dr[trans->parent->respcount].eid_str),
 									&ies.answers[x]->eid);
-								strncpy(trans->parent->dr[trans->parent->respcount].dest, ies.answers[x]->data,
+								strncpy(trans->parent->dr[trans->parent->respcount].dest, (char *)ies.answers[x]->data,
 									sizeof(trans->parent->dr[trans->parent->respcount].dest));
 								strncpy(trans->parent->dr[trans->parent->respcount].tech, tech2str(ies.answers[x]->protocol),
 									sizeof(trans->parent->dr[trans->parent->respcount].tech));
@@ -1683,8 +1683,8 @@
 						if (ast_test_flag_nonstd(ies.hint, htons(DUNDI_HINT_TTL_EXPIRED)))
 							ast_set_flag_nonstd(trans->parent->hmd, DUNDI_HINT_TTL_EXPIRED);
 						if (ast_test_flag_nonstd(ies.hint, htons(DUNDI_HINT_DONT_ASK))) { 
-							if (strlen(ies.hint->data) > strlen(trans->parent->hmd->exten)) {
-								strncpy(trans->parent->hmd->exten, ies.hint->data, 
+							if (strlen((char *)ies.hint->data) > strlen(trans->parent->hmd->exten)) {
+								strncpy(trans->parent->hmd->exten, (char *)ies.hint->data, 
 									sizeof(trans->parent->hmd->exten) - 1);
 							}
 						} else {
@@ -1969,8 +1969,8 @@
 	struct sockaddr_in sin;
 	int res;
 	struct dundi_hdr *h;
-	unsigned char buf[MAX_PACKET_SIZE];
-	int len;
+	char buf[MAX_PACKET_SIZE];
+	socklen_t len;
 	len = sizeof(sin);
 	res = recvfrom(netsocket, buf, sizeof(buf) - 1, 0,(struct sockaddr *) &sin, &len);
 	if (res < 0) {
@@ -1994,11 +1994,11 @@
 
 static void build_secret(char *secret, int seclen)
 {
-	char tmp[16];
+	unsigned char tmp[16];
 	char *s;
 	build_iv(tmp);
 	secret[0] = '\0';
-	ast_base64encode(secret ,tmp, sizeof(tmp), seclen);
+	ast_base64encode(secret, tmp, sizeof(tmp), seclen);
 	/* Eliminate potential bad characters */
 	while((s = strchr(secret, ';'))) *s = '+';
 	while((s = strchr(secret, '/'))) *s = '+';




More information about the svn-commits mailing list