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 1116
 															$3,
1116 1117
 															0);
1117 1118
 										#else
1119
+											$$=0;
1118 1120
 											yyerror("tls support not "
1119 1121
 													"compiled in");
1120 1122
 										#endif
... ...
@@ -1127,6 +1129,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
1127 1129
 															(void*)$3,
1128 1130
 															0);
1129 1131
 										#else
1132
+											$$=0;
1130 1133
 											yyerror("tls support not "
1131 1134
 													"compiled in");
1132 1135
 										#endif
... ...
@@ -1139,6 +1142,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
1139 1142
 															$3,
1140 1143
 															(void*)$5);
1141 1144
 										#else
1145
+											$$=0;
1142 1146
 											yyerror("tls support not "
1143 1147
 													"compiled in");
1144 1148
 										#endif
... ...
@@ -1151,6 +1155,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
1151 1155
 															$3,
1152 1156
 															(void*)$5);
1153 1157
 										#else
1158
+											$$=0;
1154 1159
 											yyerror("tls support not "
1155 1160
 													"compiled in");
1156 1161
 										#endif
... ...
@@ -1163,6 +1168,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
1163 1168
 															 (void*)$3,
1164 1169
 															(void*)$5);
1165 1170
 										#else
1171
+											$$=0;
1166 1172
 											yyerror("tls support not "
1167 1173
 													"compiled in");
1168 1174
 										#endif
... ...
@@ -1175,6 +1181,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
1175 1181
 															0,
1176 1182
 															0);
1177 1183
 										#else
1184
+											$$=0;
1178 1185
 											yyerror("tls support not "
1179 1186
 													"compiled in");
1180 1187
 										#endif
... ...
@@ -1189,6 +1196,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
1189 1196
 															0,
1190 1197
 															(void*)$5);
1191 1198
 										#else
1199
+											$$=0;
1192 1200
 											yyerror("tls support not "
1193 1201
 													"compiled in");
1194 1202
 										#endif
... ...
@@ -1201,6 +1209,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
1201 1209
 															0,
1202 1210
 															0);
1203 1211
 										#else
1212
+											$$=0;
1204 1213
 											yyerror("tls support not "
1205 1214
 													"compiled in");
1206 1215
 										#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 1601
 
1598 1602
 	body = 0;
1599 1603
 	buf=0;
1600
-
1604
+	received_buf=rport_buf=warning_buf=content_len_buf=0;
1605
+	received_len=rport_len=warning_len=content_len_len=0;
1606
+	
1601 1607
 	text_len=strlen(text);
1602
-
1608
+	
1603 1609
 	/* force parsing all headers -- we want to return all
1604 1610
 	Via's in the reply and they may be scattered down to the
1605 1611
 	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 1621
 
1616 1622
 	/* check if received needs to be added */
