Browse code

- accidental commit of local unfinished changes reverted

Jan Janak authored on 20/01/2006 15:24:28
Showing 1 changed files
... ...
@@ -96,6 +96,9 @@
96 96
 #include "select.h"
97 97
 
98 98
 #include "config.h"
99
+#ifdef USE_TLS
100
+#include "tls/tls_config.h"
101
+#endif
99 102
 
100 103
 #ifdef DEBUG_DMALLOC
101 104
 #include <dmalloc.h>
... ...
@@ -124,6 +127,7 @@ static select_t sel;
124 127
 static select_t* sel_ptr;
125 128
 static struct action *mod_func_action;
126 129
 
130
+static void warn(char* s);
127 131
 static struct socket_id* mk_listen_id(char*, int, int);
128 132
 
129 133
 %}
... ...
@@ -249,7 +253,20 @@ static struct socket_id* mk_listen_id(char*, int, int);
249 253
 %token TCP_POLL_METHOD
250 254
 %token TCP_MAX_CONNECTIONS
251 255
 %token DISABLE_TLS
256
+%token TLSLOG
252 257
 %token TLS_PORT_NO
258
+%token TLS_METHOD
259
+%token TLS_HANDSHAKE_TIMEOUT
260
+%token TLS_SEND_TIMEOUT
261
+%token SSLv23
262
+%token SSLv2
263
+%token SSLv3
264
+%token TLSv1
265
+%token TLS_VERIFY
266
+%token TLS_REQUIRE_CERTIFICATE
267
+%token TLS_CERTIFICATE
268
+%token TLS_PRIVATE_KEY
269
+%token TLS_CA_LIST
253 270
 %token ADVERTISED_ADDRESS
254 271
 %token ADVERTISED_PORT
255 272
 %token DISABLE_CORE
... ...
@@ -324,7 +341,7 @@ static struct socket_id* mk_listen_id(char*, int, int);
324 341
 %type <attr> attr_id_ass
325 342
 %type <attr> attr_id_val
326 343
 %type <attr> attr_id_any
327
-/* %type <intval> class_id */
344
+//%type <intval> class_id
328 345
 %type <intval> assign_op
329 346
 %type <select> select_id
