Browse code

- warning and fixes (cfg.y $$=0 on error) merged from testing-0.8.12-r1 - pdt and mangler are now built by default (Makefile)

Andrei Pelinescu-Onciul authored on 20/11/2003 21:01:10
Showing 6 changed files
... ...
@@ -43,7 +43,7 @@ skip_cfg_install?=
43 43
 skip_modules?=
44 44
 
45 45
 # if not set on the cmd. line or the env, exclude this modules:
46
-exclude_modules?= 			cpl cpl-c ext extcmd mangler pdt \
46
+exclude_modules?= 			cpl cpl-c ext extcmd \
47 47
 							postgres snmp \
48 48
 							im radius_acc radius_auth \
49 49
 							jabber mysql \
... ...
@@ -1103,6 +1103,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
1103 1103
 														$3,
1104 1104
 														0);
1105 1105
 										#else
1106
+											$$=0;
1106 1107
 											yyerror("tls support not "
1107 1108
 													"compiled in");
1108 1109
 										#endif
... ...
@@ -1115,6 +1116,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
1115 1115
 															$3,
1116 1116
 															0);
1117 1117
 										#else
1118
+											$$=0;
1118 1119
 											yyerror("tls support not "
1119 1120
 													"compiled in");
1120 1121
 										#endif
... ...
@@ -1127,6 +1129,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
1127 1127
 															(void*)$3,
1128 1128
 															0);
1129 1129
 										#else
1130
+											$$=0;
1130 1131
 											yyerror("tls support not "
1131 1132
 													"compiled in");
1132 1133
 										#endif
... ...
@@ -1139,6 +1142,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
1139 1139
 															$3,
1140 1140
 															(void*)$5);
1141 1141
 										#else
1142
+											$$=0;
1142 1143
 											yyerror("tls support not "
1143 1144
 													"compiled in");
1144 1145
 										#endif
... ...
@@ -1151,6 +1155,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
1151 1151
 															$3,
1152 1152
 															(void*)$5);
1153 1153
 										#else
1154
+											$$=0;
1154 1155
 											yyerror("tls support not "
1155 1156
 													"compiled in");
1156 1157
 										#endif
... ...
@@ -1163,6 +1168,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
1163 1163
 															 (void*)$3,
1164 1164
 															(void*)$5);
1165 1165
 										#else
1166
+											$$=0;
1166 1167
 											yyerror("tls support not "
1167 1168
 													"compiled in");
1168 1169
 										#endif
... ...
@@ -1175,6 +1181,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
1175 1175
 															0,
1176 1176
 															0);
1177 1177
 										#else
1178
+											$$=0;
1178 1179
 											yyerror("tls support not "
1179 1180
 													"compiled in");
1180 1181
 										#endif
... ...
@@ -1189,6 +1196,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
1189 1189
 															0,
1190 1190
 															(void*)$5);
1191 1191
 										#else
1192
+											$$=0;
1192 1193
 											yyerror("tls support not "
1193 1194
 													"compiled in");
1194 1195
 										#endif
... ...
@@ -1201,6 +1209,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
1201 1201
 															0,
1202 1202
 															0);
1203 1203
 										#else
1204
+											$$=0;
1204 1205
 											yyerror("tls support not "
1205 1206
 													"compiled in");
1206 1207
 										#endif
... ...
@@ -1586,10 +1586,14 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1586 1586
 	struct lump_rpl   *lump;
1587 1587
 	struct lump_rpl   *body;
1588 1588
 	int               i;
1589
-	str               received = {0,0};
1590
-	str               rport = {0,0};
1591
-	str               warning = {0,0};
1592
-	str               content_len = {0,0};
1589
+	char*             received_buf;
1590
+	unsigned int      received_len;
1591
+	char*             rport_buf;
1592
+	unsigned int      rport_len;
1593
+	char*             warning_buf;
1594
+	unsigned int      warning_len;
1595
+	char*             content_len_buf;
1596
+	unsigned int      content_len_len;
1593 1597
 	unsigned int      text_len;
1594 1598
 	char *after_body;
1595 1599
 	str  to_tag;
... ...
@@ -1597,9 +1601,11 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1597 1597
 
1598 1598
 	body = 0;
1599 1599
 	buf=0;
1600
-
1600
+	received_buf=rport_buf=warning_buf=content_len_buf=0;
1601
+	received_len=rport_len=warning_len=content_len_len=0;
1602
+	
1601 1603
 	text_len=strlen(text);
