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 124
 static select_t* sel_ptr;
125 125
 static struct action *mod_func_action;
126 126
 
127
+static void warn(char* s);
127 128
 static struct socket_id* mk_listen_id(char*, int, int);
128 129
 
129 130
 %}
... ...
@@ -249,7 +253,20 @@ static struct socket_id* mk_listen_id(char*, int, int);
249 249
 %token TCP_POLL_METHOD
250 250
 %token TCP_MAX_CONNECTIONS
251 251
 %token DISABLE_TLS
252
+%token TLSLOG
252 253
 %token TLS_PORT_NO
254
+%token TLS_METHOD
255
+%token TLS_HANDSHAKE_TIMEOUT
256
+%token TLS_SEND_TIMEOUT
257
+%token SSLv23
258
+%token SSLv2
259
+%token SSLv3
260
+%token TLSv1
261
+%token TLS_VERIFY
262
+%token TLS_REQUIRE_CERTIFICATE
263
+%token TLS_CERTIFICATE
264
+%token TLS_PRIVATE_KEY
265
+%token TLS_CA_LIST
253 266
 %token ADVERTISED_ADDRESS
254 267
 %token ADVERTISED_PORT
255 268
 %token DISABLE_CORE
... ...
@@ -324,7 +341,7 @@ static struct socket_id* mk_listen_id(char*, int, int);
324 324
 %type <attr> attr_id_ass
325 325
 %type <attr> attr_id_val
326 326
 %type <attr> attr_id_any
327
-/* %type <intval> class_id */
327
+//%type <intval> class_id
328 328
 %type <intval> assign_op
329 329
 %type <select> select_id
