Browse code

- fixed ":" in port_no_str bug. Now port_no_str no longer contains the colon (updated sms & tm)

Andrei Pelinescu-Onciul authored on 02/04/2003 15:51:03
Showing 4 changed files
... ...
@@ -49,16 +49,7 @@ extern struct socket_info sock_info[]; /* all addresses we listen/send from*/
49 49
 extern struct socket_info tcp_info[]; /* all tcp sockets we listen on*/
50 50
 extern int sock_no; /* number of addresses/open sockets*/
51 51
 extern unsigned short port_no;
52
-/*
53
-extern char port_no_str[];
54
-extern int port_no_str_len;
55
-*/
56
-/*
57
-extern char * names[];
58
-extern int names_len[];
59
-extern struct ip_addr addresses[];
60
-extern int addresses_no;
61
-*/
52
+
62 53
 extern struct socket_info* bind_address; /* pointer to the crt. proc.
63 54
 											listening address */
64 55
 extern int bind_idx; /* same as above but index in the bound[] array */
... ...
@@ -1409,7 +1409,7 @@ try_again:
1409 1409
 	for (r=0; r<sock_no;r++){
1410 1410
 		/* fix port number, port_no should be !=0 here */
1411 1411
 		if (sock_info[r].port_no==0) sock_info[r].port_no=port_no;
1412
-		port_no_str_len=snprintf(port_no_str, MAX_PORT_LEN, ":%d", 
1412
+		port_no_str_len=snprintf(port_no_str, MAX_PORT_LEN, "%d", 
1413 1413
 									(unsigned short) sock_info[r].port_no);
1414 1414
 		/* if buffer too small, snprintf may return per C99 estimated size
1415 1415
 		   of needed space; there is no guarantee how many characters 
... ...
@@ -50,9 +50,10 @@
50 50
  *  2003-02-13  t_uac, t _uac_dlg, gethfblock, uri2proxy changed to use 
51 51
  *               proto & rb->dst (andrei)
52 52
  *  2003-02-27  FIFO/UAC now dumps reply -- good for CTD (jiri)
53
- *  2003-03-01  kr set through a function now (jiri)
54 53
  *  2003-02-28  scratchpad compatibility abandoned (jiri)
54
+ *  2003-03-01  kr set through a function now (jiri)
55 55
  *  2003-03-19  replaced all mallocs/frees w/ pkg_malloc/pkg_free (andrei)
56
+ *  2003-04-02  port_no_str does not contain a leading ':' anymore (andrei)
56 57
  */
57 58
 
58 59
 
... ...
@@ -549,6 +550,9 @@ static char *get_hfblock(str *uri, struct hdr_field *hf, int *l, int proto)
549 549
 						new=new_str(sock_name->s, sock_name->len,
550 550
 								&last, &total_len );
551 551
 						if (!new) goto error;
552
+						/* inefficient - FIXME --andrei*/
553
+						new=new_str(":", 1, &last, &total_len);
554
+						if (!new) goto error;
552 555
 						new=new_str(portname->s, portname->len,
553 556
 								&last, &total_len );
554 557
 						if (!new) goto error;
... ...
@@ -183,7 +183,7 @@ static char * warning_builder( struct sip_msg *msg, unsigned int *returned_len)
183 183
 		fix_len +=WARNING_LEN;
184 184
 		memcpy(buf+fix_len, bind_address->name.s,bind_address->name.len);
185 185
 		fix_len += bind_address->name.len;
186
-		//*(buf+fix_len++) = ':';
186
+		*(buf+fix_len) = ':'; fix_len++;
187 187
 		memcpy(buf+fix_len,bind_address->port_no_str.s,
188 188
 			bind_address->port_no_str.len);
189 189
 		fix_len += bind_address->port_no_str.len;
... ...
@@ -1574,7 +1574,7 @@ char* via_builder( unsigned int *len,
1574 1574
 
1575 1575
 	max_len=MY_VIA_LEN+send_sock->address_str.len /* space in MY_VIA */
1576 1576
 		+2 /* just in case it is a v6 address ... [ ] */
1577
-		+send_sock->port_no_str.len
1577
+		+1 /*':'*/+send_sock->port_no_str.len
1578 1578
 		+(branch?(MY_BRANCH_LEN+branch->len):0)
1579 1579
 		+(extra_params?extra_params->len:0)
1580 1580
 		+CRLF_LEN+1;
... ...
@@ -1609,6 +1609,7 @@ char* via_builder( unsigned int *len,
1609 1609
 	memcpy(line_buf+MY_VIA_LEN+extra_len, send_sock->address_str.s,
1610 1610
 		send_sock->address_str.len);
1611 1611
 	if (send_sock->port_no!=SIP_PORT){
1612
+		line_buf[via_len]=':'; via_len++;
1612 1613
 		memcpy(line_buf+via_len, send_sock->port_no_str.s,
1613 1614
 			 send_sock->port_no_str.len);
1614 1615
 		via_len+=send_sock->port_no_str.len;