- fixed ":" in port_no_str bug. Now port_no_str no longer contains the colon
authorAndrei Pelinescu-Onciul <andrei@iptel.org>
Wed, 2 Apr 2003 15:51:03 +0000 (15:51 +0000)
committerAndrei Pelinescu-Onciul <andrei@iptel.org>
Wed, 2 Apr 2003 15:51:03 +0000 (15:51 +0000)
(updated sms & tm)

globals.h
main.c
modules/tm/uac.c
msg_translator.c

index d898c74..fdc3b71 100644 (file)
--- a/globals.h
+++ b/globals.h
@@ -49,16 +49,7 @@ extern struct socket_info sock_info[]; /* all addresses we listen/send from*/
 extern struct socket_info tcp_info[]; /* all tcp sockets we listen on*/
 extern int sock_no; /* number of addresses/open sockets*/
 extern unsigned short port_no;
-/*
-extern char port_no_str[];
-extern int port_no_str_len;
-*/
-/*
-extern char * names[];
-extern int names_len[];
-extern struct ip_addr addresses[];
-extern int addresses_no;
-*/
+
 extern struct socket_info* bind_address; /* pointer to the crt. proc.
                                                                                        listening address */
 extern int bind_idx; /* same as above but index in the bound[] array */
diff --git a/main.c b/main.c
index 189d1da..34d9ef7 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1409,7 +1409,7 @@ try_again:
        for (r=0; r<sock_no;r++){
                /* fix port number, port_no should be !=0 here */
                if (sock_info[r].port_no==0) sock_info[r].port_no=port_no;
-               port_no_str_len=snprintf(port_no_str, MAX_PORT_LEN, ":%d", 
+               port_no_str_len=snprintf(port_no_str, MAX_PORT_LEN, "%d", 
                                                                        (unsigned short) sock_info[r].port_no);
                /* if buffer too small, snprintf may return per C99 estimated size
                   of needed space; there is no guarantee how many characters 
index 9eaa741..255bd9f 100644 (file)
  *  2003-02-13  t_uac, t _uac_dlg, gethfblock, uri2proxy changed to use 
  *               proto & rb->dst (andrei)
  *  2003-02-27  FIFO/UAC now dumps reply -- good for CTD (jiri)
- *  2003-03-01  kr set through a function now (jiri)
  *  2003-02-28  scratchpad compatibility abandoned (jiri)
+ *  2003-03-01  kr set through a function now (jiri)
  *  2003-03-19  replaced all mallocs/frees w/ pkg_malloc/pkg_free (andrei)
+ *  2003-04-02  port_no_str does not contain a leading ':' anymore (andrei)
  */
 
 
@@ -549,6 +550,9 @@ static char *get_hfblock(str *uri, struct hdr_field *hf, int *l, int proto)
                                                new=new_str(sock_name->s, sock_name->len,
                                                                &last, &total_len );
                                                if (!new) goto error;
+                                               /* inefficient - FIXME --andrei*/
+                                               new=new_str(":", 1, &last, &total_len);
+                                               if (!new) goto error;
                                                new=new_str(portname->s, portname->len,
                                                                &last, &total_len );
                                                if (!new) goto error;
index e248513..c025298 100644 (file)
@@ -183,7 +183,7 @@ static char * warning_builder( struct sip_msg *msg, unsigned int *returned_len)
                fix_len +=WARNING_LEN;
                memcpy(buf+fix_len, bind_address->name.s,bind_address->name.len);
                fix_len += bind_address->name.len;
-               //*(buf+fix_len++) = ':';
+               *(buf+fix_len) = ':'; fix_len++;
                memcpy(buf+fix_len,bind_address->port_no_str.s,
                        bind_address->port_no_str.len);
                fix_len += bind_address->port_no_str.len;
@@ -1574,7 +1574,7 @@ char* via_builder( unsigned int *len,
 
        max_len=MY_VIA_LEN+send_sock->address_str.len /* space in MY_VIA */
                +2 /* just in case it is a v6 address ... [ ] */
-               +send_sock->port_no_str.len
+               +1 /*':'*/+send_sock->port_no_str.len
                +(branch?(MY_BRANCH_LEN+branch->len):0)
                +(extra_params?extra_params->len:0)
                +CRLF_LEN+1;
@@ -1609,6 +1609,7 @@ char* via_builder( unsigned int *len,
        memcpy(line_buf+MY_VIA_LEN+extra_len, send_sock->address_str.s,
                send_sock->address_str.len);
        if (send_sock->port_no!=SIP_PORT){
+               line_buf[via_len]=':'; via_len++;
                memcpy(line_buf+via_len, send_sock->port_no_str.s,
                         send_sock->port_no_str.len);
                via_len+=send_sock->port_no_str.len;