Browse code

- fixed SRV tls lookup (_sips._tcp.)

Andrei Pelinescu-Onciul authored on 04/07/2003 14:46:40
Showing 2 changed files
... ...
@@ -26,7 +26,8 @@
26 26
  *
27 27
  * History:
28 28
  * --------
29
- * 2003-04-05 DEFAULT_*_URL introduced (jiri)
29
+ * 2003-04-05  DEFAULT_*_URL introduced (jiri)
30
+ * 2003-07-04  fixed SRV lookup prefix for TLS/sips (andrei)
30 31
  */
31 32
 
32 33
 
... ...
@@ -106,8 +107,11 @@
106 106
 
107 107
 #define SRV_UDP_PREFIX "_sip._udp."
108 108
 #define SRV_TCP_PREFIX "_sip._tcp."
109
-#define SRV_TLS_PREFIX "_sip._tls."
110
-#define SRV_PREFIX_LEN 10
109
+#define SRV_TLS_PREFIX "_sips._tcp."
110
+#define SRV_UDP_PREFIX_LEN 10
111
+#define SRV_TCP_PREFIX_LEN 10
112
+#define SRV_TLS_PREFIX_LEN 11
113
+#define SRV_MAX_PREFIX_LEN 11
111 114
 
112 115
 /*used only if PKG_MALLOC is defined*/
113 116
 #define PKG_MEM_POOL_SIZE 1024*1024
... ...
@@ -472,7 +472,7 @@ struct hostent* sip_resolvehost(str* name, unsigned short* port, int proto)
472 472
 	if ((port)&&(*port==0)){
473 473
 		*port=(proto==PROTO_TLS)?SIPS_PORT:SIP_PORT; /* just in case we don't
474 474
 														find another */
475
-		if ((name->len+SRV_PREFIX_LEN+1)>MAX_DNS_NAME){
475
+		if ((name->len+SRV_MAX_PREFIX_LEN+1)>MAX_DNS_NAME){
476 476
 			LOG(L_WARN, "WARNING: sip_resolvehost: domain name too long (%d),"
477 477
 						" unable to perform SRV lookup\n", name->len);
478 478
 		}else{
... ...
@@ -490,19 +490,19 @@ struct hostent* sip_resolvehost(str* name, unsigned short* port, int proto)
490 490
 				case PROTO_NONE: /* no proto specified, use udp */
491 491
 					goto skip_srv;
492 492
 				case PROTO_UDP:
493
-					memcpy(tmp, SRV_UDP_PREFIX, SRV_PREFIX_LEN);
494
-					memcpy(tmp+SRV_PREFIX_LEN, name->s, name->len);
495
-					tmp[SRV_PREFIX_LEN + name->len] = '\0';
493
+					memcpy(tmp, SRV_UDP_PREFIX, SRV_UDP_PREFIX_LEN);
494
+					memcpy(tmp+SRV_UDP_PREFIX_LEN, name->s, name->len);
495
+					tmp[SRV_UDP_PREFIX_LEN + name->len] = '\0';
496 496
 					break;
497 497
 				case PROTO_TCP:
498
-					memcpy(tmp, SRV_TCP_PREFIX, SRV_PREFIX_LEN);
499
-					memcpy(tmp+SRV_PREFIX_LEN, name->s, name->len);
500
-					tmp[SRV_PREFIX_LEN + name->len] = '\0';
498
+					memcpy(tmp, SRV_TCP_PREFIX, SRV_TCP_PREFIX_LEN);
499
+					memcpy(tmp+SRV_TCP_PREFIX_LEN, name->s, name->len);
500
+					tmp[SRV_TCP_PREFIX_LEN + name->len] = '\0';
501 501
 					break;
502 502
 				case PROTO_TLS:
503
-					memcpy(tmp, SRV_TLS_PREFIX, SRV_PREFIX_LEN);
504
-					memcpy(tmp+SRV_PREFIX_LEN, name->s, name->len);
505
-					tmp[SRV_PREFIX_LEN + name->len] = '\0';
503
+					memcpy(tmp, SRV_TLS_PREFIX, SRV_TLS_PREFIX_LEN);
504
+					memcpy(tmp+SRV_TLS_PREFIX_LEN, name->s, name->len);
505
+					tmp[SRV_TLS_PREFIX_LEN + name->len] = '\0';
506 506
 					break;
507 507
 				default:
508 508
 					LOG(L_CRIT, "BUG: sip_resolvehost: unknown proto %d\n",