sock: do nothing if srv lookup fails

Proper action is performed in xmpp_connect_client.
This commit is contained in:
Dmitry Podgorny
2015-10-12 22:06:27 +03:00
parent 8fcac79301
commit 254b9d73a1

View File

@@ -543,14 +543,17 @@ void netbuf_get_dnsquery_resourcerecord(unsigned char *buf, int buflen, int *off
} }
int sock_srv_lookup(const char *service, const char *proto, const char *domain, char *resulttarget, int resulttargetlength, int *resultport) int sock_srv_lookup(const char *service, const char *proto,
const char *domain, char *resulttarget,
int resulttargetlength, int *resultport)
{ {
int set = 0; int set = 0;
char fulldomain[2048]; char fulldomain[2048];
snprintf(fulldomain, 2048, "_%s._%s.%s", service, proto, domain); snprintf(fulldomain, sizeof(fulldomain),
#ifdef _WIN32 "_%s._%s.%s", service, proto, domain);
#ifdef _WIN32
/* try using dnsapi first */ /* try using dnsapi first */
if (!set) if (!set)
{ {
@@ -908,17 +911,10 @@ int sock_srv_lookup(const char *service, const char *proto, const char *domain,
for (i = 0; i < header.ancount; i++) { for (i = 0; i < header.ancount; i++) {
netbuf_get_dnsquery_resourcerecord(buf, 65536, &offset, &rr); netbuf_get_dnsquery_resourcerecord(buf, 65536, &offset, &rr);
} }
} }
} }
#endif #endif
if (!set) return set;
{
snprintf(resulttarget, resulttargetlength, "%s", domain);
*resultport = 5222;
return 0;
}
return 1;
} }