Forráskód Böngészése

- added tls config parameters support

Andrei Pelinescu-Onciul 22 éve
szülő
commit
46506980e0
3 módosított fájl, 86 hozzáadás és 0 törlés
  1. 18 0
      cfg.lex
  2. 63 0
      cfg.y
  3. 5 0
      globals.h

+ 18 - 0
cfg.lex

@@ -35,6 +35,8 @@
  *  2003-04-05  s/reply_route/failure_route, onreply_route introduced (jiri)
  *  2003-04-12  added force_rport, chdir and wdir (andrei)
  *  2003-04-22  strip_tail added (jiri)
+ *  2003-07-03  tls* (disable, certificate, private_key, ca_list, verify, 
+ *               require_certificate added (andrei)
  */
 
 
@@ -160,6 +162,12 @@ WDIR		"workdir"|"wdir"
 MHOMED		mhomed
 DISABLE_TCP		"disable_tcp"
 TCP_CHILDREN	"tcp_children"
+DISABLE_TLS		"disable_tls"
+TLS_VERIFY		"tls_verify"
+TLS_REQUIRE_CERTIFICATE "tls_require_certificate"
+TLS_CERTIFICATE	"tls_certificate"
+TLS_PRIVATE_KEY "tls_private_key"
+TLS_CA_LIST		"tls_ca_list"
 
 LOADMODULE	loadmodule
 MODPARAM        modparam
@@ -281,6 +289,16 @@ EAT_ABLE	[\ \t\b\r]
 <INITIAL>{MHOMED}	{ count(); yylval.strval=yytext; return MHOMED; }
 <INITIAL>{DISABLE_TCP}	{ count(); yylval.strval=yytext; return DISABLE_TCP; }
 <INITIAL>{TCP_CHILDREN}	{ count(); yylval.strval=yytext; return TCP_CHILDREN; }
+<INITIAL>{DISABLE_TLS}	{ count(); yylval.strval=yytext; return DISABLE_TLS; }
+<INITIAL>{TLS_VERIFY}	{ count(); yylval.strval=yytext; return TLS_VERIFY; }
+<INITIAL>{TLS_REQUIRE_CERTIFICATE}	{ count(); yylval.strval=yytext;
+										return TLS_REQUIRE_CERTIFICATE; }
+<INITIAL>{TLS_CERTIFICATE}	{ count(); yylval.strval=yytext; 
+										return TLS_CERTIFICATE; }
+<INITIAL>{TLS_PRIVATE_KEY}	{ count(); yylval.strval=yytext; 
+										return TLS_PRIVATE_KEY; }
+<INITIAL>{TLS_CA_LIST}	{ count(); yylval.strval=yytext; 
+										return TLS_CA_LIST; }
 <INITIAL>{FIFO}	{ count(); yylval.strval=yytext; return FIFO; }
 <INITIAL>{FIFO_MODE}	{ count(); yylval.strval=yytext; return FIFO_MODE; }
 <INITIAL>{SERVER_SIGNATURE}	{ count(); yylval.strval=yytext; return SERVER_SIGNATURE; }

+ 63 - 0
cfg.y

@@ -39,6 +39,8 @@
  * 2003-04-12  added force_rport, chroot and wdir (andrei)
  * 2003-04-15  added tcp_children, disable_tcp (andrei)
  * 2003-04-22  strip_tail added (jiri)
+ * 2003-07-03  tls* (disable, certificate, private_key, ca_list, verify, 
+ *              require_certificate added (andrei)
  */
 
 
@@ -174,6 +176,12 @@ int rt;  /* Type of route block for find_export */
 %token MHOMED
 %token DISABLE_TCP
 %token TCP_CHILDREN
+%token DISABLE_TLS
+%token TLS_VERIFY
+%token TLS_REQUIRE_CERTIFICATE
+%token TLS_CERTIFICATE
+%token TLS_PRIVATE_KEY
+%token TLS_CA_LIST
 
 
 
@@ -369,6 +377,61 @@ assign_stm:	DEBUG EQUAL NUMBER { debug=$3; }
 									#endif
 									}
 		| TCP_CHILDREN EQUAL error { yyerror("number expected"); }
+		| DISABLE_TLS EQUAL NUMBER {
+									#ifdef USE_TLS
+										tls_disable=$3;
+									#else
+										fprintf(stderr, "WARNING: tls support"
+												"not compiled in\n");
+									#endif
+									}
+		| DISABLE_TLS EQUAL error { yyerror("boolean value expected"); }
+		| TLS_VERIFY EQUAL NUMBER {
+									#ifdef USE_TLS
+										tls_verify_cert=$3;
+									#else
+										fprintf(stderr, "WARNING: tcp support"
+												"not compiled in\n");
+									#endif
+									}
+		| TLS_VERIFY EQUAL error { yyerror("boolean value expected"); }
+		| TLS_REQUIRE_CERTIFICATE EQUAL NUMBER {
+									#ifdef USE_TLS
+										tls_require_cert=$3;
+									#else
+										fprintf(stderr, "WARNING: tcp support"
+												"not compiled in\n");
+									#endif
+									}
+		| TLS_REQUIRE_CERTIFICATE EQUAL error { yyerror("boolean value"
+																" expected"); }
+		| TLS_CERTIFICATE EQUAL STRING { 
+									#ifdef USE_TLS
+											tls_cert_file=$3;
+									#else
+										fprintf(stderr, "WARNING: tls support"
+												"not compiled in\n");
+									#endif
+									}
+		| TLS_CERTIFICATE EQUAL error { yyerror("string value expected"); }
+		| TLS_PRIVATE_KEY EQUAL STRING { 
+									#ifdef USE_TLS
+											tls_pkey_file=$3;
+									#else
+										fprintf(stderr, "WARNING: tls support"
+												"not compiled in\n");
+									#endif
+									}
+		| TLS_PRIVATE_KEY EQUAL error { yyerror("string value expected"); }
+		| TLS_CA_LIST EQUAL STRING { 
+									#ifdef USE_TLS
+											tls_ca_file=$3;
+									#else
+										fprintf(stderr, "WARNING: tls support"
+												"not compiled in\n");
+									#endif
+									}
+		| TLS_CA_LIST EQUAL error { yyerror("string value expected"); }
 		| SERVER_SIGNATURE EQUAL NUMBER { server_signature=$3; }
 		| SERVER_SIGNATURE EQUAL error { yyerror("boolean value expected"); }
 		| REPLY_TO_VIA EQUAL NUMBER { reply_to_via=$3; }

+ 5 - 0
globals.h

@@ -81,6 +81,11 @@ extern int tcp_disable;
 #endif
 #ifdef USE_TLS
 extern int tls_disable;
+extern int tls_verify_cert;
+extern int tls_require_cert;
+extern char* tls_cert_file;
+extern char* tls_pkey_file;
+extern char* tls_ca_file;
 #endif
 extern int dont_fork;
 extern int check_via;