330 347
 /*%type <route_el> rules;
... ...
@@ -556,6 +573,121 @@ assign_stm:
556 573
 		#endif
557 574
 	}
558 575
 	| TCP_MAX_CONNECTIONS EQUAL error { yyerror("number expected"); }
576
+	| DISABLE_TLS EQUAL NUMBER {
577
+		#ifdef USE_TLS
578
+			tls_disable=$3;
579
+		#else
580
+			warn("tls support not compiled in");
581
+		#endif
582
+	}
583
+	| DISABLE_TLS EQUAL error { yyerror("boolean value expected"); }
584
+	| TLSLOG EQUAL NUMBER {
585
+		#ifdef USE_TLS
586
+			tls_log=$3;
587
+		#else
588
+			warn("tls support not compiled in");
589
+		#endif
590
+	}
591
+	| TLSLOG EQUAL error { yyerror("int value expected"); }
592
+	| TLS_PORT_NO EQUAL NUMBER {
593
+		#ifdef USE_TLS
594
+			tls_port_no=$3;
595
+		#else
596
+			warn("tls support not compiled in");
597
+		#endif
598
+	}
599
+	| TLS_PORT_NO EQUAL error { yyerror("number expected"); }
600
+	| TLS_METHOD EQUAL SSLv23 {
601
+		#ifdef USE_TLS
602
+			tls_method=TLS_USE_SSLv23;
603
+		#else
604
+			warn("tls support not compiled in");
605
+		#endif
606
+	}
607
+	| TLS_METHOD EQUAL SSLv2 {
608
+		#ifdef USE_TLS
609
+			tls_method=TLS_USE_SSLv2;
610
+		#else
611
+			warn("tls support not compiled in");
612
+		#endif
613
+	}
614
+	| TLS_METHOD EQUAL SSLv3 {
615
+		#ifdef USE_TLS
616
+			tls_method=TLS_USE_SSLv3;
617
+		#else
618
+			warn("tls support not compiled in");
619
+		#endif
620
+	}
621
+	| TLS_METHOD EQUAL TLSv1 {
622
+		#ifdef USE_TLS
623
+			tls_method=TLS_USE_TLSv1;
624
+		#else
625
+			warn("tls support not compiled in");
626
+		#endif
627
+	}
628
+	| TLS_METHOD EQUAL error {
629
+		#ifdef USE_TLS
630
+			yyerror("SSLv23, SSLv2, SSLv3 or TLSv1 expected");
631
+		#else
632
+			warn("tls support not compiled in");
633
+		#endif
634
+	}
635
+	| TLS_VERIFY EQUAL NUMBER {
636
+		#ifdef USE_TLS
637
+			tls_verify_cert=$3;
638
+		#else
639
+			warn("tls support not compiled in");
640
+		#endif
641
+	}
642
+	| TLS_VERIFY EQUAL error { yyerror("boolean value expected"); }
643
+	| TLS_REQUIRE_CERTIFICATE EQUAL NUMBER {
644
+		#ifdef USE_TLS
645
+			tls_require_cert=$3;
646
+		#else
647
+			warn( "tls support not compiled in");
648
+		#endif
649
+	}
650
+	| TLS_REQUIRE_CERTIFICATE EQUAL error { yyerror("boolean value expected"); }
651
+	| TLS_CERTIFICATE EQUAL STRING {
652
+		#ifdef USE_TLS
653
+			tls_cert_file=$3;
654
+		#else
655
+			warn("tls support not compiled in");
656
+		#endif
657
+	}
658
+	| TLS_CERTIFICATE EQUAL error { yyerror("string value expected"); }
659
+	| TLS_PRIVATE_KEY EQUAL STRING {
660
+		#ifdef USE_TLS
661
+			tls_pkey_file=$3;
662
+		#else
663
+			warn("tls support not compiled in");
664
+		#endif
665
+	}
666
+	| TLS_PRIVATE_KEY EQUAL error { yyerror("string value expected"); }
667
+	| TLS_CA_LIST EQUAL STRING {
668
+		#ifdef USE_TLS
669
+			tls_ca_file=$3;
670
+		#else
671
+			warn("tls support not compiled in");
672
+		#endif
673
+	}
674
+	| TLS_CA_LIST EQUAL error { yyerror("string value expected"); }
675
+	| TLS_HANDSHAKE_TIMEOUT EQUAL NUMBER {
676
+		#ifdef USE_TLS
677
+			tls_handshake_timeout=$3;
678
+		#else
679
+			warn("tls support not compiled in");
680
+		#endif
681
+	}
682
+	| TLS_HANDSHAKE_TIMEOUT EQUAL error { yyerror("number expected"); }
683
+	| TLS_SEND_TIMEOUT EQUAL NUMBER {
684
+		#ifdef USE_TLS
685
+			tls_send_timeout=$3;
686
+		#else
687
+			warn("tls support not compiled in");
688
+		#endif
689
+	}
690
+	| TLS_SEND_TIMEOUT EQUAL error { yyerror("number expected"); }
559 691
 	| SERVER_SIGNATURE EQUAL NUMBER { server_signature=$3; }
560 692
 	| SERVER_SIGNATURE EQUAL error { yyerror("boolean value expected"); }
561 693
 	| REPLY_TO_VIA EQUAL NUMBER { reply_to_via=$3; }
... ...
@@ -1126,7 +1258,6 @@ select_param:
1126 1258
 		sel.n++;
1127 1259
 	}
1128 1260
 	;
1129
-
1130 1261
 select_params:
1131 1262
 	select_params DOT select_param
1132 1263
 	| select_param
... ...
@@ -1498,6 +1629,12 @@ func_param:
1498 1629
 extern int line;
1499 1630
 extern int column;
1500 1631
 extern int startcolumn;
1632
+static void warn(char* s)
1633
+{
1634
+	LOG(L_WARN, "cfg. warning: (%d,%d-%d): %s\n", line, startcolumn,
1635
+			column, s);
1636
+	cfg_errors++;
1637
+}
1501 1638
 
1502 1639
 static void yyerror(char* s)
1503 1640
 {