? patch20040630.txt Index: acl.c =================================================================== RCS file: /usr/cvsroot/asterisk/acl.c,v retrieving revision 1.26 diff -u -p -r1.26 acl.c --- acl.c 29 Jun 2004 19:21:25 -0000 1.26 +++ acl.c 30 Jun 2004 16:25:28 -0000 @@ -170,10 +170,13 @@ int ast_apply_ha(struct ast_ha *ha, stru /* Start optimistic */ int res = AST_SENSE_ALLOW; while(ha) { - char tmp[80]; - char tmp2[80]; + char iabuf[INET_ADDRSTRLEN]; + char iabuf2[INET_ADDRSTRLEN]; /* DEBUG */ - ast_log(LOG_DEBUG, "##### Testing %s with %s\n",ast_inet_ntoa(tmp, sizeof(tmp), sin->sin_addr), ast_inet_ntoa(tmp2, sizeof(tmp2), ha->netaddr)); + ast_log(LOG_DEBUG, + "##### Testing %s with %s\n", + ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr), + ast_inet_ntoa(iabuf2, sizeof(iabuf2), ha->netaddr)); /* For each rule, if this address and the netmask = the net address apply the current rule */ if ((sin->sin_addr.s_addr & ha->netmask.s_addr) == (ha->netaddr.s_addr)) @@ -228,13 +231,13 @@ int ast_ouraddrfor(struct in_addr *them, struct rt_msghdr m_rtm; char m_space[512]; } m_rtmsg; - char tmp[80]; + char iabuf[INET_ADDRSTRLEN]; char *cp, *p; int i, l, s, seq, flags; pid_t pid = getpid(); static int routeseq; /* Protected by "routeseq_lock" mutex */ - p = ast_strdupa(ast_inet_ntoa(tmp, sizeof(tmp), *them)); + p = ast_strdupa(ast_inet_ntoa(iabuf, sizeof(iabuf), *them)); memset(us, 0, sizeof(struct in_addr)); memset(&m_rtmsg, 0, sizeof(m_rtmsg)); @@ -297,7 +300,7 @@ int ast_ouraddrfor(struct in_addr *them, if (i == RTA_IFA && sa->sa_family == AF_INET) { sin = (struct sockaddr_in *)sa; *us = sin->sin_addr; - ast_log(LOG_DEBUG, "Found route to %s, output from our address %s.\n", p, ast_inet_ntoa(tmp, sizeof(tmp), *us)); + ast_log(LOG_DEBUG, "Found route to %s, output from our address %s.\n", p, ast_inet_ntoa(iabuf, sizeof(iabuf), *us)); return 0; } cp += sa->sa_len > 0 ? @@ -354,8 +357,8 @@ int ast_ouraddrfor(struct in_addr *them, sscanf(fields[2],"%x",&gateway); sscanf(fields[7],"%x",&mask); #if 0 - { char tmp[80]; - printf("Addr: %s %08x Dest: %08x Mask: %08x\n", ast_inet_ntoa(tmp, sizeof(tmp), *them), remote_ip, dest, mask); } + { char iabuf[INET_ADDRSTRLEN]; + printf("Addr: %s %08x Dest: %08x Mask: %08x\n", ast_inet_ntoa(iabuf, sizeof(iabuf), *them), remote_ip, dest, mask); } #endif /* Looks simple, but here is the magic */ if (((remote_ip & mask) ^ dest) == 0) { Index: manager.c =================================================================== RCS file: /usr/cvsroot/asterisk/manager.c,v retrieving revision 1.60 diff -u -p -r1.60 manager.c --- manager.c 29 Jun 2004 12:56:46 -0000 1.60 +++ manager.c 30 Jun 2004 16:25:30 -0000 @@ -163,7 +163,7 @@ static int handle_showmancmds(int fd, in static int handle_showmanconn(int fd, int argc, char *argv[]) { struct mansession *s; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; char *format = " %-15.15s %-15.15s\n"; ast_mutex_lock(&sessionlock); s = sessions; @@ -312,7 +312,7 @@ static int set_eventmask(struct mansessi static int authenticate(struct mansession *s, struct message *m) { struct ast_config *cfg; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; char *cat; char *user = astman_get_header(m, "Username"); char *pass = astman_get_header(m, "Secret"); @@ -940,7 +940,7 @@ static int process_message(struct manses struct manager_action *tmp = first_action; char *id = astman_get_header(m,"ActionID"); char idText[256] = ""; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; strncpy(action, astman_get_header(m, "Action"), sizeof(action)); ast_log( LOG_DEBUG, "Manager received command '%s'\n", action ); @@ -1012,7 +1012,7 @@ static int get_input(struct mansession * int res; int x; struct pollfd fds[1]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; for (x=1;xinlen;x++) { if ((s->inbuf[x] == '\n') && (s->inbuf[x-1] == '\r')) { /* Copy output data up to and including \r\n */ @@ -1050,7 +1050,7 @@ static void *session_do(void *data) { struct mansession *s = data; struct message m; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; int res; ast_mutex_lock(&s->lock); Index: rtp.c =================================================================== RCS file: /usr/cvsroot/asterisk/rtp.c,v retrieving revision 1.77 diff -u -p -r1.77 rtp.c --- rtp.c 30 Jun 2004 06:03:57 -0000 1.77 +++ rtp.c 30 Jun 2004 16:25:30 -0000 @@ -174,7 +174,7 @@ static struct ast_frame *send_dtmf(struc { struct timeval tv; static struct ast_frame null_frame = { AST_FRAME_NULL, }; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; gettimeofday(&tv, NULL); if ((tv.tv_sec < rtp->dtmfmute.tv_sec) || ((tv.tv_sec == rtp->dtmfmute.tv_sec) && (tv.tv_usec < rtp->dtmfmute.tv_usec))) { @@ -338,7 +338,7 @@ struct ast_frame *ast_rtcp_read(struct a int res; struct sockaddr_in sin; unsigned int rtcpdata[1024]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (!rtp->rtcp) return &null_frame; @@ -407,7 +407,7 @@ struct ast_frame *ast_rtp_read(struct as int payloadtype; int hdrlen = 12; int mark; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; unsigned int timestamp; unsigned int *rtpheader; static struct ast_frame *f, null_frame = { AST_FRAME_NULL, }; @@ -950,7 +950,7 @@ int ast_rtp_senddigit(struct ast_rtp *rt int ms; int x; char data[256]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if ((digit <= '9') && (digit >= '0')) digit -= '0'; @@ -1013,7 +1013,7 @@ int ast_rtp_senddigit(struct ast_rtp *rt static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec) { unsigned int *rtpheader; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; int hdrlen = 12; int res; int ms; @@ -1288,7 +1288,7 @@ int ast_rtp_bridge(struct ast_channel *c struct sockaddr_in vac0, vac1; struct sockaddr_in t0, t1; struct sockaddr_in vt0, vt1; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; void *pvt0, *pvt1; int to; Index: channels/chan_h323.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_h323.c,v retrieving revision 1.64 diff -u -p -r1.64 chan_h323.c --- channels/chan_h323.c 29 Jun 2004 18:00:14 -0000 1.64 +++ channels/chan_h323.c 30 Jun 2004 16:25:31 -0000 @@ -918,7 +918,7 @@ struct oh323_alias *find_alias(const cha struct oh323_user *find_user(const call_details_t cd) { struct oh323_user *u; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; u = userl.users; if(userbyalias == 1){ while(u) { @@ -1002,7 +1002,7 @@ struct rtp_info *create_connection(unsig but this function wants to return a static variable so the only way to do this will be to declare iabuf within the oh323_pvt structure XXX */ - static char iabuf[80]; + static char iabuf[INET_ADDRSTRLEN]; info = (struct rtp_info *) malloc(sizeof(struct rtp_info)); @@ -1036,7 +1036,7 @@ int setup_incoming_call(call_details_t c /* struct ast_channel *c = NULL; */ struct oh323_user *user = NULL; struct oh323_alias *alias = NULL; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; /* allocate the call*/ p = oh323_alloc(cd.call_reference); @@ -1839,7 +1839,7 @@ static int oh323_set_rtp_peer(struct ast struct sockaddr_in them; struct sockaddr_in us; char *mode; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; mode = convertcap(chan->writeformat); Index: channels/chan_iax.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_iax.c,v retrieving revision 1.62 diff -u -p -r1.62 chan_iax.c --- channels/chan_iax.c 29 Jun 2004 12:56:46 -0000 1.62 +++ channels/chan_iax.c 30 Jun 2004 16:25:34 -0000 @@ -509,7 +509,7 @@ static void showframe(struct ast_iax_fra char subclass2[20]; char *class; char *subclass; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (f) { fh = f->data; snprintf(retries, sizeof(retries), "%03d", f->retries); @@ -940,7 +940,7 @@ static int handle_error(void) static int send_packet(struct ast_iax_frame *f) { int res; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; /* Called with iaxsl held */ if (option_debug) ast_log(LOG_DEBUG, "Sending %d on %d/%d to %s:%d\n", f->ts, f->callno, iaxs[f->callno]->peercallno, ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[f->callno]->addr.sin_addr), ntohs(iaxs[f->callno]->addr.sin_port)); @@ -1110,7 +1110,7 @@ static int attempt_transmit(void *data) struct ast_iax_frame *f = data; int freeme=0; int callno = f->callno; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; /* Make sure this call is still active */ if (callno > -1) ast_mutex_lock(&iaxsl[callno]); @@ -1905,7 +1905,7 @@ static int iax_start_transfer(struct ast int res; char req0[256]; char req1[256]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; struct chan_iax_pvt *p0 = c0->pvt->pvt; struct chan_iax_pvt *p1 = c1->pvt->pvt; snprintf(req0, sizeof(req0), "remip=%s;remport=%d;remcall=%d;", ast_inet_ntoa(iabuf, sizeof(iabuf), p1->addr.sin_addr), ntohs(p1->addr.sin_port), p1->peercallno); @@ -2083,7 +2083,7 @@ static struct ast_channel *ast_iax_new(s { char host[256]; struct ast_channel *tmp; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; tmp = ast_channel_alloc(1); if (tmp) { if (!iax_getpeername(i->addr, host, sizeof(host))) @@ -2339,7 +2339,7 @@ static int iax_show_peers(int fd, int ar #define FORMAT "%-15.15s %-15.15s %s %-15.15s %-8d %-10s\n" struct iax_peer *peer; char name[256] = ""; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (argc != 3) return RESULT_SHOWUSAGE; ast_mutex_lock(&peerl.lock); @@ -2414,7 +2414,7 @@ static int iax_show_registry(int fd, int struct iax_registry *reg; char host[80]; char perceived[80]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (argc != 3) return RESULT_SHOWUSAGE; ast_mutex_lock(&peerl.lock); @@ -2440,7 +2440,7 @@ static int iax_show_channels(int fd, int #define FORMAT "%-15.15s %-10.10s %5.5d/%5.5d %5.5d/%5.5d %-5.5dms %-4.4dms %-6.6s\n" int x; int numchans = 0; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (argc != 3) return RESULT_SHOWUSAGE; ast_cli(fd, FORMAT2, "Peer", "Username", "ID (Lo/Rem)", "Seq (Tx/Rx)", "Lag", "Jitter", "Format"); @@ -2634,7 +2634,7 @@ static int check_access(int callno, stru char *var, *value; struct iax_user *user; char request[256]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; int gotcapability=0; char *stringp=NULL; strncpy(request, orequest, sizeof(request)-1); @@ -2745,7 +2745,7 @@ static int check_access(int callno, stru static int raw_hangup(struct sockaddr_in *sin, short src, short dst) { struct ast_iax_full_hdr fh; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; fh.callno = htons(src | AST_FLAG_FULL); fh.dcallno = htons(dst); fh.ts = 0; @@ -2851,7 +2851,7 @@ static int register_verify(int callno, s char md5secret[256] = ""; char rsasecret[256] = ""; char secret[256] = ""; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; struct iax_peer *p; struct ast_key *key; char *var; @@ -2996,7 +2996,7 @@ static int authenticate(char *challenge, { int res = -1; int x; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (keyn && strlen(keyn)) { if (!strstr(methods, "rsa")) { if (!secret || !strlen(secret)) @@ -3304,7 +3304,7 @@ static int iax_ack_registry(char *oreque int ourport = 0; int refresh = 0; char ourip[256] = ""; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; struct sockaddr_in oldus; char *var, *value; char *stringp=NULL; @@ -3442,7 +3442,7 @@ static int update_registry(char *name, s /* Called from IAX thread only, with proper iaxsl lock */ char requeststr[256] = ""; struct iax_peer *p; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; for (p = peerl.peers;p;p = p->next) { if (!strcasecmp(name, p->name)) { break; @@ -3524,7 +3524,7 @@ static int registry_rerequest(char *oreq char peer[256] = ""; char methods[256] = ""; char challenge[256] = ""; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; char *var, *value; int res; char *stringp=NULL; @@ -3666,7 +3666,7 @@ static int socket_read(int *id, int fd, int format; int exists; int mm; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; char rel0[256]; char rel1[255]; char empty[32]=""; /* Safety measure */ @@ -5400,7 +5400,7 @@ int load_module(void) int x; struct iax_registry *reg; struct iax_peer *peer; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; struct sockaddr_in sin; Index: channels/chan_iax2.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v retrieving revision 1.165 diff -u -p -r1.165 chan_iax2.c --- channels/chan_iax2.c 30 Jun 2004 13:57:49 -0000 1.165 +++ channels/chan_iax2.c 30 Jun 2004 16:25:38 -0000 @@ -629,7 +629,7 @@ static int iax2_getpeername(struct socka static struct chan_iax2_pvt *new_iax(struct sockaddr_in *sin, int lockpeer) { struct chan_iax2_pvt *tmp; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; tmp = malloc(sizeof(struct chan_iax2_pvt)); if (tmp) { memset(tmp, 0, sizeof(struct chan_iax2_pvt)); @@ -1195,7 +1195,7 @@ static int transmit_trunk(struct iax_fra static int send_packet(struct iax_frame *f) { int res; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; /* Called with iaxsl held */ if (option_debug) ast_log(LOG_DEBUG, "Sending %d on %d/%d to %s:%d\n", f->ts, f->callno, iaxs[f->callno]->peercallno, ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[f->callno]->addr.sin_addr), ntohs(iaxs[f->callno]->addr.sin_port)); @@ -1386,7 +1386,7 @@ static int attempt_transmit(void *data) struct iax_frame *f = data; int freeme=0; int callno = f->callno; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; /* Make sure this call is still active */ if (callno) ast_mutex_lock(&iaxsl[callno]); @@ -1597,7 +1597,7 @@ static unsigned int calc_fakestamp(struc static int forward_delivery(struct iax_frame *fr) { struct chan_iax2_pvt *p1, *p2; - char tmp[80]; + char iabuf[INET_ADDRSTRLEN]; p1 = iaxs[fr->callno]; p2 = iaxs[p1->bridgecallno]; if (!p1) @@ -1610,7 +1610,8 @@ static int forward_delivery(struct iax_f fr->ts, p1->callno, p1->peercallno, p2->callno, p2->peercallno, - ast_inet_ntoa(tmp, sizeof(tmp), p2->addr.sin_addr), ntohs(p2->addr.sin_port)); + ast_inet_ntoa(iabuf, sizeof(iabuf), p2->addr.sin_addr), + ntohs(p2->addr.sin_port)); /* Fix relative timestamp */ fr->ts = calc_fakestamp(p1, p2, fr->ts); @@ -1836,7 +1837,7 @@ static void mysql_update_peer(char *peer if (mysql && (strlen(peer) < 128)) { char query[512]; char *name; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; time_t nowtime; name = alloca(strlen(peer) * 2 + 1); time(&nowtime); @@ -2764,7 +2765,7 @@ static unsigned int calc_rxstamp(struct static struct iax2_trunk_peer *find_tpeer(struct sockaddr_in *sin) { struct iax2_trunk_peer *tpeer; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; /* Finds and locks trunk peer */ ast_mutex_lock(&tpeerlock); tpeer = tpeers; @@ -2799,7 +2800,7 @@ static int iax2_trunk_queue(struct chan_ struct iax2_trunk_peer *tpeer; void *tmp, *ptr; struct ast_iax2_meta_trunk_entry *met; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; tpeer = find_tpeer(&pvt->addr); if (tpeer) { if (tpeer->trunkdatalen + f->datalen + 4 >= tpeer->trunkdataalloc) { @@ -3017,7 +3018,7 @@ static int iax2_show_peers(int fd, int a #define FORMAT "%-15.15s %-15.15s %s %-15.15s %-5d%s %-10s\n" struct iax2_peer *peer; char name[256] = ""; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; int registeredonly=0; if ((argc != 3) && (argc != 4) && (argc != 5)) return RESULT_SHOWUSAGE; @@ -3145,7 +3146,7 @@ static int iax2_show_registry(int fd, in struct iax2_registry *reg; char host[80]; char perceived[80]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (argc != 3) return RESULT_SHOWUSAGE; ast_mutex_lock(&peerl.lock); @@ -3181,7 +3182,7 @@ static int iax2_show_channels(int fd, in #define FORMAT "%-15.15s %-10.10s %5.5d/%5.5d %5.5d/%5.5d %-5.5dms %-4.4dms %-4.4dms %-6.6s\n" int x; int numchans = 0; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (argc != 3) return RESULT_SHOWUSAGE; ast_cli(fd, FORMAT2, "Peer", "Username", "ID (Lo/Rem)", "Seq (Tx/Rx)", "Lag", "Jitter", "JitBuf", "Format"); @@ -3391,7 +3392,7 @@ static int check_access(int callno, stru struct iax2_user *user, *best = NULL; int bestscore = 0; int gotcapability=0; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (!iaxs[callno]) return res; @@ -3535,7 +3536,7 @@ static int check_access(int callno, stru static int raw_hangup(struct sockaddr_in *sin, unsigned short src, unsigned short dst) { struct ast_iax2_full_hdr fh; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; fh.scallno = htons(src | IAX_FLAG_FULL); fh.dcallno = htons(dst); fh.ts = 0; @@ -3624,7 +3625,7 @@ static int register_verify(int callno, s char md5secret[256] = ""; char rsasecret[256] = ""; char secret[256] = ""; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; struct iax2_peer *p; struct ast_key *key; char *keyn; @@ -3761,7 +3762,7 @@ static int authenticate(char *challenge, { int res = -1; int x; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (keyn && !ast_strlen_zero(keyn)) { if (!(authmethods & IAX_AUTH_RSA)) { if (!secret || ast_strlen_zero(secret)) @@ -4008,7 +4009,7 @@ static int iax2_ack_registry(struct iax_ char ourip[256] = ""; struct sockaddr_in oldus; struct sockaddr_in us; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; int oldmsgs; memset(&us, 0, sizeof(us)); @@ -4135,7 +4136,7 @@ static void reg_source_db(struct iax2_pe { char data[80]; struct in_addr in; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; char *c, *d; if (!ast_db_get("IAX/Registry", p->name, data, sizeof(data))) { c = strchr(data, ':'); @@ -4175,7 +4176,7 @@ static int update_registry(char *name, s struct iax2_peer *p; int msgcount; char data[80]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; int version; memset(&ied, 0, sizeof(ied)); for (p = peerl.peers;p;p = p->next) { @@ -4289,7 +4290,7 @@ static int registry_rerequest(struct iax /* Start pessimistic */ struct iax_ie_data ied; char peer[256] = ""; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; char challenge[256] = ""; int res; int authmethods = 0; @@ -4496,7 +4497,7 @@ static int timing_read(int *id, int fd, { char buf[1024]; int res; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; struct iax2_trunk_peer *tpeer, *prev = NULL, *drop=NULL; int processed = 0; int totalcalls = 0; @@ -4735,7 +4736,7 @@ static int socket_read(int *id, int fd, char dblbuf[4096]; /* Declaration of dblbuf must immediately *preceed* fr on the stack */ struct iax_frame fr; struct iax_frame *cur; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; struct ast_frame f; struct ast_channel *c; struct iax2_dpcache *dp; @@ -6981,7 +6982,7 @@ int load_module(void) char *config = "iax.conf"; int res = 0; int x; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; struct iax2_registry *reg; struct iax2_peer *peer; Index: channels/chan_mgcp.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_mgcp.c,v retrieving revision 1.57 diff -u -p -r1.57 chan_mgcp.c --- channels/chan_mgcp.c 29 Jun 2004 12:56:46 -0000 1.57 +++ channels/chan_mgcp.c 30 Jun 2004 16:25:39 -0000 @@ -491,7 +491,7 @@ static int resend_response(struct mgcp_s { struct mgcp_endpoint *p = sub->parent; int res; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (mgcpdebug) { ast_verbose("Retransmitting:\n%s\n to %s:%d\n", resp->buf, ast_inet_ntoa(iabuf, sizeof(iabuf), p->parent->addr.sin_addr), ntohs(p->parent->addr.sin_port)); } @@ -505,7 +505,7 @@ static int send_response(struct mgcp_sub { struct mgcp_endpoint *p = sub->parent; int res; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (mgcpdebug) { ast_verbose("Transmitting:\n%s\n to %s:%d\n", req->data, ast_inet_ntoa(iabuf, sizeof(iabuf), p->parent->addr.sin_addr), ntohs(p->parent->addr.sin_port)); } @@ -700,7 +700,7 @@ static int send_request(struct mgcp_endp { int res = 0; struct mgcp_request **queue, *q, *r, *t; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; ast_mutex_t *l; switch (req->cmd) { @@ -937,7 +937,7 @@ static int mgcp_show_endpoints(int fd, i struct mgcp_gateway *g; struct mgcp_endpoint *e; int hasendpoints = 0; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (argc != 3) return RESULT_SHOWUSAGE; ast_mutex_lock(&gatelock); @@ -1367,7 +1367,7 @@ static struct mgcp_subchannel *find_subc struct mgcp_endpoint *p = NULL; struct mgcp_subchannel *sub = NULL; struct mgcp_gateway *g; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; char tmp[256] = ""; char *at = NULL, *c; int found = 0; @@ -1800,7 +1800,7 @@ static int add_sdp(struct mgcp_request * char t[256]; char m[256]; char a[1024] = ""; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; int x; struct sockaddr_in dest; struct mgcp_endpoint *p = sub->parent; @@ -2169,7 +2169,7 @@ static struct mgcp_request *find_command struct mgcp_request **queue, ast_mutex_t *l, int ident) { struct mgcp_request *prev, *req; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; ast_mutex_lock(l); for (prev = NULL, req = *queue; req; prev = req, req = req->next) { @@ -2798,7 +2798,7 @@ static int handle_request(struct mgcp_su struct ast_frame f = { 0, }; struct mgcp_endpoint *p = sub->parent; struct mgcp_gateway *g = NULL; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; int res; if (mgcpdebug) { ast_verbose("Handling request '%s' on %s@%s\n", req->verb, p->name, p->parent->name); @@ -3092,7 +3092,7 @@ static int mgcpsock_read(int *id, int fd int len; int result; int ident; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; len = sizeof(sin); memset(&req, 0, sizeof(req)); res = recvfrom(mgcpsock, req.data, sizeof(req.data) - 1, 0, (struct sockaddr *)&sin, &len); @@ -3861,7 +3861,7 @@ static int reload_config(void) struct ast_variable *v; struct mgcp_gateway *g; struct mgcp_endpoint *e; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; char *cat; struct ast_hostent ahp; struct hostent *hp; int format; Index: channels/chan_sip.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v retrieving revision 1.435 diff -u -p -r1.435 chan_sip.c --- channels/chan_sip.c 30 Jun 2004 13:57:49 -0000 1.435 +++ channels/chan_sip.c 30 Jun 2004 16:25:44 -0000 @@ -581,7 +581,7 @@ static inline int sip_debug_test_pvt(str static int __sip_xmit(struct sip_pvt *p, char *data, int len) { int res; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (p->nat == SIP_NAT_ALWAYS) res=sendto(sipsock, data, len, 0, (struct sockaddr *)&p->recv, sizeof(struct sockaddr_in)); else @@ -608,7 +608,7 @@ static int ast_sip_ouraddrfor(struct in_ if (localaddr && externip.sin_addr.s_addr && ast_apply_ha(localaddr, &theirs)) { char t[256]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; memcpy(us, &externip.sin_addr, sizeof(struct in_addr)); strcpy(t, ast_inet_ntoa(iabuf, sizeof(iabuf), *(struct in_addr *)&them->s_addr)); ast_log(LOG_DEBUG, "Target address %s is not local, substituting externip\n", t); @@ -657,7 +657,7 @@ static int retrans_pkt(void *data) { struct sip_pkt *pkt=data, *prev, *cur; int res = 0; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; ast_mutex_lock(&pkt->owner->lock); if (pkt->retrans < MAX_RETRANS) { pkt->retrans++; @@ -840,7 +840,7 @@ static int __sip_semi_ack(struct sip_pvt static int send_response(struct sip_pvt *p, struct sip_request *req, int reliable, int seqno) { int res; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (sip_debug_test_pvt(p)) { if (p->nat == SIP_NAT_ALWAYS) ast_verbose("%sTransmitting (NAT):\n%s\n to %s:%d\n", reliable ? "Reliably " : "", req->data, ast_inet_ntoa(iabuf, sizeof(iabuf), p->recv.sin_addr), ntohs(p->recv.sin_port)); @@ -863,7 +863,7 @@ static int send_response(struct sip_pvt static int send_request(struct sip_pvt *p, struct sip_request *req, int reliable, int seqno) { int res; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (sip_debug_test_pvt(p)) { if (p->nat == SIP_NAT_ALWAYS) ast_verbose("%sTransmitting:\n%s (NAT) to %s:%d\n", reliable ? "Reliably " : "", req->data, ast_inet_ntoa(iabuf, sizeof(iabuf), p->recv.sin_addr), ntohs(p->recv.sin_port)); @@ -1031,7 +1031,7 @@ static void mysql_update_peer(char *peer char query[512]; char *name; char *uname; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; time_t nowtime; name = alloca(strlen(peer) * 2 + 1); uname = alloca(strlen(username) * 2 + 1); @@ -1061,7 +1061,7 @@ static struct sip_peer *mysql_peer(char char *name = NULL; int numfields, x; int port; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; time_t regseconds, nowtime; MYSQL_RES *result; MYSQL_FIELD *fields; @@ -1208,7 +1208,7 @@ static int create_addr(struct sip_pvt *r int found=0; char *port; int portno; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; char host[256], *hostn; r->sa.sin_family = AF_INET; @@ -2196,7 +2196,7 @@ static void build_callid(char *callid, i int res; int val; int x; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; for (x=0;x<4;x++) { val = rand(); res = snprintf(callid, len, "%08x", val); @@ -2211,7 +2211,7 @@ static void build_callid(char *callid, i static struct sip_pvt *sip_alloc(char *callid, struct sockaddr_in *sin, int useglobalnat) { struct sip_pvt *p; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; p = malloc(sizeof(struct sip_pvt)); if (!p) @@ -2302,7 +2302,7 @@ static struct sip_pvt *find_call(struct struct sip_pvt *p; char *callid; char tmp[256] = ""; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; char *cmd; char *tag = "", *c; int themisfrom; @@ -2568,7 +2568,7 @@ static int process_sdp(struct sip_pvt *p char *c; char *a; char host[258]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; int len = -1; int portno=0; int vportno=0; @@ -2847,7 +2847,7 @@ static int copy_via_headers(struct sip_p int start = 0; int copied = 0; char new[256]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; for (;;) { tmp = __get_header(orig, field, &start); if (!ast_strlen_zero(tmp)) { @@ -2902,7 +2902,7 @@ static void add_route(struct sip_request static void set_destination(struct sip_pvt *p, char *uri) { char *h, *maddr, hostname[256]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; int port, hn; struct hostent *hp; struct ast_hostent ahp; @@ -3043,7 +3043,7 @@ static int reqprep(struct sip_request *r char stripped[80] =""; char tmp[80]; char newto[256]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; char *c, *n; char *ot, *of; @@ -3252,7 +3252,7 @@ static int add_sdp(struct sip_request *r char m2[256] = ""; char a[1024] = ""; char a2[1024] = ""; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; int x; int capability; struct sockaddr_in dest; @@ -3555,7 +3555,7 @@ static void extract_uri(struct sip_pvt * /*--- build_contact: Build contact header - the contact header we send out ---*/ static void build_contact(struct sip_pvt *p) { - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; /* Construct Contact: header */ if (ourport != 5060) snprintf(p->our_contact, sizeof(p->our_contact), "", p->exten, ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip), ourport); @@ -3570,7 +3570,7 @@ static void initreqprep(struct sip_reque char from[256]; char to[256]; char tmp[80]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; char cid[256]; char *l = callerid, *n=NULL; @@ -3643,7 +3643,7 @@ static void initreqprep(struct sip_reque static int transmit_invite(struct sip_pvt *p, char *cmd, int sdp, char *auth, char *authheader, char *vxml_url, char *distinctive_ring, char *osptoken, int init) { struct sip_request req; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (init) { /* Bump branch even on initial requests */ @@ -3846,7 +3846,7 @@ static int sip_reg_timeout(void *data) /* if we are here, our registration timed out, so we'll just do it over */ struct sip_registry *r=data; struct sip_pvt *p; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; int res; ast_mutex_lock(®l.lock); ast_log(LOG_NOTICE, "Registration for '%s@%s' timed out, trying again\n", r->username, ast_inet_ntoa(iabuf, sizeof(iabuf), r->addr.sin_addr)); @@ -3874,7 +3874,7 @@ static int transmit_register(struct sip_ char tmp[80]; char via[80]; char addr[80]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; struct sip_pvt *p; struct ast_hostent ahp; struct hostent *hp; @@ -4095,7 +4095,7 @@ static int sip_poke_peer(struct sip_peer static void reg_source_db(struct sip_peer *p) { char data[80]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; struct in_addr in; char *c, *d, *u; int expiry; @@ -4138,7 +4138,7 @@ static int parse_contact(struct sip_pvt { char contact[80]= ""; char data[256]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; char *expires = get_header(req, "Expires"); int expiry = atoi(expires); char *c, *n, *pt; @@ -4551,7 +4551,7 @@ static int register_verify(struct sip_pv int res = -1; struct sip_peer *peer; char tmp[256] = ""; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; char *name, *c; char *t; /* Terminate URI */ @@ -4921,7 +4921,7 @@ static int get_also_info(struct sip_pvt static int check_via(struct sip_pvt *p, struct sip_request *req) { char via[256] = ""; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; char *c, *pt; struct hostent *hp; struct ast_hostent ahp; @@ -5035,7 +5035,7 @@ static int check_user_full(struct sip_pv struct sip_peer *peer; char *of, from[256] = "", *c; char *rpid,rpid_num[50]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; int res = 0; char *t; char calleridname[50]; @@ -5341,7 +5341,7 @@ static int sip_show_peers(int fd, int ar #define FORMAT "%-15.15s %-15.15s %s %s %s %-15.15s %-8d %-10s\n" struct sip_peer *peer; char name[256] = ""; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (argc != 3 && argc != 5) return RESULT_SHOWUSAGE; ast_mutex_lock(&peerl.lock); @@ -5448,7 +5448,7 @@ static void print_group(int fd, unsigne static int sip_show_peer(int fd, int argc, char *argv[]) { char status[30]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; struct sip_peer *peer; if (argc != 4) @@ -5553,7 +5553,7 @@ static int sip_show_registry(int fd, int #define FORMAT "%-20.20s %-12.12s %8d %-20.20s\n" struct sip_registry *reg; char host[80]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (argc != 3) return RESULT_SHOWUSAGE; ast_mutex_lock(®l.lock); @@ -5590,7 +5590,7 @@ static int __sip_show_channels(int fd, i #define FORMAT2 "%-15.15s %-10.10s %-11.11s %-11.11s %s\n" #define FORMAT "%-15.15s %-10.10s %-11.11s %5.5d/%5.5d %-6.6s%s\n" struct sip_pvt *cur; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; int numchans = 0; if (argc != 3) return RESULT_SHOWUSAGE; @@ -5654,7 +5654,7 @@ static int sip_show_channel(int fd, int { struct sip_pvt *cur; char tmp[256]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; size_t len; int found = 0; if (argc != 4) @@ -5824,7 +5824,7 @@ static int sip_do_debug_ip(int fd, int a { struct hostent *hp; struct ast_hostent ahp; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; int port = 0; char *p, *arg; if (argc != 4) @@ -5854,7 +5854,7 @@ static int sip_do_debug_ip(int fd, int a static int sip_do_debug_peer(int fd, int argc, char *argv[]) { struct sip_peer *peer; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (argc != 4) return RESULT_SHOWUSAGE; ast_mutex_lock(&peerl.lock); @@ -6065,7 +6065,7 @@ static int build_reply_digest(struct sip char resp_hash[256]; char uri[256] = ""; char cnonce[80]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (!ast_strlen_zero(p->domain)) strncpy(uri, p->domain, sizeof(uri) - 1); @@ -6266,7 +6266,7 @@ static void handle_response(struct sip_p int pingtime; struct timeval tv; int seqno=0; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; c = get_header(req, "Cseq"); if (sscanf(c, "%d ", &seqno) != 1) { ast_log(LOG_WARNING, "Unable to determine sequence number\n"); @@ -6648,7 +6648,7 @@ static int handle_request(struct sip_pvt int respid; int res; int gotdest; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; struct ast_frame af = { AST_FRAME_NULL, }; int debug = sip_debug_test_pvt(p); @@ -7223,7 +7223,7 @@ static int sip_send_mwi_to_peer(struct s /* Called with peerl lock, but releases it */ struct sip_pvt *p; char name[256] = ""; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; int newmsgs, oldmsgs; /* Check for messages */ ast_app_messagecount(peer->mailbox, &newmsgs, &oldmsgs); @@ -7441,7 +7441,7 @@ static int sip_poke_noanswer(void *data) static int sip_poke_peer(struct sip_peer *peer) { struct sip_pvt *p; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (!peer->maxms || !peer->addr.sin_addr.s_addr) { /* IF we have no IP, or this isn't to be monitored, return imeediately after clearing things out */ @@ -7546,7 +7546,7 @@ static struct ast_channel *sip_request(c struct ast_channel *tmpc = NULL; char *ext, *host; char tmp[256] = ""; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; char *dest = data; oldformat = format; @@ -8010,7 +8010,7 @@ static int reload_config(void) struct hostent *hp; int format; int oldport = ntohs(bindaddr.sin_port); - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; globaldtmfmode = SIP_DTMF_RFC2833; globalpromiscredir = 0; Index: channels/chan_skinny.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_skinny.c,v retrieving revision 1.49 diff -u -p -r1.49 chan_skinny.c --- channels/chan_skinny.c 29 Jun 2004 12:56:46 -0000 1.49 +++ channels/chan_skinny.c 30 Jun 2004 16:25:45 -0000 @@ -988,7 +988,7 @@ static int skinny_show_lines(int fd, int struct skinny_device *d; struct skinny_line *l; int haslines = 0; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (argc != 3) return RESULT_SHOWUSAGE; ast_mutex_lock(&devicelock); @@ -2327,7 +2327,7 @@ static void *skinny_session(void *data) int res; skinny_req *req; struct skinnysession *s = data; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; ast_verbose(VERBOSE_PREFIX_3 "Starting Skinny session from %s\n", ast_inet_ntoa(iabuf, sizeof(iabuf), s->sin.sin_addr)); @@ -2508,7 +2508,7 @@ static int reload_config(void) struct ast_variable *v; int format; char *cat; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; struct skinny_device *d; int oldport = ntohs(bindaddr.sin_port); Index: channels/iax2-parser.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/iax2-parser.c,v retrieving revision 1.23 diff -u -p -r1.23 iax2-parser.c --- channels/iax2-parser.c 29 Jun 2004 12:56:46 -0000 1.23 +++ channels/iax2-parser.c 30 Jun 2004 16:25:46 -0000 @@ -45,7 +45,7 @@ static void (*errorf)(const char *str) = static void dump_addr(char *output, int maxlen, void *value, int len) { struct sockaddr_in sin; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (len == (int)sizeof(sin)) { memcpy(&sin, value, len); snprintf(output, maxlen, "IPV4 %s:%d", ast_inet_ntoa(iabuf, sizeof(iabuf), sin.sin_addr), ntohs(sin.sin_port)); @@ -254,7 +254,7 @@ void iax_showframe(struct iax_frame *f, char *class; char *subclass; char tmp[256]; - char iabuf[80]; + char iabuf[INET_ADDRSTRLEN]; if (f) { fh = f->data; snprintf(retries, (int)sizeof(retries), "%03d", f->retries); Index: res/res_osp.c =================================================================== RCS file: /usr/cvsroot/asterisk/res/res_osp.c,v retrieving revision 1.5 diff -u -p -r1.5 res_osp.c --- res/res_osp.c 29 Jun 2004 13:52:03 -0000 1.5 +++ res/res_osp.c 30 Jun 2004 16:25:47 -0000 @@ -423,7 +423,7 @@ static int loadPemPrivateKey(unsigned ch int ast_osp_validate(char *provider, char *token, int *handle, unsigned int *timelimit, char *callerid, struct in_addr addr, char *extension) { char tmp[256]="", *l, *n; - char ip[256]; + char iabuf[INET_ADDRSTRLEN]; char source[OSP_MAX]; /* Same length as osp->source */ char *token2; int tokenlen; @@ -452,7 +452,7 @@ int ast_osp_validate(char *provider, cha } callerid = l; ast_mutex_lock(&osplock); - ast_inet_ntoa(ip, sizeof(ip), addr); + ast_inet_ntoa(iabuf, sizeof(iabuf), addr); osp = providers; while(osp) { if (!strcasecmp(osp->name, provider)) { @@ -470,10 +470,10 @@ int ast_osp_validate(char *provider, cha if (res) { res = 0; dummy = 0; - if (!OSPPTransactionValidateAuthorisation(*handle, ip, source, NULL, NULL, + if (!OSPPTransactionValidateAuthorisation(*handle, iabuf, source, NULL, NULL, callerid, OSPC_E164, extension, OSPC_E164, 0, "", tokenlen, token2, &authorised, timelimit, &dummy, NULL, TOKEN_ALGO_BOTH)) { if (authorised) { - ast_log(LOG_DEBUG, "Validated token for '%s' from '%s@%s'\n", extension, callerid, ip); + ast_log(LOG_DEBUG, "Validated token for '%s' from '%s@%s'\n", extension, callerid, iabuf); res = 1; } }