Browse code

- check_self matches TLS connections.

Jan Janak authored on 20/08/2003 12:58:06
Showing 2 changed files
... ...
@@ -233,27 +233,36 @@ int check_self(str* host, unsigned short port)
233 233
 					host->len, host->s,
234 234
 					sock_info[r].name.len, sock_info[r].name.s
235 235
 			);
236
-		if  ((port)&&(sock_info[r].port_no!=port)) continue;
236
+		if (port) {
237
+			DBG("check_self - checking if port %d matches port %d\n", sock_info[r].port_no, port);
238
+#ifdef USE_TLS
239
+			if  ((sock_info[r].port_no!=port) && (tls_info[r].port_no!=port)) {
240
+#else
241
+			if (sock_info[r].port_no!=port) {
242
+#endif
243
+				continue;
244
+			}
245
+		}
237 246
 		if ( (host->len==sock_info[r].name.len) && 
238
-	#ifdef USE_IPV6
247
+#ifdef USE_IPV6
239 248
 			(strncasecmp(host->s, sock_info[r].name.s,
240
-								 sock_info[r].name.len)==0) /*slower*/
241
-	#else
249
+				     sock_info[r].name.len)==0) /*slower*/
250
+#else
242 251
 			(memcmp(host->s, sock_info[r].name.s, 
243
-								sock_info[r].name.len)==0)
244
-	#endif
252
+				sock_info[r].name.len)==0)
253
+#endif
245 254
 			)
246 255
 			break;
247 256
 	/* check if host == ip address */
248 257
 		if ( 	(!sock_info[r].is_ip) &&
249 258
 				(host->len==sock_info[r].address_str.len) && 
250
-	#ifdef USE_IPV6
259
+#ifdef USE_IPV6
251 260
 			(strncasecmp(host->s, sock_info[r].address_str.s,
252 261
 								 sock_info[r].address_str.len)==0) /*slower*/
253
-	#else
262
+#else
254 263
 			(memcmp(host->s, sock_info[r].address_str.s, 
255 264
 								sock_info[r].address_str.len)==0)
256
-	#endif
265
+#endif
257 266
 			)
258 267
 			break;
259 268
 	}
... ...
@@ -56,7 +56,11 @@ static inline int grep_aliases(char* name, int len, unsigned short port)
56 56
 	struct  host_alias* a;
57 57
 	
58 58
 	for(a=aliases;a;a=a->next)
59
+#ifdef USE_TLS
60
+		if ((a->alias.len==len) && ((a->port==0) || (port==0) || (port==tls_port_no) ||
61
+#else
59 62
 		if ((a->alias.len==len) && ((a->port==0) || (port==0) || 
63
+#endif
60 64
 				(a->port==port)) && (strncasecmp(a->alias.s, name, len)==0))
61 65
 			return 1;
62 66
 	return 0;