* commit 'origin/ser_core_cvs':
core: config parser listen if names fix
core: config parser listen fix
core: interface names in socket list port fix
core: startup socket list fix
core: parse_headers flags fix
tm: fifo access From fix
cfg framework: fix the group handles in the main process
Conflicts:
cfg.lex
cfg.y
... | ... |
@@ -124,6 +124,7 @@ |
124 | 124 |
int startline=1; |
125 | 125 |
static int ign_lines=0; |
126 | 126 |
static int ign_columns=0; |
127 |
+ char* yy_number_str=0; /* str correspondent for the current NUMBER token */ |
|
127 | 128 |
|
128 | 129 |
static char* addchar(struct str_buf *, char); |
129 | 130 |
static char* addstr(struct str_buf *, char*, int); |
... | ... |
@@ -445,6 +446,7 @@ LETTER [a-zA-Z] |
445 | 445 |
DIGIT [0-9] |
446 | 446 |
ALPHANUM {LETTER}|{DIGIT}|[_] |
447 | 447 |
ID {LETTER}{ALPHANUM}* |
448 |
+NUM_ID {ALPHANUM}+ |
|
448 | 449 |
HEX [0-9a-fA-F] |
449 | 450 |
HEXNUMBER 0x{HEX}+ |
450 | 451 |
OCTNUMBER 0[0-7]+ |
... | ... |
@@ -846,10 +848,14 @@ EAT_ABLE [\ \t\b\r] |
846 | 846 |
<SELECT>{DOT} { count(); return DOT; } |
847 | 847 |
<SELECT>{LBRACK} { count(); return LBRACK; } |
848 | 848 |
<SELECT>{RBRACK} { count(); return RBRACK; } |
849 |
-<SELECT>{DECNUMBER} { count(); yylval.intval=atoi(yytext);return NUMBER; } |
|
850 |
-<SELECT>{HEXNUMBER} { count(); yylval.intval=(int)strtol(yytext, 0, 16); return NUMBER; } |
|
851 |
-<SELECT>{OCTNUMBER} { count(); yylval.intval=(int)strtol(yytext, 0, 8); return NUMBER; } |
|
852 |
-<SELECT>{BINNUMBER} { count(); yylval.intval=(int)strtol(yytext, 0, 2); return NUMBER; } |
|
849 |
+<SELECT>{DECNUMBER} { count(); yylval.intval=atoi(yytext); |
|
850 |
+ yy_number_str=yytext; return NUMBER; } |
|
851 |
+<SELECT>{HEXNUMBER} { count(); yylval.intval=(int)strtol(yytext, 0, 16); |
|
852 |
+ yy_number_str=yytext; return NUMBER; } |
|
853 |
+<SELECT>{OCTNUMBER} { count(); yylval.intval=(int)strtol(yytext, 0, 8); |
|
854 |
+ yy_number_str=yytext; return NUMBER; } |
|
855 |
+<SELECT>{BINNUMBER} { count(); yylval.intval=(int)strtol(yytext, 0, 2); |
|
856 |
+ yy_number_str=yytext; return NUMBER; } |
|
853 | 857 |
|
854 | 858 |
|
855 | 859 |
<INITIAL>{ATTR_MARK} { count(); state = ATTR_S; BEGIN(ATTR); |
... | ... |
@@ -867,7 +873,8 @@ EAT_ABLE [\ \t\b\r] |
867 | 867 |
<ATTR>{LBRACK} { count(); return LBRACK; } |
868 | 868 |
<ATTR>{RBRACK} { count(); return RBRACK; } |
869 | 869 |
<ATTR>{STAR} { count(); return STAR; } |
870 |
-<ATTR>{DECNUMBER} { count(); yylval.intval=atoi(yytext);return NUMBER; } |
|
870 |
+<ATTR>{DECNUMBER} { count(); yylval.intval=atoi(yytext); |
|
871 |
+ yy_number_str=yytext; return NUMBER; } |
|
871 | 872 |
<ATTR>{ID} { count(); addstr(&s_buf, yytext, yyleng); |
872 | 873 |
yylval.strval=s_buf.s; |
873 | 874 |
memset(&s_buf, 0, sizeof(s_buf)); |
... | ... |
@@ -950,26 +957,32 @@ EAT_ABLE [\ \t\b\r] |
950 | 950 |
} |
951 | 951 |
|
952 | 952 |
<INITIAL>{IPV6ADDR} { count(); yylval.strval=yytext; return IPV6ADDR; } |
953 |
-<INITIAL>{DECNUMBER} { count(); yylval.intval=atoi(yytext);return NUMBER; } |
|
953 |
+<INITIAL>{DECNUMBER} { count(); yylval.intval=atoi(yytext); |
|
954 |
+ yy_number_str=yytext; return NUMBER; } |
|
954 | 955 |
<INITIAL>{HEXNUMBER} { count(); yylval.intval=(int)strtol(yytext, 0, 16); |
955 |
- return NUMBER; } |
|
956 |
+ yy_number_str=yytext; return NUMBER; } |
|
956 | 957 |
<INITIAL>{OCTNUMBER} { count(); yylval.intval=(int)strtol(yytext, 0, 8); |
957 |
- return NUMBER; } |
|
958 |
-<INITIAL>{BINNUMBER} { count(); yylval.intval=(int)strtol(yytext, 0, 2); return NUMBER; } |
|
959 |
-<INITIAL>{YES} { count(); yylval.intval=1; return NUMBER; } |
|
960 |
-<INITIAL>{NO} { count(); yylval.intval=0; return NUMBER; } |
|
958 |
+ yy_number_str=yytext; return NUMBER; } |
|
959 |
+<INITIAL>{BINNUMBER} { count(); yylval.intval=(int)strtol(yytext, 0, 2); |
|
960 |
+ yy_number_str=yytext; return NUMBER; } |
|
961 |
+<INITIAL>{YES} { count(); yylval.intval=1; |
|
962 |
+ yy_number_str=yytext; return NUMBER; } |
|
963 |
+<INITIAL>{NO} { count(); yylval.intval=0; |
|
964 |
+ yy_number_str=yytext; return NUMBER; } |
|
961 | 965 |
<INITIAL>{TCP} { count(); return TCP; } |
962 | 966 |
<INITIAL>{UDP} { count(); return UDP; } |
963 | 967 |
<INITIAL>{TLS} { count(); return TLS; } |
964 | 968 |
<INITIAL>{SCTP} { count(); return SCTP; } |
965 |
-<INITIAL>{INET} { count(); yylval.intval=AF_INET; return NUMBER; } |
|
969 |
+<INITIAL>{INET} { count(); yylval.intval=AF_INET; |
|
970 |
+ yy_number_str=yytext; return NUMBER; } |
|
966 | 971 |
<INITIAL>{INET6} { count(); |
967 | 972 |
#ifdef USE_IPV6 |
968 | 973 |
yylval.intval=AF_INET6; |
969 | 974 |
#else |
970 | 975 |
yylval.intval=-1; /* no match*/ |
971 | 976 |
#endif |
972 |
- return NUMBER; } |
|
977 |
+ yy_number_str=yytext; |
|
978 |
+ return NUMBER; } |
|
973 | 979 |
<INITIAL>{SSLv23} { count(); yylval.strval=yytext; return SSLv23; } |
974 | 980 |
<INITIAL>{SSLv2} { count(); yylval.strval=yytext; return SSLv2; } |
975 | 981 |
<INITIAL>{SSLv3} { count(); yylval.strval=yytext; return SSLv3; } |
... | ... |
@@ -1068,6 +1081,10 @@ EAT_ABLE [\ \t\b\r] |
1068 | 1068 |
yylval.strval=s_buf.s; |
1069 | 1069 |
memset(&s_buf, 0, sizeof(s_buf)); |
1070 | 1070 |
return ID; } |
1071 |
+<INITIAL>{NUM_ID} { count(); addstr(&s_buf, yytext, yyleng); |
|
1072 |
+ yylval.strval=s_buf.s; |
|
1073 |
+ memset(&s_buf, 0, sizeof(s_buf)); |
|
1074 |
+ return NUM_ID; } |
|
1071 | 1075 |
|
1072 | 1076 |
<SELECT>. { unput(yytext[0]); state = INITIAL_S; BEGIN(INITIAL); } /* Rescan the token in INITIAL state */ |
1073 | 1077 |
|
... | ... |
@@ -193,6 +193,9 @@ |
193 | 193 |
|
194 | 194 |
|
195 | 195 |
extern int yylex(); |
196 |
+/* safer then using yytext which can be array or pointer */ |
|
197 |
+extern char* yy_number_str; |
|
198 |
+ |
|
196 | 199 |
static void yyerror(char* s, ...); |
197 | 200 |
static void yyerror_at(struct cfg_pos* pos, char* s, ...); |
198 | 201 |
static char* tmp; |
... | ... |
@@ -526,6 +529,7 @@ static int case_check_default(struct case_stms* stms); |
526 | 526 |
/* values */ |
527 | 527 |
%token <intval> NUMBER |
528 | 528 |
%token <strval> ID |
529 |
+%token <strval> NUM_ID |
|
529 | 530 |
%token <strval> STRING |
530 | 531 |
%token <strval> IPV6ADDR |
531 | 532 |
%token <strval> PVAR |
... | ... |
@@ -556,7 +560,7 @@ static int case_check_default(struct case_stms* stms); |
556 | 556 |
%type <case_stms> single_case case_stms |
557 | 557 |
%type <ipaddr> ipv4 ipv6 ipv6addr ip |
558 | 558 |
%type <ipnet> ipnet |
559 |
-%type <strval> host |
|
559 |
+%type <strval> host host_or_if host_if_id |
|
560 | 560 |
%type <strval> listen_id |
561 | 561 |
%type <name_l> listen_id_lst |
562 | 562 |
%type <name_l> listen_id2 |
... | ... |
@@ -618,18 +622,20 @@ statement: |
618 | 618 |
; |
619 | 619 |
listen_id: |
620 | 620 |
ip { |
621 |
- tmp=ip_addr2a($1); |
|
622 |
- if (tmp==0) { |
|
623 |
- LOG(L_CRIT, "ERROR: cfg. parser: bad ip " |
|
624 |
- "address.\n"); |
|
625 |
- $$=0; |
|
626 |
- } else { |
|
627 |
- $$=pkg_malloc(strlen(tmp)+1); |
|
628 |
- if ($$==0) { |
|
629 |
- LOG(L_CRIT, "ERROR: cfg. parser: out of " |
|
630 |
- "memory.\n"); |
|
621 |
+ if ($1){ |
|
622 |
+ tmp=ip_addr2a($1); |
|
623 |
+ if (tmp==0) { |
|
624 |
+ LOG(L_CRIT, "ERROR: cfg. parser: bad ip " |
|
625 |
+ "address.\n"); |
|
626 |
+ $$=0; |
|
631 | 627 |
} else { |
632 |
- strncpy($$, tmp, strlen(tmp)+1); |
|
628 |
+ $$=pkg_malloc(strlen(tmp)+1); |
|
629 |
+ if ($$==0) { |
|
630 |
+ LOG(L_CRIT, "ERROR: cfg. parser: out of " |
|
631 |
+ "memory.\n"); |
|
632 |
+ } else { |
|
633 |
+ strncpy($$, tmp, strlen(tmp)+1); |
|
634 |
+ } |
|
633 | 635 |
} |
634 | 636 |
} |
635 | 637 |
} |
... | ... |
@@ -642,13 +648,15 @@ listen_id: |
642 | 642 |
strncpy($$, $1, strlen($1)+1); |
643 | 643 |
} |
644 | 644 |
} |
645 |
- | host { |
|
646 |
- $$=pkg_malloc(strlen($1)+1); |
|
647 |
- if ($$==0) { |
|
648 |
- LOG(L_CRIT, "ERROR: cfg. parser: out of " |
|
649 |
- "memory.\n"); |
|
650 |
- } else { |
|
651 |
- strncpy($$, $1, strlen($1)+1); |
|
645 |
+ | host_or_if { |
|
646 |
+ if ($1){ |
|
647 |
+ $$=pkg_malloc(strlen($1)+1); |
|
648 |
+ if ($$==0) { |
|
649 |
+ LOG(L_CRIT, "ERROR: cfg. parser: out of " |
|
650 |
+ "memory.\n"); |
|
651 |
+ } else { |
|
652 |
+ strncpy($$, $1, strlen($1)+1); |
|
653 |
+ } |
|
652 | 654 |
} |
653 | 655 |
} |
654 | 656 |
; |
... | ... |
@@ -695,7 +703,7 @@ listen_phostport: |
695 | 695 |
|
696 | 696 |
id_lst: |
697 | 697 |
listen_phostport { $$=$1 ; } |
698 |
- | listen_phostport id_lst { $$=$1; $$->next=$2; } |
|
698 |
+ | listen_phostport id_lst { $$=$1; if ($$) $$->next=$2; } |
|
699 | 699 |
; |
700 | 700 |
|
701 | 701 |
intno: NUMBER |
... | ... |
@@ -1366,7 +1374,8 @@ assign_stm: |
1366 | 1366 |
} |
1367 | 1367 |
free_socket_id_lst($3); |
1368 | 1368 |
} |
1369 |
- | LISTEN EQUAL error { yyerror("ip address or hostname expected"); } |
|
1369 |
+ | LISTEN EQUAL error { yyerror("ip address, interface name or" |
|
1370 |
+ " hostname expected"); } |
|
1370 | 1371 |
| ALIAS EQUAL id_lst { |
1371 | 1372 |
for(lst_tmp=$3; lst_tmp; lst_tmp=lst_tmp->next){ |
1372 | 1373 |
add_alias( lst_tmp->addr_lst->name, |
... | ... |
@@ -1382,8 +1391,10 @@ assign_stm: |
1382 | 1382 |
| SR_AUTO_ALIASES EQUAL NUMBER { sr_auto_aliases=$3; } |
1383 | 1383 |
| SR_AUTO_ALIASES EQUAL error { yyerror("boolean value expected"); } |
1384 | 1384 |
| ADVERTISED_ADDRESS EQUAL listen_id { |
1385 |
- default_global_address.s=$3; |
|
1386 |
- default_global_address.len=strlen($3); |
|
1385 |
+ if ($3){ |
|
1386 |
+ default_global_address.s=$3; |
|
1387 |
+ default_global_address.len=strlen($3); |
|
1388 |
+ } |
|
1387 | 1389 |
} |
1388 | 1390 |
| ADVERTISED_ADDRESS EQUAL error {yyerror("ip address or hostname expected"); } |
1389 | 1391 |
| ADVERTISED_PORT EQUAL NUMBER { |
... | ... |
@@ -1908,33 +1919,83 @@ ipnet: |
1908 | 1908 |
host: |
1909 | 1909 |
ID { $$=$1; } |
1910 | 1910 |
| host DOT ID { |
1911 |
- $$=(char*)pkg_malloc(strlen($1)+1+strlen($3)+1); |
|
1912 |
- if ($$==0) { |
|
1913 |
- LOG(L_CRIT, "ERROR: cfg. parser: memory allocation failure while parsing host\n"); |
|
1914 |
- } else { |
|
1915 |
- memcpy($$, $1, strlen($1)); |
|
1916 |
- $$[strlen($1)]='.'; |
|
1917 |
- memcpy($$+strlen($1)+1, $3, strlen($3)); |
|
1918 |
- $$[strlen($1)+1+strlen($3)]=0; |
|
1911 |
+ if ($1){ |
|
1912 |
+ $$=(char*)pkg_malloc(strlen($1)+1+strlen($3)+1); |
|
1913 |
+ if ($$==0) { |
|
1914 |
+ LOG(L_CRIT, "ERROR: cfg. parser: memory allocation" |
|
1915 |
+ " failure while parsing host\n"); |
|
1916 |
+ } else { |
|
1917 |
+ memcpy($$, $1, strlen($1)); |
|
1918 |
+ $$[strlen($1)]='.'; |
|
1919 |
+ memcpy($$+strlen($1)+1, $3, strlen($3)); |
|
1920 |
+ $$[strlen($1)+1+strlen($3)]=0; |
|
1921 |
+ } |
|
1922 |
+ pkg_free($1); |
|
1919 | 1923 |
} |
1920 |
- pkg_free($1); |
|
1921 |
- pkg_free($3); |
|
1922 | 1924 |
} |
1923 | 1925 |
| host MINUS ID { |
1924 |
- $$=(char*)pkg_malloc(strlen($1)+1+strlen($3)+1); |
|
1925 |
- if ($$==0) { |
|
1926 |
- LOG(L_CRIT, "ERROR: cfg. parser: memory allocation failure while parsing host\n"); |
|
1927 |
- } else { |
|
1928 |
- memcpy($$, $1, strlen($1)); |
|
1929 |
- $$[strlen($1)]='-'; |
|
1930 |
- memcpy($$+strlen($1)+1, $3, strlen($3)); |
|
1931 |
- $$[strlen($1)+1+strlen($3)]=0; |
|
1926 |
+ if ($1){ |
|
1927 |
+ $$=(char*)pkg_malloc(strlen($1)+1+strlen($3)+1); |
|
1928 |
+ if ($$==0) { |
|
1929 |
+ LOG(L_CRIT, "ERROR: cfg. parser: memory allocation" |
|
1930 |
+ " failure while parsing host\n"); |
|
1931 |
+ } else { |
|
1932 |
+ memcpy($$, $1, strlen($1)); |
|
1933 |
+ $$[strlen($1)]='-'; |
|
1934 |
+ memcpy($$+strlen($1)+1, $3, strlen($3)); |
|
1935 |
+ $$[strlen($1)+1+strlen($3)]=0; |
|
1936 |
+ } |
|
1937 |
+ pkg_free($1); |
|
1932 | 1938 |
} |
1933 |
- pkg_free($1); |
|
1934 |
- pkg_free($3); |
|
1935 | 1939 |
} |
1936 | 1940 |
| host DOT error { $$=0; pkg_free($1); yyerror("invalid hostname"); } |
1941 |
+ | host MINUS error { $$=0; pkg_free($1); yyerror("invalid hostname"); } |
|
1942 |
+ ; |
|
1943 |
+ |
|
1944 |
+host_if_id: ID |
|
1945 |
+ | NUM_ID |
|
1946 |
+ | NUMBER { $$=yy_number_str /* text version */; } |
|
1947 |
+ ; |
|
1948 |
+ |
|
1949 |
+host_or_if: |
|
1950 |
+ host_if_id { $$=$1; } |
|
1951 |
+ | host_or_if DOT host_if_id { |
|
1952 |
+ if ($1){ |
|
1953 |
+ $$=(char*)pkg_malloc(strlen($1)+1+strlen($3)+1); |
|
1954 |
+ if ($$==0) { |
|
1955 |
+ LOG(L_CRIT, "ERROR: cfg. parser: memory allocation" |
|
1956 |
+ " failure while parsing host/interface name\n"); |
|
1957 |
+ } else { |
|
1958 |
+ memcpy($$, $1, strlen($1)); |
|
1959 |
+ $$[strlen($1)]='.'; |
|
1960 |
+ memcpy($$+strlen($1)+1, $3, strlen($3)); |
|
1961 |
+ $$[strlen($1)+1+strlen($3)]=0; |
|
1962 |
+ } |
|
1963 |
+ pkg_free($1); |
|
1964 |
+ } |
|
1965 |
+ } |
|
1966 |
+ | host_or_if MINUS host_if_id { |
|
1967 |
+ if ($1){ |
|
1968 |
+ $$=(char*)pkg_malloc(strlen($1)+1+strlen($3)+1); |
|
1969 |
+ if ($$==0) { |
|
1970 |
+ LOG(L_CRIT, "ERROR: cfg. parser: memory allocation" |
|
1971 |
+ " failure while parsing host/interface name\n"); |
|
1972 |
+ } else { |
|
1973 |
+ memcpy($$, $1, strlen($1)); |
|
1974 |
+ $$[strlen($1)]='-'; |
|
1975 |
+ memcpy($$+strlen($1)+1, $3, strlen($3)); |
|
1976 |
+ $$[strlen($1)+1+strlen($3)]=0; |
|
1977 |
+ } |
|
1978 |
+ pkg_free($1); |
|
1979 |
+ } |
|
1980 |
+ } |
|
1981 |
+ | host_or_if DOT error { $$=0; pkg_free($1); |
|
1982 |
+ yyerror("invalid host or interface name"); } |
|
1983 |
+ | host_or_if MINUS error { $$=0; pkg_free($1); |
|
1984 |
+ yyerror("invalid host or interface name"); } |
|
1937 | 1985 |
; |
1986 |
+ |
|
1987 |
+ |
|
1938 | 1988 |
/* filtered cmd */ |
1939 | 1989 |
fcmd: |
1940 | 1990 |
cmd { |
... | ... |
@@ -2834,7 +2895,7 @@ cmd: |
2834 | 2834 |
LOG(L_CRIT, "ERROR: cfg. parser: out of memory.\n"); |
2835 | 2835 |
} else { |
2836 | 2836 |
str_tmp->s=$3; |
2837 |
- str_tmp->len=strlen($3); |
|
2837 |
+ str_tmp->len=$3?strlen($3):0; |
|
2838 | 2838 |
$$=mk_action(SET_ADV_ADDR_T, 1, STR_ST, str_tmp); |
2839 | 2839 |
} |
2840 | 2840 |
} |
... | ... |
@@ -3194,6 +3255,7 @@ static int warn_ct_rve(struct rval_expr *rve, char* name) |
3194 | 3194 |
static struct name_lst* mk_name_lst(char* host, int flags) |
3195 | 3195 |
{ |
3196 | 3196 |
struct name_lst* l; |
3197 |
+ if (host==0) return 0; |
|
3197 | 3198 |
l=pkg_malloc(sizeof(struct name_lst)); |
3198 | 3199 |
if (l==0) { |
3199 | 3200 |
LOG(L_CRIT,"ERROR: cfg. parser: out of memory.\n"); |
... | ... |
@@ -3209,6 +3271,7 @@ static struct name_lst* mk_name_lst(char* host, int flags) |
3209 | 3209 |
static struct socket_id* mk_listen_id(char* host, int proto, int port) |
3210 | 3210 |
{ |
3211 | 3211 |
struct socket_id* l; |
3212 |
+ if (host==0) return 0; |
|
3212 | 3213 |
l=pkg_malloc(sizeof(struct socket_id)); |
3213 | 3214 |
if (l==0) { |
3214 | 3215 |
LOG(L_CRIT,"ERROR: cfg. parser: out of memory.\n"); |
... | ... |
@@ -3243,6 +3306,7 @@ static struct socket_id* mk_listen_id2(struct name_lst* addr_l, int proto, |
3243 | 3243 |
int port) |
3244 | 3244 |
{ |
3245 | 3245 |
struct socket_id* l; |
3246 |
+ if (addr_l==0) return 0; |
|
3246 | 3247 |
l=pkg_malloc(sizeof(struct socket_id)); |
3247 | 3248 |
if (l==0) { |
3248 | 3249 |
LOG(L_CRIT,"ERROR: cfg. parser: out of memory.\n"); |
... | ... |
@@ -690,7 +690,7 @@ static int assemble_msg(struct sip_msg* msg, struct tw_info *twi) |
690 | 690 |
} |
691 | 691 |
|
692 | 692 |
/* parse from header */ |
693 |
- if (msg->from->parsed==0 && parse_from_header(msg)==-1 ) { |
|
693 |
+ if (msg->from==0 || (msg->from->parsed==0 && parse_from_header(msg)==-1)) { |
|
694 | 694 |
LOG(L_ERR,"assemble_msg: while parsing <From:> header\n"); |
695 | 695 |
goto error; |
696 | 696 |
} |
... | ... |
@@ -309,13 +309,15 @@ int parse_headers(struct sip_msg* msg, hdr_flags_t flags, int next) |
309 | 309 |
end=msg->buf+msg->len; |
310 | 310 |
tmp=msg->unparsed; |
311 | 311 |
|
312 |
- if (next) { |
|
312 |
+ if (unlikely(next)) { |
|
313 | 313 |
orig_flag = msg->parsed_flag; |
314 | 314 |
msg->parsed_flag &= ~flags; |
315 | 315 |
}else |
316 | 316 |
orig_flag=0; |
317 | 317 |
|
318 |
+#ifdef EXTRA_DEBUG |
|
318 | 319 |
DBG("parse_headers: flags=%llx\n", (unsigned long long)flags); |
320 |
+#endif |
|
319 | 321 |
while( tmp<end && (flags & msg->parsed_flag) != flags){ |
320 | 322 |
prefetch_loc_r(tmp+64, 1); |
321 | 323 |
hf=pkg_malloc(sizeof(struct hdr_field)); |
... | ... |
@@ -549,12 +551,15 @@ int parse_headers(struct sip_msg* msg, hdr_flags_t flags, int next) |
549 | 549 |
} |
550 | 550 |
skip: |
551 | 551 |
msg->unparsed=tmp; |
552 |
+ /* restore original flags */ |
|
553 |
+ msg->parsed_flag |= orig_flag; |
|
552 | 554 |
return 0; |
553 | 555 |
|
554 | 556 |
error: |
555 | 557 |
ser_error=E_BAD_REQ; |
556 | 558 |
if (hf) pkg_free(hf); |
557 |
- if (next) msg->parsed_flag |= orig_flag; |
|
559 |
+ /* restore original flags */ |
|
560 |
+ msg->parsed_flag |= orig_flag; |
|
558 | 561 |
return -1; |
559 | 562 |
} |
560 | 563 |
|
... | ... |
@@ -939,7 +939,7 @@ static int addr_info_to_si_lst(struct addr_info* ai_lst, unsigned short port, |
939 | 939 |
struct addr_info* ail; |
940 | 940 |
|
941 | 941 |
for (ail=ai_lst; ail; ail=ail->next){ |
942 |
- if(new_sock2list(ail->name.s, 0, port_no, proto, ail->flags | flags, |
|
942 |
+ if(new_sock2list(ail->name.s, 0, port, proto, ail->flags | flags, |
|
943 | 943 |
list)==0) |
944 | 944 |
return -1; |
945 | 945 |
} |
... | ... |
@@ -961,7 +961,7 @@ static int addr_info_to_si_lst_after(struct addr_info* ai_lst, |
961 | 961 |
struct socket_info* new_si; |
962 | 962 |
|
963 | 963 |
for (ail=ai_lst; ail; ail=ail->next){ |
964 |
- if((new_si=new_sock2list_after(ail->name.s, 0, port_no, proto, |
|
964 |
+ if((new_si=new_sock2list_after(ail->name.s, 0, port, proto, |
|
965 | 965 |
ail->flags | flags, el))==0) |
966 | 966 |
return -1; |
967 | 967 |
el=new_si; |
... | ... |
@@ -1148,7 +1148,9 @@ static int fix_socket_list(struct socket_info **list, int* type_flags) |
1148 | 1148 |
) |
1149 | 1149 |
add_alias(del_si->name.s, del_si->name.len, |
1150 | 1150 |
l->port_no, l->proto); |
1151 |
- |
|
1151 |
+ /* make sure next_si doesn't point to del_si */ |
|
1152 |
+ if (del_si==next_si) |
|
1153 |
+ next_si=next_si->next; |
|
1152 | 1154 |
/* remove del_si*/ |
1153 | 1155 |
sock_listrm(list, del_si); |
1154 | 1156 |
free_sock_info(del_si); |