[Asterisk-cvs] asterisk acl.c,1.26,1.27 manager.c,1.60,1.61 rtp.c,1.77,1.78

markster at lists.digium.com markster at lists.digium.com
Wed Jun 30 13:11:00 CDT 2004


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

Modified Files:
	acl.c manager.c rtp.c 
Log Message:
Use INET_ADDRLEN (bug #1956) (from airport!)


Index: acl.c
===================================================================
RCS file: /usr/cvsroot/asterisk/acl.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- acl.c	29 Jun 2004 19:21:25 -0000	1.26
+++ acl.c	30 Jun 2004 16:56:51 -0000	1.27
@@ -170,10 +170,13 @@
 	/* 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 @@
 		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 @@
 				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 @@
 			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
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- manager.c	29 Jun 2004 12:56:46 -0000	1.60
+++ manager.c	30 Jun 2004 16:56:51 -0000	1.61
@@ -163,7 +163,7 @@
 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 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 @@
 	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 @@
 	int res;
 	int x;
 	struct pollfd fds[1];
-	char iabuf[80];
+	char iabuf[INET_ADDRSTRLEN];
 	for (x=1;x<s->inlen;x++) {
 		if ((s->inbuf[x] == '\n') && (s->inbuf[x-1] == '\r')) {
 			/* Copy output data up to and including \r\n */
@@ -1050,7 +1050,7 @@
 {
 	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
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- rtp.c	30 Jun 2004 06:03:57 -0000	1.77
+++ rtp.c	30 Jun 2004 16:56:51 -0000	1.78
@@ -174,7 +174,7 @@
 {
 	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 @@
 	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 @@
 	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 ms;
 	int x;
 	char data[256];
-	char iabuf[80];
+	char iabuf[INET_ADDRSTRLEN];
 
 	if ((digit <= '9') && (digit >= '0'))
 		digit -= '0';
@@ -1013,7 +1013,7 @@
 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 @@
 	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;




More information about the svn-commits mailing list