330 330
 /*%type <route_el> rules;
... ...
@@ -556,6 +573,121 @@ assign_stm:
556 556
 		#endif
557 557
 	}
558 558
 	| TCP_MAX_CONNECTIONS EQUAL error { yyerror("number expected"); }
559
+	| DISABLE_TLS EQUAL NUMBER {
560
+		#ifdef USE_TLS
561
+			tls_disable=$3;
562
+		#else
563
+			warn("tls support not compiled in");
564
+		#endif
565
+	}
566
+	| DISABLE_TLS EQUAL error { yyerror("boolean value expected"); }
567
+	| TLSLOG EQUAL NUMBER {
568
+		#ifdef USE_TLS
569
+			tls_log=$3;
570
+		#else
571
+			warn("tls support not compiled in");
572
+		#endif
573
+	}
574
+	| TLSLOG EQUAL error { yyerror("int value expected"); }
575
+	| TLS_PORT_NO EQUAL NUMBER {
576
+		#ifdef USE_TLS
577
+			tls_port_no=$3;
578
+		#else
579
+			warn("tls support not compiled in");
580
+		#endif
581
+	}
582
+	| TLS_PORT_NO EQUAL error { yyerror("number expected"); }
583
+	| TLS_METHOD EQUAL SSLv23 {
584
+		#ifdef USE_TLS
585
+			tls_method=TLS_USE_SSLv23;
586
+		#else
587
+			warn("tls support not compiled in");
588
+		#endif
589
+	}
590
+	| TLS_METHOD EQUAL SSLv2 {
591
+		#ifdef USE_TLS
592
+			tls_method=TLS_USE_SSLv2;
593
+		#else
594
+			warn("tls support not compiled in");
595
+		#endif
596
+	}
597
+	| TLS_METHOD EQUAL SSLv3 {
598
+		#ifdef USE_TLS
599
+			tls_method=TLS_USE_SSLv3;
600
+		#else
601
+			warn("tls support not compiled in");
602
+		#endif
603
+	}
604
+	| TLS_METHOD EQUAL TLSv1 {
605
+		#ifdef USE_TLS
606
+			tls_method=TLS_USE_TLSv1;
607
+		#else
608
+			warn("tls support not compiled in");
609
+		#endif
610
+	}
611
+	| TLS_METHOD EQUAL error {
612
+		#ifdef USE_TLS
613
+			yyerror("SSLv23, SSLv2, SSLv3 or TLSv1 expected");
614
+		#else
615
+			warn("tls support not compiled in");
616
+		#endif
617
+	}
618
+	| TLS_VERIFY EQUAL NUMBER {
619
+		#ifdef USE_TLS
620
+			tls_verify_cert=$3;
621
+		#else
622
+			warn("tls support not compiled in");
623
+		#endif
624
+	}
625
+	| TLS_VERIFY EQUAL error { yyerror("boolean value expected"); }
626
+	| TLS_REQUIRE_CERTIFICATE EQUAL NUMBER {
627
+		#ifdef USE_TLS
628
+			tls_require_cert=$3;
629
+		#else
630
+			warn( "tls support not compiled in");
631
+		#endif
632
+	}
633
+	| TLS_REQUIRE_CERTIFICATE EQUAL error { yyerror("boolean value expected"); }
634
+	| TLS_CERTIFICATE EQUAL STRING {
635
+		#ifdef USE_TLS
636
+			tls_cert_file=$3;
637
+		#else
638
+			warn("tls support not compiled in");
639
+		#endif
640
+	}
641
+	| TLS_CERTIFICATE EQUAL error { yyerror("string value expected"); }
642
+	| TLS_PRIVATE_KEY EQUAL STRING {
643
+		#ifdef USE_TLS
644
+			tls_pkey_file=$3;
645
+		#else
646
+			warn("tls support not compiled in");
647
+		#endif
648
+	}
649
+	| TLS_PRIVATE_KEY EQUAL error { yyerror("string value expected"); }
650
+	| TLS_CA_LIST EQUAL STRING {
651
+		#ifdef USE_TLS
652
+			tls_ca_file=$3;
653
+		#else
654
+			warn("tls support not compiled in");
655
+		#endif
656
+	}
657
+	| TLS_CA_LIST EQUAL error { yyerror("string value expected"); }
658
+	| TLS_HANDSHAKE_TIMEOUT EQUAL NUMBER {
659
+		#ifdef USE_TLS
660
+			tls_handshake_timeout=$3;
661
+		#else
662
+			warn("tls support not compiled in");
663
+		#endif
664
+	}
665
+	| TLS_HANDSHAKE_TIMEOUT EQUAL error { yyerror("number expected"); }
666
+	| TLS_SEND_TIMEOUT EQUAL NUMBER {
667
+		#ifdef USE_TLS
668
+			tls_send_timeout=$3;
669
+		#else
670
+			warn("tls support not compiled in");
671
+		#endif
672
+	}
673
+	| TLS_SEND_TIMEOUT EQUAL error { yyerror("number expected"); }
559 674
 	| SERVER_SIGNATURE EQUAL NUMBER { server_signature=$3; }
560 675
 	| SERVER_SIGNATURE EQUAL error { yyerror("boolean value expected"); }
561 676
 	| REPLY_TO_VIA EQUAL NUMBER { reply_to_via=$3; }
... ...
@@ -1126,7 +1258,6 @@ select_param:
1126 1126
 		sel.n++;
1127 1127
 	}
1128 1128
 	;
1129
-
1130 1129
 select_params:
1131 1130
 	select_params DOT select_param
1132 1131
 	| select_param
... ...
@@ -1498,6 +1629,12 @@ func_param:
1498 1498
 extern int line;
1499 1499
 extern int column;
1500 1500
 extern int startcolumn;
1501
+static void warn(char* s)
1502
+{
1503
+	LOG(L_WARN, "cfg. warning: (%d,%d-%d): %s\n", line, startcolumn,
1504
+			column, s);
1505
+	cfg_errors++;
1506
+}
1501 1507
 
1502 1508
 static void yyerror(char* s)
1503 1509
 {