Browse code

core: server signature value can be set via param

- server and user agent signature were only defines so far
- two new parameters server_header and user_agent_header allow
to define them via cfg parameters
- default values are the same so far

Daniel-Constantin Mierla authored on 20/08/2009 08:49:14
Showing 5 changed files
... ...
@@ -329,6 +329,8 @@ MEMLOG		"memlog"|"mem_log"
329 329
 MEMDBG		"memdbg"|"mem_dbg"
330 330
 SIP_WARNING sip_warning
331 331
 SERVER_SIGNATURE server_signature
332
+SERVER_HEADER server_header
333
+USER_AGENT_HEADER user_agent_header
332 334
 REPLY_TO_VIA reply_to_via
333 335
 USER		"user"|"uid"
334 336
 GROUP		"group"|"gid"
... ...
@@ -765,6 +767,8 @@ EAT_ABLE	[\ \t\b\r]
765 765
 <INITIAL>{SCTP_MAX_BURST}	{ count(); yylval.strval=yytext;
766 766
 										return SCTP_MAX_BURST; }
767 767
 <INITIAL>{SERVER_SIGNATURE}	{ count(); yylval.strval=yytext; return SERVER_SIGNATURE; }
768
+<INITIAL>{SERVER_HEADER}	{ count(); yylval.strval=yytext; return SERVER_HEADER; }
769
+<INITIAL>{USER_AGENT_HEADER}	{ count(); yylval.strval=yytext; return USER_AGENT_HEADER; }
768 770
 <INITIAL>{REPLY_TO_VIA}	{ count(); yylval.strval=yytext; return REPLY_TO_VIA; }
769 771
 <INITIAL>{ADVERTISED_ADDRESS}	{	count(); yylval.strval=yytext;
770 772
 									return ADVERTISED_ADDRESS; }
... ...
@@ -390,6 +390,8 @@ static int case_check_default(struct case_stms* stms);
390 390
 %token MEMDBG
391 391
 %token SIP_WARNING
392 392
 %token SERVER_SIGNATURE
393
+%token SERVER_HEADER
394
+%token USER_AGENT_HEADER
393 395
 %token REPLY_TO_VIA
394 396
 %token LOADMODULE
395 397
 %token LOADPATH
... ...
@@ -1362,6 +1364,14 @@ assign_stm:
1362 1362
 	| SCTP_MAX_BURST EQUAL error { yyerror("number expected"); }
1363 1363
 	| SERVER_SIGNATURE EQUAL NUMBER { server_signature=$3; }
1364 1364
 	| SERVER_SIGNATURE EQUAL error { yyerror("boolean value expected"); }
1365
+	| SERVER_HEADER EQUAL STRING { server_hdr.s=$3;
1366
+			server_hdr.len=strlen(server_hdr.s);
1367
+	}
1368
+	| SERVER_HEADER EQUAL error { yyerror("string value expected"); }
1369
+	| USER_AGENT_HEADER EQUAL STRING { user_agent_hdr.s=$3;
1370
+			user_agent_hdr.len=strlen(user_agent_hdr.s);
1371
+	}
1372
+	| USER_AGENT_HEADER EQUAL error { yyerror("string value expected"); }
1365 1373
 	| REPLY_TO_VIA EQUAL NUMBER { reply_to_via=$3; }
1366 1374
 	| REPLY_TO_VIA EQUAL error { yyerror("boolean value expected"); }
1367 1375
 	| LISTEN EQUAL id_lst {
... ...
@@ -108,6 +108,8 @@ extern int syn_branch;
108 108
 extern int child_rank;
109 109
 extern int sip_warning;
110 110
 extern int server_signature;
111
+extern str server_hdr;
112
+extern str user_agent_hdr;
111 113
 extern char* user;
112 114
 extern char* group;
113 115
 extern char* sock_user;
... ...
@@ -345,6 +345,8 @@ int sip_warning = 1;
345 345
    be default yes, good for trouble-shooting
346 346
 */
347 347
 int server_signature=1;
348
+str server_hdr = {SERVER_HDR, SERVER_HDR_LEN};
349
+str user_agent_hdr = {USER_AGENT, USER_AGENT_LEN};
348 350
 /* should ser try to locate outbound interface on multihomed
349 351
  * host? by default not -- too expensive
350 352
  */
... ...
@@ -1953,7 +1953,7 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1953 1953
 	}
1954 1954
 	/* server header */
1955 1955
 	if (server_signature)
1956
-		len += SERVER_HDR_LEN + CRLF_LEN;
1956
+		len += server_hdr.len + CRLF_LEN;
1957 1957
 	/* warning hdr */
1958 1958
 	if (sip_warning) {
1959 1959
 		warning_buf = warning_builder(msg,&warning_len);
... ...
@@ -2092,8 +2092,8 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
2092 2092
 		}
2093 2093
 	/* server header */
2094 2094
 	if (server_signature) {
2095
-		memcpy( p, SERVER_HDR , SERVER_HDR_LEN );
2096
-		p+=SERVER_HDR_LEN;
2095
+		memcpy( p, server_hdr.s, server_hdr.len );
2096
+		p+=server_hdr.len;
2097 2097
 		memcpy( p, CRLF, CRLF_LEN );
2098 2098
 		p+=CRLF_LEN;
2099 2099
 	}