1602
-
1604
+	
1603 1605
 	/* force parsing all headers -- we want to return all
1604 1606
 	Via's in the reply and they may be scattered down to the
1605 1607
 	end of header (non-block Vias are a really poor property
... ...
@@ -1615,7 +1621,7 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1615 1615
 
1616 1616
 	/* check if received needs to be added */
1617 1617
 	if (received_test(msg)) {
1618
-		if ((received.s=received_builder(msg,&received.len))==0) {
1618
+		if ((received_buf=received_builder(msg,&received_len))==0) {
1619 1619
 			LOG(L_ERR, "ERROR: build_res_buf_from_sip_req: "
1620 1620
 				"alas, received_builder failed\n");
1621 1621
 			goto error00;
... ...
@@ -1624,7 +1630,7 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1624 1624
 	/* check if rport needs to be updated */
1625 1625
 	if ( (msg->msg_flags&FL_FORCE_RPORT)||
1626 1626
 		(msg->via1->rport /*&& msg->via1->rport->value.s==0*/)){
1627
-		if ((rport.s=rport_builder(msg, &rport.len))==0){
1627
+		if ((rport_buf=rport_builder(msg, &rport_len))==0){
1628 1628
 			LOG(L_ERR, "ERROR: build_res_buf_from_sip_req:"
1629 1629
 							" rport_builder failed\n");
1630 1630
 			goto error01; /* free everything */
... ...
@@ -1652,7 +1658,7 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1652 1652
 			case HDR_VIA:
1653 1653
 				/* we always add CRLF to via*/
1654 1654
 				len+=(hdr->body.s+hdr->body.len)-hdr->name.s+CRLF_LEN;
1655
-				if (hdr==msg->h_via1) len += received.len+rport.len;
1655
+				if (hdr==msg->h_via1) len += received_len+rport_len;
1656 1656
 				break;
1657 1657
 			case HDR_RECORDROUTE:
1658 1658
 				/* RR only for 1xx and 2xx replies */
... ...
@@ -1676,14 +1682,14 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1676 1676
 		len += SERVER_HDR_LEN + CRLF_LEN;
1677 1677
 	/* warning hdr */
1678 1678
 	if (sip_warning) {
1679
-		warning.s = warning_builder(msg,&warning.len);
1680
-		if (warning.s) len += warning.len + CRLF_LEN;
1679
+		warning_buf = warning_builder(msg,&warning_len);
1680
+		if (warning_buf) len += warning_len + CRLF_LEN;
1681 1681
 		else LOG(L_WARN, "WARNING: warning skipped -- too big\n");
1682 1682
 	}
1683 1683
 	/* content length hdr */
1684 1684
 	if (body) {
1685
-		content_len.s = int2str(body->text.len, &content_len.len);
1686
-		len += CONTENT_LENGTH_LEN + content_len.len + CRLF_LEN;
1685
+		content_len_buf = int2str(body->text.len, (int*)&content_len_len);
1686
+		len += CONTENT_LENGTH_LEN + content_len_len + CRLF_LEN;
1687 1687
 	} else {
1688 1688
 		len += CONTENT_LENGTH_LEN + 1/*0*/ + CRLF_LEN;
1689 1689
 	}
... ...
@@ -1720,13 +1726,13 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1720 1720
 		{
1721 1721
 			case HDR_VIA:
1722 1722
 				if (hdr==msg->h_via1){
1723
-					if (rport.s){
1723
+					if (rport_buf){
1724 1724
 						if (msg->via1->rport){ /* delete the old one */
1725 1725
 							/* copy until rport */
1726 1726
 							append_str_trans( p, hdr->name.s ,
1727 1727
 								msg->via1->rport->start-hdr->name.s-1,msg);
1728 1728
 							/* copy new rport */
1729
-							append_str(p, rport.s, rport.len);
1729
+							append_str(p, rport_buf, rport_len);
1730 1730
 							/* copy the rest of the via */
1731 1731
 							append_str_trans(p, msg->via1->rport->start+
1732 1732
 												msg->via1->rport->size, 
... ...
@@ -1737,15 +1743,15 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1737 1737
 							/* normal whole via copy */
1738 1738
 							append_str_trans( p, hdr->name.s , 
1739 1739
 								(hdr->body.s+hdr->body.len)-hdr->name.s, msg);
1740
-							append_str(p, rport.s, rport.len);
1740
+							append_str(p, rport_buf, rport_len);
1741 1741
 						}
1742 1742
 					}else{
1743 1743
 						/* normal whole via copy */
1744 1744
 						append_str_trans( p, hdr->name.s , 
1745 1745
 								(hdr->body.s+hdr->body.len)-hdr->name.s, msg);
1746 1746
 					}
1747
-					if (received.s)
1748
-						append_str( p, received.s, received.len);
1747
+					if (received_buf)
1748
+						append_str( p, received_buf, received_len);
1749 1749
 				}else{
1750 1750
 					/* normal whole via copy */
1751 1751
 					append_str_trans( p, hdr->name.s,
... ...
@@ -1808,17 +1814,17 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1808 1808
 		p+=CRLF_LEN;
1809 1809
 	}
1810 1810
 	/* content_length hdr */
1811
-	if (content_len.len) {
1811
+	if (content_len_len) {
1812 1812
 		append_str( p, CONTENT_LENGTH, CONTENT_LENGTH_LEN);
1813
-		append_str( p, content_len.s, content_len.len );
1813
+		append_str( p, content_len_buf, content_len_len );
1814 1814
 		append_str( p, CRLF, CRLF_LEN );
1815 1815
 	} else {
1816 1816
 		append_str( p, CONTENT_LENGTH"0"CRLF,CONTENT_LENGTH_LEN+1+CRLF_LEN);
1817 1817
 	}
1818 1818
 	/* warning header */
1819
-	if (warning.s) {
1820
-		memcpy( p, warning.s, warning.len);
1821
-		p+=warning.len;
1819
+	if (warning_buf) {
1820
+		memcpy( p, warning_buf, warning_len);
1821
+		p+=warning_len;
1822 1822
 		memcpy( p, CRLF, CRLF_LEN);
1823 1823
 		p+=CRLF_LEN;
1824 1824
 	}
... ...
@@ -1832,20 +1838,21 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1832 1832
 	}
1833 1833
 
1834 1834
 	if (len!=p-buf)
1835
-		LOG(L_CRIT,"BUGGGG!!!! diff len=%d p-buf=%d\n",len,p-buf);
1835
+		LOG(L_CRIT,"BUG:build_res_from_sip_req: diff len=%d p-buf=%d\n",
1836
+					len, (int)(p-buf));
1836 1837
 
1837 1838
 	*(p) = 0;
1838 1839
 	*returned_len = len;
1839 1840
 	/* in req2reply, received_buf is not introduced to lumps and
1840 1841
 	   needs to be deleted here
1841 1842
 	*/
1842
-	if (received.s) pkg_free(received.s);
1843
-	if (rport.s) pkg_free(rport.s);
1843
+	if (received_buf) pkg_free(received_buf);
1844
+	if (rport_buf) pkg_free(rport_buf);
1844 1845
 	return buf;
1845 1846
 
1846 1847
 error01:
1847
-	if (received.s) pkg_free(received.s);
1848
-	if (rport.s) pkg_free(rport.s);
1848
+	if (received_buf) pkg_free(received_buf);
1849
+	if (rport_buf) pkg_free(rport_buf);
1849 1850
 error00:
1850 1851
 	*returned_len=0;
1851 1852
 	return 0;
... ...
@@ -56,7 +56,7 @@ int recv_all(int socket, void* data, int data_len)
56 56
 	
57 57
 	b_read=0;
58 58
 	do{
59
-		n=recv(socket, data+b_read, data_len-b_read, MSG_WAITALL);
59
+		n=recv(socket, (char*)data+b_read, data_len-b_read, MSG_WAITALL);
60 60
 		if (n<0){
61 61
 			/* error */
62 62
 			if (errno==EINTR) continue; /* signal, try again */
... ...
@@ -63,7 +63,7 @@ struct subst_expr{
63 63
 
64 64
 struct replace_lst{
65 65
 	int offset;
66
-	int size;   /* at offset, delete size bytes and replace them with rpl */;
66
+	int size;   /* at offset, delete size bytes and replace them with rpl */
67 67
 	str rpl;
68 68
 	struct replace_lst *next;
69 69
 };
... ...
@@ -16,6 +16,7 @@
16 16
 check_via=no     # (cmd. line: -v)
17 17
 dns=no          # (cmd. line: -r)
18 18
 rev_dns=no      # (cmd. line: -R)
19
+mem_log=0
19 20
 #port=5070
20 21
 #listen=127.0.0.1
21 22
 #listen=195.37.77.101