1617 1623
 	if (received_test(msg)) {
1618
-		if ((received.s=received_builder(msg,&received.len))==0) {
1624
+		if ((received_buf=received_builder(msg,&received_len))==0) {
1619 1625
 			LOG(L_ERR, "ERROR: build_res_buf_from_sip_req: "
1620 1626
 				"alas, received_builder failed\n");
1621 1627
 			goto error00;
... ...
@@ -1624,7 +1630,7 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1624 1630
 	/* check if rport needs to be updated */
1625 1631
 	if ( (msg->msg_flags&FL_FORCE_RPORT)||
1626 1632
 		(msg->via1->rport /*&& msg->via1->rport->value.s==0*/)){
1627
-		if ((rport.s=rport_builder(msg, &rport.len))==0){
1633
+		if ((rport_buf=rport_builder(msg, &rport_len))==0){
1628 1634
 			LOG(L_ERR, "ERROR: build_res_buf_from_sip_req:"
1629 1635
 							" rport_builder failed\n");
1630 1636
 			goto error01; /* free everything */
... ...
@@ -1652,7 +1658,7 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1652 1658
 			case HDR_VIA:
1653 1659
 				/* we always add CRLF to via*/
1654 1660
 				len+=(hdr->body.s+hdr->body.len)-hdr->name.s+CRLF_LEN;
1655
-				if (hdr==msg->h_via1) len += received.len+rport.len;
1661
+				if (hdr==msg->h_via1) len += received_len+rport_len;
1656 1662
 				break;
1657 1663
 			case HDR_RECORDROUTE:
1658 1664
 				/* 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 1682
 		len += SERVER_HDR_LEN + CRLF_LEN;
1677 1683
 	/* warning hdr */
1678 1684
 	if (sip_warning) {
1679
-		warning.s = warning_builder(msg,&warning.len);
1680
-		if (warning.s) len += warning.len + CRLF_LEN;
1685
+		warning_buf = warning_builder(msg,&warning_len);
1686
+		if (warning_buf) len += warning_len + CRLF_LEN;
1681 1687
 		else LOG(L_WARN, "WARNING: warning skipped -- too big\n");
1682 1688
 	}
1683 1689
 	/* content length hdr */
1684 1690
 	if (body) {
1685
-		content_len.s = int2str(body->text.len, &content_len.len);
1686
-		len += CONTENT_LENGTH_LEN + content_len.len + CRLF_LEN;
1691
+		content_len_buf = int2str(body->text.len, (int*)&content_len_len);
1692
+		len += CONTENT_LENGTH_LEN + content_len_len + CRLF_LEN;
1687 1693
 	} else {
1688 1694
 		len += CONTENT_LENGTH_LEN + 1/*0*/ + CRLF_LEN;
1689 1695
 	}
... ...
@@ -1720,13 +1726,13 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1720 1726
 		{
1721 1727
 			case HDR_VIA:
1722 1728
 				if (hdr==msg->h_via1){
1723
-					if (rport.s){
1729
+					if (rport_buf){
1724 1730
 						if (msg->via1->rport){ /* delete the old one */
1725 1731
 							/* copy until rport */
1726 1732
 							append_str_trans( p, hdr->name.s ,
1727 1733
 								msg->via1->rport->start-hdr->name.s-1,msg);
1728 1734
 							/* copy new rport */
1729
-							append_str(p, rport.s, rport.len);
1735
+							append_str(p, rport_buf, rport_len);
1730 1736
 							/* copy the rest of the via */
1731 1737
 							append_str_trans(p, msg->via1->rport->start+
1732 1738
 												msg->via1->rport->size, 
... ...
@@ -1737,15 +1743,15 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1737 1743
 							/* normal whole via copy */
1738 1744
 							append_str_trans( p, hdr->name.s , 
1739 1745
 								(hdr->body.s+hdr->body.len)-hdr->name.s, msg);
1740
-							append_str(p, rport.s, rport.len);
1746
+							append_str(p, rport_buf, rport_len);
1741 1747
 						}
1742 1748
 					}else{
1743 1749
 						/* normal whole via copy */
1744 1750
 						append_str_trans( p, hdr->name.s , 
1745 1751
 								(hdr->body.s+hdr->body.len)-hdr->name.s, msg);
1746 1752
 					}
1747
-					if (received.s)
1748
-						append_str( p, received.s, received.len);
1753
+					if (received_buf)
1754
+						append_str( p, received_buf, received_len);
1749 1755
 				}else{
1750 1756
 					/* normal whole via copy */
1751 1757
 					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 1814
 		p+=CRLF_LEN;
1809 1815
 	}
1810 1816
 	/* content_length hdr */
1811
-	if (content_len.len) {
1817
+	if (content_len_len) {
1812 1818
 		append_str( p, CONTENT_LENGTH, CONTENT_LENGTH_LEN);
1813
-		append_str( p, content_len.s, content_len.len );
1819
+		append_str( p, content_len_buf, content_len_len );
1814 1820
 		append_str( p, CRLF, CRLF_LEN );
1815 1821
 	} else {
1816 1822
 		append_str( p, CONTENT_LENGTH"0"CRLF,CONTENT_LENGTH_LEN+1+CRLF_LEN);
1817 1823
 	}
1818 1824
 	/* warning header */
1819
-	if (warning.s) {
1820
-		memcpy( p, warning.s, warning.len);
1821
-		p+=warning.len;
1825
+	if (warning_buf) {
1826
+		memcpy( p, warning_buf, warning_len);
1827
+		p+=warning_len;
1822 1828
 		memcpy( p, CRLF, CRLF_LEN);
1823 1829
 		p+=CRLF_LEN;
1824 1830
 	}
... ...
@@ -1832,20 +1838,21 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1832 1838
 	}
1833 1839
 
1834 1840
 	if (len!=p-buf)
1835
-		LOG(L_CRIT,"BUGGGG!!!! diff len=%d p-buf=%d\n",len,p-buf);
1841
+		LOG(L_CRIT,"BUG:build_res_from_sip_req: diff len=%d p-buf=%d\n",
1842
+					len, (int)(p-buf));
1836 1843
 
1837 1844
 	*(p) = 0;
1838 1845
 	*returned_len = len;
1839 1846
 	/* in req2reply, received_buf is not introduced to lumps and
1840 1847
 	   needs to be deleted here
1841 1848
 	*/
1842
-	if (received.s) pkg_free(received.s);
1843
-	if (rport.s) pkg_free(rport.s);
1849
+	if (received_buf) pkg_free(received_buf);
1850
+	if (rport_buf) pkg_free(rport_buf);
1844 1851
 	return buf;
1845 1852
 
1846 1853
 error01:
1847
-	if (received.s) pkg_free(received.s);
1848
-	if (rport.s) pkg_free(rport.s);
1854
+	if (received_buf) pkg_free(received_buf);
1855
+	if (rport_buf) pkg_free(rport_buf);
1849 1856
 error00:
1850 1857
 	*returned_len=0;
1851 1858
 	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