[Asterisk-cvs] asterisk/channels chan_sip.c,1.727,1.728

markster at lists.digium.com markster at lists.digium.com
Sun May 8 12:43:05 CDT 2005


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

Modified Files:
	chan_sip.c 
Log Message:
Use maxdomainlen in chan_sip (bug #4212)


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.727
retrieving revision 1.728
diff -u -d -r1.727 -r1.728
--- chan_sip.c	5 May 2005 05:39:33 -0000	1.727
+++ chan_sip.c	8 May 2005 16:49:28 -0000	1.728
@@ -251,7 +251,7 @@
 
 static char global_musicclass[MAX_LANGUAGE] = "";	/* Global music on hold class */
 #define DEFAULT_REALM	"asterisk"
-static char global_realm[AST_MAX_EXTENSION] = DEFAULT_REALM; 	/* Default realm */
+static char global_realm[MAXHOSTNAMELEN] = DEFAULT_REALM; 	/* Default realm */
 static char regcontext[AST_MAX_EXTENSION] = "";		/* Context for auto-extensions */
 
 /* Expire slowly */
@@ -406,10 +406,10 @@
 	char from[256];				/* The From: header */
 	char useragent[256];			/* User agent in SIP request */
 	char context[AST_MAX_EXTENSION];	/* Context for this call */
-	char fromdomain[AST_MAX_EXTENSION];	/* Domain to show in the from field */
+	char fromdomain[MAXHOSTNAMELEN];	/* Domain to show in the from field */
 	char fromuser[AST_MAX_EXTENSION];	/* User to show in the user field */
 	char fromname[AST_MAX_EXTENSION];	/* Name to show in the user field */
-	char tohost[AST_MAX_EXTENSION];		/* Host we should put in the "to" field */
+	char tohost[MAXHOSTNAMELEN];		/* Host we should put in the "to" field */
 	char language[MAX_LANGUAGE];		/* Default language for this call */
 	char musicclass[MAX_LANGUAGE];          /* Music on Hold class */
 	char rdnis[256];			/* Referring DNIS */
@@ -428,11 +428,11 @@
 	char fullcontact[128];			/* The Contact: that the UA registers with us */
 	char accountcode[20];			/* Account code */
 	char our_contact[256];			/* Our contact header */
-	char realm[256];			/* Authorization realm */
+	char realm[MAXHOSTNAMELEN];		/* Authorization realm */
 	char nonce[256];			/* Authorization nonce */
 	char opaque[256];			/* Opaque nonsense */
 	char qop[80];				/* Quality of Protection, since SIP wasn't complicated enough yet. */
-	char domain[256];			/* Authorization domain */
+	char domain[MAXHOSTNAMELEN];		/* Authorization domain */
 	char lastmsg[256];			/* Last Message sent/received */
 	int amaflags;				/* AMA Flags */
 	int pendinginvite;			/* Any pending invite */
@@ -489,7 +489,7 @@
 	ASTOBJ_COMPONENTS(struct sip_user);
 	char secret[80];		/* Password */
 	char md5secret[80];		/* Password in md5 */
-	char context[80];		/* Default context for incoming calls */
+	char context[AST_MAX_EXTENSION];	/* Default context for incoming calls */
 	char cid_num[80];		/* Caller ID num */
 	char cid_name[80];		/* Caller ID name */
 	char accountcode[20];		/* Account code */
@@ -519,15 +519,15 @@
 	char secret[80];		/* Password */
 	char md5secret[80];		/* Password in MD5 */
 	struct sip_auth *auth;		/* Realm authentication list */
-	char context[80];		/* Default context for incoming calls */
+	char context[AST_MAX_EXTENSION];	/* Default context for incoming calls */
 	char username[80];		/* Temporary username until registration */ 
 	char accountcode[20];		/* Account code */
 	int amaflags;			/* AMA Flags (for billing) */
-	char tohost[80];		/* If not dynamic, IP address */
+	char tohost[MAXHOSTNAMELEN];	/* If not dynamic, IP address */
 	char regexten[AST_MAX_EXTENSION]; /* Extension to register (if regcontext is used) */
 	char fromuser[80];		/* From: user when calling this peer */
-	char fromdomain[80];		/* From: domain when calling this peer */
-	char fullcontact[128];		/* Contact registred with us (not in sip.conf) */
+	char fromdomain[MAXHOSTNAMELEN];	/* From: domain when calling this peer */
+	char fullcontact[256];		/* Contact registred with us (not in sip.conf) */
 	char cid_num[80];		/* Caller ID num */
 	char cid_name[80];		/* Caller ID name */
 	int callingpres;		/* Calling id presentation */
@@ -588,10 +588,10 @@
 	int portno;			/* Optional port override */
 	char username[80];		/* Who we are registering as */
 	char authuser[80];		/* Who we *authenticate* as */
-	char hostname[80];		/* Domain or host we register to */
+	char hostname[MAXHOSTNAMELEN];	/* Domain or host we register to */
 	char secret[80];		/* Password or key name in []'s */	
 	char md5secret[80];
-	char contact[80];		/* Contact extension */
+	char contact[256];		/* Contact extension */
 	char random[80];
 	int expire;			/* Sched ID of expiration */
 	int timeout; 			/* sched id of sip_reg_timeout */
@@ -604,9 +604,9 @@
 	struct sockaddr_in us;		/* Who the server thinks we are */
  	
  					/* Saved headers */
- 	char realm[256];		/* Authorization realm */
+ 	char realm[MAXHOSTNAMELEN];	/* Authorization realm */
  	char nonce[256];		/* Authorization nonce */
- 	char domain[256];		/* Authorization domain */
+ 	char domain[MAXHOSTNAMELEN];	/* Authorization domain */
  	char opaque[256];		/* Opaque nonsense */
  	char qop[80];			/* Quality of Protection. */
  
@@ -637,7 +637,7 @@
 
 static struct sockaddr_in bindaddr;
 static struct sockaddr_in externip;
-static char externhost[256] = "";
+static char externhost[MAXHOSTNAMELEN] = "";
 static time_t externexpire = 0;
 static int externrefresh = 10;
 static struct ast_ha *localaddr;
@@ -749,6 +749,7 @@
 {
 	int res;
 	char iabuf[INET_ADDRSTRLEN];
+
 	if (ast_test_flag(p, SIP_NAT) & SIP_NAT_ROUTE)
 	    res=sendto(sipsock, data, len, 0, (struct sockaddr *)&p->recv, sizeof(struct sockaddr_in));
 	else
@@ -1457,7 +1458,7 @@
 	char *port;
 	char *callhost;
 	int portno;
-	char host[256], *hostn;
+	char host[MAXHOSTNAMELEN], *hostn;
 	char peer[256]="";
 
 	ast_copy_string(peer, opeer, sizeof(peer));
@@ -1534,7 +1535,7 @@
 		else
 			portno = DEFAULT_SIP_PORT;
 		if (srvlookup) {
-			char service[256];
+			char service[MAXHOSTNAMELEN];
 			int tportno;
 			int ret;
 			snprintf(service, sizeof(service), "_sip._udp.%s", peer);




More information about the svn-commits mailing list