Browse code

tls: s/tls_cfg/tls_domains_cfg

Internal variable and type name change: replaces tls_cfg with
tls_domains_cfg. This frees up tls_cfg for use with the runtime
configuration framework (by convention a module runtime
configuration is named <module_name>_cfg and it would be very
confusing to have an exception for the tls module).

Andrei Pelinescu-Onciul authored on 27/05/2010 15:20:16
Showing 13 changed files
... ...
@@ -45,7 +45,7 @@
45 45
 #include "../../trim.h"
46 46
 #include "../../ut.h"
47 47
 
48
-static tls_cfg_t* cfg = NULL;
48
+static tls_domains_cfg_t* cfg = NULL;
49 49
 static tls_domain_t* domain = NULL;
50 50
 
51 51
 #ifdef USE_IPV6
... ...
@@ -340,7 +340,7 @@ static int parse_domain(void* param, cfg_parser_t* st, unsigned int flags)
340 340
 /*
341 341
  * Create configuration structures from configuration file
342 342
  */
343
-tls_cfg_t* tls_load_config(str* filename)
343
+tls_domains_cfg_t* tls_load_config(str* filename)
344 344
 {
345 345
 	cfg_parser_t* parser;
346 346
 
... ...
@@ -43,7 +43,7 @@
43 43
 #include "../../str.h"
44 44
 #include "tls_domain.h"
45 45
 
46
-tls_cfg_t* tls_load_config(str* filename);
46
+tls_domains_cfg_t* tls_load_config(str* filename);
47 47
 
48 48
 /*
49 49
  * Convert TLS method string to integer
... ...
@@ -102,7 +102,7 @@ void tls_free_domain(tls_domain_t* d)
102 102
 /*
103 103
  * clean up 
104 104
  */
105
-void tls_free_cfg(tls_cfg_t* cfg)
105
+void tls_free_cfg(tls_domains_cfg_t* cfg)
106 106
 {
107 107
 	tls_domain_t* p;
108 108
 	while(cfg->srv_list) {
... ...
@@ -123,23 +123,23 @@ void tls_free_cfg(tls_cfg_t* cfg)
123 123
 
124 124
 void tls_destroy_cfg(void)
125 125
 {
126
-	tls_cfg_t* ptr;
126
+	tls_domains_cfg_t* ptr;
127 127
 
128
-	if (tls_cfg_lock) {
129
-		lock_destroy(tls_cfg_lock);
130
-		lock_dealloc(tls_cfg_lock);
131
-		tls_cfg_lock = 0;
128
+	if (tls_domains_cfg_lock) {
129
+		lock_destroy(tls_domains_cfg_lock);
130
+		lock_dealloc(tls_domains_cfg_lock);
131
+		tls_domains_cfg_lock = 0;
132 132
 	}
133 133
 
134
-	if (tls_cfg) {
135
-		while(*tls_cfg) {
136
-			ptr = *tls_cfg;
137
-			*tls_cfg = (*tls_cfg)->next;
134
+	if (tls_domains_cfg) {
135
+		while(*tls_domains_cfg) {
136
+			ptr = *tls_domains_cfg;
137
+			*tls_domains_cfg = (*tls_domains_cfg)->next;
138 138
 			tls_free_cfg(ptr);
139 139
 		}
140 140
 		
141
-		shm_free(tls_cfg);
142
-		tls_cfg = 0;
141
+		shm_free(tls_domains_cfg);
142
+		tls_domains_cfg = 0;
143 143
 	}
144 144
 }
145 145
 
... ...
@@ -269,7 +269,7 @@ static int tls_foreach_CTX_in_domain_lst(tls_domain_t* d,
269 269
  * @param p - parameter passed to the callback
270 270
  * @return 0 on success, <0 on error.
271 271
  */
272
-static int tls_foreach_CTX_in_srv_domains(tls_cfg_t* cfg,
272
+static int tls_foreach_CTX_in_srv_domains(tls_domains_cfg_t* cfg,
273 273
 											per_ctx_cbk_f ctx_cbk,
274 274
 											long l1, void* p2)
275 275
 {
... ...
@@ -290,7 +290,7 @@ static int tls_foreach_CTX_in_srv_domains(tls_cfg_t* cfg,
290 290
  * @param p - parameter passed to the callback
291 291
  * @return 0 on success, <0 on error.
292 292
  */
293
-static int tls_foreach_CTX_in_cli_domains(tls_cfg_t* cfg,
293
+static int tls_foreach_CTX_in_cli_domains(tls_domains_cfg_t* cfg,
294 294
 											per_ctx_cbk_f ctx_cbk,
295 295
 											long l1, void* p2)
296 296
 {
... ...
@@ -311,7 +311,8 @@ static int tls_foreach_CTX_in_cli_domains(tls_cfg_t* cfg,
311 311
  * @param p - parameter passed to the callback
312 312
  * @return 0 on success, <0 on error.
313 313
  */
314
-static int tls_foreach_CTX_in_cfg(tls_cfg_t* cfg, per_ctx_cbk_f ctx_cbk,
314
+static int tls_foreach_CTX_in_cfg(tls_domains_cfg_t* cfg,
315
+										per_ctx_cbk_f ctx_cbk,
315 316
 										long l1, void* p2)
316 317
 {
317 318
 	int ret;
... ...
@@ -737,7 +738,8 @@ static int load_private_key(tls_domain_t* d)
737 738
  * Initialize attributes of all domains from default domains
738 739
  * if necessary
739 740
  */
740
-int tls_fix_cfg(tls_cfg_t* cfg, tls_domain_t* srv_defaults, tls_domain_t* cli_defaults)
741
+int tls_fix_cfg(tls_domains_cfg_t* cfg, tls_domain_t* srv_defaults,
742
+				tls_domain_t* cli_defaults)
741 743
 {
742 744
 	tls_domain_t* d;
743 745
 
... ...
@@ -843,16 +845,16 @@ int tls_fix_cfg(tls_cfg_t* cfg, tls_domain_t* srv_defaults, tls_domain_t* cli_de
843 845
 /*
844 846
  * Create new configuration structure
845 847
  */
846
-tls_cfg_t* tls_new_cfg(void)
848
+tls_domains_cfg_t* tls_new_cfg(void)
847 849
 {
848
-	tls_cfg_t* r;
850
+	tls_domains_cfg_t* r;
849 851
 
850
-	r = (tls_cfg_t*)shm_malloc(sizeof(tls_cfg_t));
852
+	r = (tls_domains_cfg_t*)shm_malloc(sizeof(tls_domains_cfg_t));
851 853
 	if (!r) {
852 854
 		ERR("No memory left\n");
853 855
 		return 0;
854 856
 	}
855
-	memset(r, 0, sizeof(tls_cfg_t));
857
+	memset(r, 0, sizeof(tls_domains_cfg_t));
856 858
 	return r;
857 859
 }
858 860
 
... ...
@@ -860,7 +862,8 @@ tls_cfg_t* tls_new_cfg(void)
860 862
 /*
861 863
  * Lookup TLS configuration based on type, ip, and port
862 864
  */
863
-tls_domain_t* tls_lookup_cfg(tls_cfg_t* cfg, int type, struct ip_addr* ip, unsigned short port)
865
+tls_domain_t* tls_lookup_cfg(tls_domains_cfg_t* cfg, int type,
866
+								struct ip_addr* ip, unsigned short port)
864 867
 {
865 868
 	tls_domain_t *p;
866 869
 
... ...
@@ -887,7 +890,7 @@ tls_domain_t* tls_lookup_cfg(tls_cfg_t* cfg, int type, struct ip_addr* ip, unsig
887 890
 /*
888 891
  * Check whether configuration domain exists
889 892
  */
890
-static int domain_exists(tls_cfg_t* cfg, tls_domain_t* d)
893
+static int domain_exists(tls_domains_cfg_t* cfg, tls_domain_t* d)
891 894
 {
892 895
 	tls_domain_t *p;
893 896
 
... ...
@@ -912,7 +915,7 @@ static int domain_exists(tls_cfg_t* cfg, tls_domain_t* d)
912 915
 /*
913 916
  * Add a domain to the configuration set
914 917
  */
915
-int tls_add_domain(tls_cfg_t* cfg, tls_domain_t* d)
918
+int tls_add_domain(tls_domains_cfg_t* cfg, tls_domain_t* d)
916 919
 {
917 920
 	if (!cfg) {
918 921
 		ERR("TLS configuration structure missing\n");
... ...
@@ -98,14 +98,14 @@ typedef struct tls_domain {
98 98
 /*
99 99
  * TLS configuration structures
100 100
  */
101
-typedef struct tls_cfg {
101
+typedef struct tls_domains_cfg {
102 102
 	tls_domain_t* srv_default; /* Default server domain */
103 103
 	tls_domain_t* cli_default; /* Default client domain */
104 104
 	tls_domain_t* srv_list;    /* Server domain list */
105 105
 	tls_domain_t* cli_list;    /* Client domain list */
106
-	struct tls_cfg* next;      /* Next element in the garbage list */
106
+	struct tls_domains_cfg* next; /* Next element in the garbage list */
107 107
 	int ref_count;             /* How many connections use this configuration */
108
-} tls_cfg_t;
108
+} tls_domains_cfg_t;
109 109
 
110 110
 
111 111
 /*
... ...
@@ -131,31 +131,33 @@ char* tls_domain_str(tls_domain_t* d);
131 131
 /*
132 132
  * Create new instance of TLS configuration data
133 133
  */
134
-tls_cfg_t* tls_new_cfg(void);
134
+tls_domains_cfg_t* tls_new_cfg(void);
135 135
 
136 136
 
137 137
 /*
138 138
  * Add a new configuration domain
139 139
  */
140
-int tls_add_domain(tls_cfg_t* cfg, tls_domain_t* d);
140
+int tls_add_domain(tls_domains_cfg_t* cfg, tls_domain_t* d);
141 141
 
142 142
 
143 143
 /*
144 144
  * Fill in missing parameters
145 145
  */
146
-int tls_fix_cfg(tls_cfg_t* cfg, tls_domain_t* srv_defaults, tls_domain_t* cli_defaults);
146
+int tls_fix_cfg(tls_domains_cfg_t* cfg, tls_domain_t* srv_defaults,
147
+				tls_domain_t* cli_defaults);
147 148
 
148 149
 
149 150
 /*
150 151
  * Lookup TLS configuration
151 152
  */
152
-tls_domain_t* tls_lookup_cfg(tls_cfg_t* cfg, int type, struct ip_addr* ip, unsigned short port);
153
+tls_domain_t* tls_lookup_cfg(tls_domains_cfg_t* cfg, int type,
154
+								struct ip_addr* ip, unsigned short port);
153 155
 
154 156
 
155 157
 /*
156 158
  * Free TLS configuration data
157 159
  */
158
-void tls_free_cfg(tls_cfg_t* cfg);
160
+void tls_free_cfg(tls_domains_cfg_t* cfg);
159 161
 
160 162
 /*
161 163
  * Destroy all the config data
... ...
@@ -618,7 +618,7 @@ int init_tls_h(void)
618 618
  * Make sure that all server domains in the configuration have corresponding
619 619
  * listening socket in SER
620 620
  */
621
-int tls_check_sockets(tls_cfg_t* cfg)
621
+int tls_check_sockets(tls_domains_cfg_t* cfg)
622 622
 {
623 623
 	tls_domain_t* d;
624 624
 
... ...
@@ -86,6 +86,6 @@ int tls_h_init_si(struct socket_info *si);
86 86
  * Make sure that all server domains in the configuration have corresponding
87 87
  * listening socket in SER
88 88
  */
89
-int tls_check_sockets(tls_cfg_t* cfg);
89
+int tls_check_sockets(tls_domains_cfg_t* cfg);
90 90
 
91 91
 #endif /* _TLS_INIT_H */
... ...
@@ -207,14 +207,14 @@ int ssl_max_send_fragment = -1;  /* don't set, leave the default (16k) */
207 207
  */
208 208
 int ssl_read_ahead = 1; /* set (use -1 for the default value) */
209 209
 
210
-str tls_cfg_file = STR_NULL;
210
+str tls_domains_cfg_file = STR_NULL;
211 211
 
212 212
 
213 213
 /* Current TLS configuration */
214
-tls_cfg_t** tls_cfg = NULL;
214
+tls_domains_cfg_t** tls_domains_cfg = NULL;
215 215
 
216 216
 /* List lock, used by garbage collector */
217
-gen_lock_t* tls_cfg_lock = NULL;
217
+gen_lock_t* tls_domains_cfg_lock = NULL;
218 218
 
219 219
 
220 220
 /*
... ...
@@ -245,7 +245,7 @@ static param_export_t params[] = {
245 245
 	{"tls_log",             PARAM_INT,    &tls_log                },
246 246
 	{"session_cache",       PARAM_INT,    &tls_session_cache      },
247 247
 	{"session_id",          PARAM_STR,    &tls_session_id         },
248
-	{"config",              PARAM_STR,    &tls_cfg_file           },
248
+	{"config",              PARAM_STR,    &tls_domains_cfg_file   },
249 249
 	{"tls_disable_compression", PARAM_INT,&tls_disable_compression},
250 250
 	{"ssl_release_buffers",   PARAM_INT, &ssl_mode_release_buffers},
251 251
 	{"ssl_freelist_max_len",  PARAM_INT,    &ssl_freelist_max_len},
... ...
@@ -296,9 +296,9 @@ static struct tls_hooks tls_h = {
296 296
 /*
297 297
  * Create TLS configuration from modparams
298 298
  */
299
-static tls_cfg_t* tls_use_modparams(void)
299
+static tls_domains_cfg_t* tls_use_modparams(void)
300 300
 {
301
-	tls_cfg_t* ret;
301
+	tls_domains_cfg_t* ret;
302 302
 	
303 303
 	ret = tls_new_cfg();
304 304
 	if (!ret) return;
... ...
@@ -310,10 +310,10 @@ static tls_cfg_t* tls_use_modparams(void)
310 310
 
311 311
 static int fix_rel_pathnames(void)
312 312
 {
313
-	if (tls_cfg_file.s) {
314
-		tls_cfg_file.s = get_abs_pathname(NULL, &tls_cfg_file);
315
-		if (tls_cfg_file.s == NULL) return -1;
316
-		tls_cfg_file.len = strlen(tls_cfg_file.s);
313
+	if (tls_domains_cfg_file.s) {
314
+		tls_domains_cfg_file.s = get_abs_pathname(NULL, &tls_domains_cfg_file);
315
+		if (tls_domains_cfg_file.s == NULL) return -1;
316
+		tls_domains_cfg_file.len = strlen(tls_domains_cfg_file.s);
317 317
 	}
318 318
 	
319 319
 	if (mod_params.pkey_file.s) {
... ...
@@ -368,12 +368,13 @@ static int mod_init(void)
368 368
 	 */
369 369
 	if (fix_rel_pathnames() < 0) return -1;
370 370
 
371
-	tls_cfg = (tls_cfg_t**)shm_malloc(sizeof(tls_cfg_t*));
372
-	if (!tls_cfg) {
371
+	tls_domains_cfg = 
372
+		(tls_domains_cfg_t**)shm_malloc(sizeof(tls_domains_cfg_t*));
373
+	if (!tls_domains_cfg) {
373 374
 		ERR("Not enough shared memory left\n");
374 375
 		goto error;
375 376
 	}
376
-	*tls_cfg = NULL;
377
+	*tls_domains_cfg = NULL;
377 378
 
378 379
 	register_tls_hooks(&tls_h);
379 380
 	register_select_table(tls_sel);
... ...
@@ -385,13 +386,13 @@ static int mod_init(void)
385 386
 
386 387
 	 /* if (init_tls() < 0) return -1; */
387 388
 	
388
-	tls_cfg_lock = lock_alloc();
389
-	if (tls_cfg_lock == 0) {
389
+	tls_domains_cfg_lock = lock_alloc();
390
+	if (tls_domains_cfg_lock == 0) {
390 391
 		ERR("Unable to create TLS configuration lock\n");
391 392
 		goto error;
392 393
 	}
393
-	if (lock_init(tls_cfg_lock) == 0) {
394
-		lock_dealloc(tls_cfg_lock);
394
+	if (lock_init(tls_domains_cfg_lock) == 0) {
395
+		lock_dealloc(tls_domains_cfg_lock);
395 396
 		ERR("Unable to initialize TLS configuration lock\n");
396 397
 		goto error;
397 398
 	}
... ...
@@ -399,15 +400,15 @@ static int mod_init(void)
399 400
 		ERR("Unable to initialize TLS buffering\n");
400 401
 		goto error;
401 402
 	}
402
-	if (tls_cfg_file.s) {
403
-		*tls_cfg = tls_load_config(&tls_cfg_file);
404
-		if (!(*tls_cfg)) goto error;
403
+	if (tls_domains_cfg_file.s) {
404
+		*tls_domains_cfg = tls_load_config(&tls_domains_cfg_file);
405
+		if (!(*tls_domains_cfg)) goto error;
405 406
 	} else {
406
-		*tls_cfg = tls_new_cfg();
407
-		if (!(*tls_cfg)) goto error;
407
+		*tls_domains_cfg = tls_new_cfg();
408
+		if (!(*tls_domains_cfg)) goto error;
408 409
 	}
409 410
 
410
-	if (tls_check_sockets(*tls_cfg) < 0)
411
+	if (tls_check_sockets(*tls_domains_cfg) < 0)
411 412
 		goto error;
412 413
 
413 414
 	/* fix the timeouts from s to ticks */
... ...
@@ -434,16 +435,17 @@ error:
434 435
 
435 436
 static int mod_child(int rank)
436 437
 {
437
-	if (tls_disable || (tls_cfg==0))
438
+	if (tls_disable || (tls_domains_cfg==0))
438 439
 		return 0;
439 440
 	/* fix tls config only from the main proc/PROC_INIT., when we know 
440 441
 	 * the exact process number and before any other process starts*/
441 442
 	if (rank == PROC_INIT){
442
-		if (tls_cfg_file.s){
443
-			if (tls_fix_cfg(*tls_cfg, &srv_defaults, &cli_defaults) < 0) 
443
+		if (tls_domains_cfg_file.s){
444
+			if (tls_fix_cfg(*tls_domains_cfg, &srv_defaults,
445
+							&cli_defaults) < 0)
444 446
 				return -1;
445 447
 		}else{
446
-			if (tls_fix_cfg(*tls_cfg, &mod_params, &mod_params) < 0) 
448
+			if (tls_fix_cfg(*tls_domains_cfg, &mod_params, &mod_params) < 0)
447 449
 				return -1;
448 450
 		}
449 451
 	}
... ...
@@ -55,12 +55,12 @@ extern int ssl_max_send_fragment;
55 55
 extern int ssl_read_ahead;
56 56
 
57 57
 /* Current TLS configuration */
58
-extern tls_cfg_t** tls_cfg;
59
-extern gen_lock_t* tls_cfg_lock;
58
+extern tls_domains_cfg_t** tls_domains_cfg;
59
+extern gen_lock_t* tls_domains_cfg_lock;
60 60
 
61 61
 extern tls_domain_t cli_defaults;
62 62
 extern tls_domain_t srv_defaults;
63 63
 
64
-extern str tls_cfg_file;
64
+extern str tls_domains_cfg_file;
65 65
 
66 66
 #endif /* _TLS_MOD_H */
... ...
@@ -49,9 +49,9 @@ static const char* tls_reload_doc[2] = {
49 49
 
50 50
 static void tls_reload(rpc_t* rpc, void* ctx)
51 51
 {
52
-	tls_cfg_t* cfg;
52
+	tls_domains_cfg_t* cfg;
53 53
 
54
-	if (!tls_cfg_file.s) {
54
+	if (!tls_domains_cfg_file.s) {
55 55
 		rpc->fault(ctx, 500, "No TLS configuration file configured");
56 56
 		return;
57 57
 	}
... ...
@@ -59,24 +59,27 @@ static void tls_reload(rpc_t* rpc, void* ctx)
59 59
 	     /* Try to delete old configurations first */
60 60
 	collect_garbage();
61 61
 
62
-	cfg = tls_load_config(&tls_cfg_file);
62
+	cfg = tls_load_config(&tls_domains_cfg_file);
63 63
 	if (!cfg) {
64
-		rpc->fault(ctx, 500, "Error while loading TLS configuration file (consult server log)");
64
+		rpc->fault(ctx, 500, "Error while loading TLS configuration file"
65
+							" (consult server log)");
65 66
 		return;
66 67
 	}
67 68
 
68 69
 	if (tls_fix_cfg(cfg, &srv_defaults, &cli_defaults) < 0) {
69
-		rpc->fault(ctx, 500, "Error while fixing TLS configuration (consult server log)");
70
+		rpc->fault(ctx, 500, "Error while fixing TLS configuration"
71
+								" (consult server log)");
70 72
 		goto error;
71 73
 	}
72 74
 	if (tls_check_sockets(cfg) < 0) {
73
-		rpc->fault(ctx, 500, "No server listening socket found for one of TLS domains (consult server log)");
75
+		rpc->fault(ctx, 500, "No server listening socket found for one of"
76
+							" TLS domains (consult server log)");
74 77
 		goto error;
75 78
 	}
76 79
 
77 80
 	DBG("TLS configuration successfuly loaded");
78
-	cfg->next = (*tls_cfg);
79
-	*tls_cfg = cfg;
81
+	cfg->next = (*tls_domains_cfg);
82
+	*tls_domains_cfg = cfg;
80 83
 	return;
81 84
 
82 85
  error:
... ...
@@ -76,7 +76,7 @@ static int tls_complete_init(struct tcp_connection* c)
76 76
 {
77 77
 	tls_domain_t* dom;
78 78
 	struct tls_extra_data* data = 0;
79
-	tls_cfg_t* cfg;
79
+	tls_domains_cfg_t* cfg;
80 80
 	enum tls_conn_states state;
81 81
 
82 82
 	if (LOW_MEM_NEW_CONNECTION_TEST()){
... ...
@@ -84,15 +84,15 @@ static int tls_complete_init(struct tcp_connection* c)
84 84
 				" operation: %lu\n", shm_available());
85 85
 		goto error2;
86 86
 	}
87
-	     /* Get current TLS configuration and increate reference
87
+	     /* Get current TLS configuration and increase reference
88 88
 	      * count immediately. There is no need to lock the structure
89 89
 	      * here, because it does not get deleted immediately. When
90 90
 	      * SER reloads TLS configuration it will put the old configuration
91 91
 	      * on a garbage queue and delete it later, so we know here that
92
-	      * the pointer we get from *tls_cfg will be valid for a while, at
93
-	      * least by the time this function finishes
92
+	      * the pointer we get from *tls_domains_cfg will be valid for a while,
93
+		  * at least by the time this function finishes
94 94
 	      */
95
-	cfg = *tls_cfg;
95
+	cfg = *tls_domains_cfg;
96 96
 
97 97
 	     /* Increment the reference count in the configuration structure, this
98 98
 	      * is to ensure that, while on the garbage queue, the configuration does
... ...
@@ -53,8 +53,8 @@ struct tls_rd_buf {
53 53
 #define F_TLS_CON_SSL_PENDING 2 /* bytes buffered inside the SSL context */
54 54
 
55 55
 struct tls_extra_data {
56
-	tls_cfg_t* cfg; /* Configuration used for this connection */
57
-	SSL* ssl;       /* SSL context used for the connection */
56
+	tls_domains_cfg_t* cfg; /* Configuration used for this connection */
57
+	SSL* ssl;               /* SSL context used for the connection */
58 58
 	tls_ct_q* ct_wq;
59 59
 	struct tls_rd_buf* enc_rd_buf;
60 60
 	unsigned int flags;
... ...
@@ -73,18 +73,18 @@ int shm_asciiz_dup(char** dest, char* val)
73 73
  */
74 74
 void collect_garbage(void)
75 75
 {
76
-	tls_cfg_t* prev, *cur;
76
+	tls_domains_cfg_t* prev, *cur;
77 77
 
78 78
 	     /* Make sure we do not run two garbage collectors
79 79
 	      * at the same time
80 80
 	      */
81
-	lock_get(tls_cfg_lock);
81
+	lock_get(tls_domains_cfg_lock);
82 82
 
83 83
 	     /* Skip the current configuration, garbage starts
84 84
 	      * with the 2nd element on the list
85 85
 	      */
86
-	prev = *tls_cfg;
87
-	cur = (*tls_cfg)->next;
86
+	prev = *tls_domains_cfg;
87
+	cur = (*tls_domains_cfg)->next;
88 88
 
89 89
 	while(cur) {
90 90
 		if (cur->ref_count == 0) {
... ...
@@ -97,6 +97,6 @@ void collect_garbage(void)
97 97
 		cur = cur->next;
98 98
 	}
99 99
 
100
-	lock_release(tls_cfg_lock);
100
+	lock_release(tls_domains_cfg_lock);
101 101
 }
102 102
 
... ...
@@ -49,8 +49,8 @@
49 49
 do {                                                    \
50 50
 	long err;                                       \
51 51
         (r) = 0;                                        \
52
-	if ((*tls_cfg)->srv_default->ctx &&             \
53
-	    (*tls_cfg)->srv_default->ctx[0]) {          \
52
+	if ((*tls_domains_cfg)->srv_default->ctx &&         \
53
+	    (*tls_domains_cfg)->srv_default->ctx[0]) {      \
54 54
 		while((err = ERR_get_error())) {        \
55 55
 			(r) = 1;                        \
56 56
 			ERR("%s%s\n", ((s)) ? (s) : "", \