Use maxdomainlen in chan_sip (bug #4212)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5601 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2-netsec
Mark Spencer 20 years ago
parent 00bcbaaa05
commit 82d52ffe35

@ -251,7 +251,7 @@ static int recordhistory = 0; /* Record SIP history. Off by default */
static char global_musicclass[MAX_LANGUAGE] = ""; /* Global music on hold class */ static char global_musicclass[MAX_LANGUAGE] = ""; /* Global music on hold class */
#define DEFAULT_REALM "asterisk" #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 */ static char regcontext[AST_MAX_EXTENSION] = ""; /* Context for auto-extensions */
/* Expire slowly */ /* Expire slowly */
@ -406,10 +406,10 @@ static struct sip_pvt {
char from[256]; /* The From: header */ char from[256]; /* The From: header */
char useragent[256]; /* User agent in SIP request */ char useragent[256]; /* User agent in SIP request */
char context[AST_MAX_EXTENSION]; /* Context for this call */ 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 fromuser[AST_MAX_EXTENSION]; /* User to show in the user field */
char fromname[AST_MAX_EXTENSION]; /* Name 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 language[MAX_LANGUAGE]; /* Default language for this call */
char musicclass[MAX_LANGUAGE]; /* Music on Hold class */ char musicclass[MAX_LANGUAGE]; /* Music on Hold class */
char rdnis[256]; /* Referring DNIS */ char rdnis[256]; /* Referring DNIS */
@ -428,11 +428,11 @@ static struct sip_pvt {
char fullcontact[128]; /* The Contact: that the UA registers with us */ char fullcontact[128]; /* The Contact: that the UA registers with us */
char accountcode[20]; /* Account code */ char accountcode[20]; /* Account code */
char our_contact[256]; /* Our contact header */ char our_contact[256]; /* Our contact header */
char realm[256]; /* Authorization realm */ char realm[MAXHOSTNAMELEN]; /* Authorization realm */
char nonce[256]; /* Authorization nonce */ char nonce[256]; /* Authorization nonce */
char opaque[256]; /* Opaque nonsense */ char opaque[256]; /* Opaque nonsense */
char qop[80]; /* Quality of Protection, since SIP wasn't complicated enough yet. */ 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 */ char lastmsg[256]; /* Last Message sent/received */
int amaflags; /* AMA Flags */ int amaflags; /* AMA Flags */
int pendinginvite; /* Any pending invite */ int pendinginvite; /* Any pending invite */
@ -489,7 +489,7 @@ struct sip_user {
ASTOBJ_COMPONENTS(struct sip_user); ASTOBJ_COMPONENTS(struct sip_user);
char secret[80]; /* Password */ char secret[80]; /* Password */
char md5secret[80]; /* Password in md5 */ 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_num[80]; /* Caller ID num */
char cid_name[80]; /* Caller ID name */ char cid_name[80]; /* Caller ID name */
char accountcode[20]; /* Account code */ char accountcode[20]; /* Account code */
@ -519,15 +519,15 @@ struct sip_peer {
char secret[80]; /* Password */ char secret[80]; /* Password */
char md5secret[80]; /* Password in MD5 */ char md5secret[80]; /* Password in MD5 */
struct sip_auth *auth; /* Realm authentication list */ 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 username[80]; /* Temporary username until registration */
char accountcode[20]; /* Account code */ char accountcode[20]; /* Account code */
int amaflags; /* AMA Flags (for billing) */ 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 regexten[AST_MAX_EXTENSION]; /* Extension to register (if regcontext is used) */
char fromuser[80]; /* From: user when calling this peer */ char fromuser[80]; /* From: user when calling this peer */
char fromdomain[80]; /* From: domain when calling this peer */ char fromdomain[MAXHOSTNAMELEN]; /* From: domain when calling this peer */
char fullcontact[128]; /* Contact registred with us (not in sip.conf) */ char fullcontact[256]; /* Contact registred with us (not in sip.conf) */
char cid_num[80]; /* Caller ID num */ char cid_num[80]; /* Caller ID num */
char cid_name[80]; /* Caller ID name */ char cid_name[80]; /* Caller ID name */
int callingpres; /* Calling id presentation */ int callingpres; /* Calling id presentation */
@ -588,10 +588,10 @@ struct sip_registry {
int portno; /* Optional port override */ int portno; /* Optional port override */
char username[80]; /* Who we are registering as */ char username[80]; /* Who we are registering as */
char authuser[80]; /* Who we *authenticate* 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 secret[80]; /* Password or key name in []'s */
char md5secret[80]; char md5secret[80];
char contact[80]; /* Contact extension */ char contact[256]; /* Contact extension */
char random[80]; char random[80];
int expire; /* Sched ID of expiration */ int expire; /* Sched ID of expiration */
int timeout; /* sched id of sip_reg_timeout */ int timeout; /* sched id of sip_reg_timeout */
@ -604,9 +604,9 @@ struct sip_registry {
struct sockaddr_in us; /* Who the server thinks we are */ struct sockaddr_in us; /* Who the server thinks we are */
/* Saved headers */ /* Saved headers */
char realm[256]; /* Authorization realm */ char realm[MAXHOSTNAMELEN]; /* Authorization realm */
char nonce[256]; /* Authorization nonce */ char nonce[256]; /* Authorization nonce */
char domain[256]; /* Authorization domain */ char domain[MAXHOSTNAMELEN]; /* Authorization domain */
char opaque[256]; /* Opaque nonsense */ char opaque[256]; /* Opaque nonsense */
char qop[80]; /* Quality of Protection. */ char qop[80]; /* Quality of Protection. */
@ -637,7 +637,7 @@ static int sipsock = -1;
static struct sockaddr_in bindaddr; static struct sockaddr_in bindaddr;
static struct sockaddr_in externip; static struct sockaddr_in externip;
static char externhost[256] = ""; static char externhost[MAXHOSTNAMELEN] = "";
static time_t externexpire = 0; static time_t externexpire = 0;
static int externrefresh = 10; static int externrefresh = 10;
static struct ast_ha *localaddr; static struct ast_ha *localaddr;
@ -749,6 +749,7 @@ static int __sip_xmit(struct sip_pvt *p, char *data, int len)
{ {
int res; int res;
char iabuf[INET_ADDRSTRLEN]; char iabuf[INET_ADDRSTRLEN];
if (ast_test_flag(p, SIP_NAT) & SIP_NAT_ROUTE) if (ast_test_flag(p, SIP_NAT) & SIP_NAT_ROUTE)
res=sendto(sipsock, data, len, 0, (struct sockaddr *)&p->recv, sizeof(struct sockaddr_in)); res=sendto(sipsock, data, len, 0, (struct sockaddr *)&p->recv, sizeof(struct sockaddr_in));
else else
@ -1457,7 +1458,7 @@ static int create_addr(struct sip_pvt *r, char *opeer)
char *port; char *port;
char *callhost; char *callhost;
int portno; int portno;
char host[256], *hostn; char host[MAXHOSTNAMELEN], *hostn;
char peer[256]=""; char peer[256]="";
ast_copy_string(peer, opeer, sizeof(peer)); ast_copy_string(peer, opeer, sizeof(peer));
@ -1534,7 +1535,7 @@ static int create_addr(struct sip_pvt *r, char *opeer)
else else
portno = DEFAULT_SIP_PORT; portno = DEFAULT_SIP_PORT;
if (srvlookup) { if (srvlookup) {
char service[256]; char service[MAXHOSTNAMELEN];
int tportno; int tportno;
int ret; int ret;
snprintf(service, sizeof(service), "_sip._udp.%s", peer); snprintf(service, sizeof(service), "_sip._udp.%s", peer);

Loading…
Cancel
Save