summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/roken/roken_gethostby.c
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2010-08-15 18:31:28 +0400
committerAndrew Bartlett <abartlet@samba.org>2010-10-03 01:15:04 +0000
commitab6e3fce040f9ad27cbce44e9038a24f15b601c8 (patch)
treeab99a431c9610927b5d0d26335d2712b509fd6dc /source4/heimdal/lib/roken/roken_gethostby.c
parent197a1514d62494cc8b862d169c841a26e04b8925 (diff)
downloadsamba-ab6e3fce040f9ad27cbce44e9038a24f15b601c8.tar.gz
samba-ab6e3fce040f9ad27cbce44e9038a24f15b601c8.tar.bz2
samba-ab6e3fce040f9ad27cbce44e9038a24f15b601c8.zip
s4:heimdal: import lorikeet-heimdal-201009250123 (commit 42cabfb5b683dbcb97d583c397b897507689e382)
I based this on Matthieu's import of lorikeet-heimdal, and then updated it to this commit. Andrew Bartlett
Diffstat (limited to 'source4/heimdal/lib/roken/roken_gethostby.c')
-rw-r--r--source4/heimdal/lib/roken/roken_gethostby.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source4/heimdal/lib/roken/roken_gethostby.c b/source4/heimdal/lib/roken/roken_gethostby.c
index c99596c536..1d6c8ffe8a 100644
--- a/source4/heimdal/lib/roken/roken_gethostby.c
+++ b/source4/heimdal/lib/roken/roken_gethostby.c
@@ -66,11 +66,13 @@ setup_int(const char *proxy_host, short proxy_port,
memset(&dns_addr, 0, sizeof(dns_addr));
if(dns_req)
free(dns_req);
+ dns_req = NULL;
if(proxy_host) {
if(make_address(proxy_host, &dns_addr.sin_addr) != 0)
return -1;
dns_addr.sin_port = htons(proxy_port);
- asprintf(&dns_req, "http://%s:%d%s", dns_host, dns_port, dns_path);
+ if (asprintf(&dns_req, "http://%s:%d%s", dns_host, dns_port, dns_path) < 0)
+ return -1;
} else {
if(make_address(dns_host, &dns_addr.sin_addr) != 0)
return -1;
@@ -135,7 +137,7 @@ roken_gethostby(const char *hostname)
{
int s;
struct sockaddr_in addr;
- char *request;
+ char *request = NULL;
char buf[1024];
int offset = 0;
int n;
@@ -144,7 +146,8 @@ roken_gethostby(const char *hostname)
if(dns_addr.sin_family == 0)
return NULL; /* no configured host */
addr = dns_addr;
- asprintf(&request, "GET %s?%s HTTP/1.0\r\n\r\n", dns_req, hostname);
+ if (asprintf(&request, "GET %s?%s HTTP/1.0\r\n\r\n", dns_req, hostname) < 0)
+ return NULL;
if(request == NULL)
return NULL;
s = socket(AF_INET, SOCK_STREAM, 0);