[PATCH] fix nss_wins.c
Volker Lendecke
Volker.Lendecke at SerNet.DE
Tue Apr 19 15:08:44 UTC 2016
Hi!
Attached find two patches I got send by private mail.
Review appreciated!
Thanks,
Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 4b597ac1194f810e7ca6b56637218abce97fe8e3 Mon Sep 17 00:00:00 2001
From: Tom Mortensen <tomm at lime-technology.com>
Date: Sat, 16 Apr 2016 10:57:12 +0200
Subject: [PATCH 1/2] nss_wins: ip_pton expects the raw IP address
Signed-off-by: Tom Mortensen <tomm at lime-technology.com>
Reviewed-by: Volker Lendecke <vl at samba.org>
---
nsswitch/wins.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/nsswitch/wins.c b/nsswitch/wins.c
index 3243ffb..22524e4 100644
--- a/nsswitch/wins.c
+++ b/nsswitch/wins.c
@@ -47,7 +47,7 @@ NSS_STATUS _nss_wins_gethostbyname2_r(const char *name, int af, struct hostent *
static char *lookup_byname_backend(const char *name)
{
const char *p;
- char *ip;
+ char *ip, *ipp;
size_t nbt_len;
wbcErr result;
@@ -65,6 +65,11 @@ static char *lookup_byname_backend(const char *name)
return NULL;
}
+ ipp = strchr(ip, '\t');
+ if (ipp != NULL) {
+ *ipp = '\0';
+ }
+
return ip;
}
--
2.1.4
From a56a6c70df0c82af15371ab28c0e5de0a26aed91 Mon Sep 17 00:00:00 2001
From: Tom Mortensen <tomm at lime-technology.com>
Date: Sat, 16 Apr 2016 10:57:12 +0200
Subject: [PATCH 2/2] nss_wins: Fix the hostent setup
This can never have been tested....
Signed-off-by: Tom Mortensen <tomm at lime-technology.com>
Reviewed-by: Volker Lendecke <vl at samba.org>
---
nsswitch/wins.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/nsswitch/wins.c b/nsswitch/wins.c
index 22524e4..fc65c03 100644
--- a/nsswitch/wins.c
+++ b/nsswitch/wins.c
@@ -280,7 +280,7 @@ _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he,
}
if ((he->h_addr_list = (char **)get_static(
- &buffer, &buflen, i * sizeof(char *))) == NULL) {
+ &buffer, &buflen, 2 * sizeof(char *))) == NULL) {
nss_status = NSS_STATUS_TRYAGAIN;
goto out;
}
@@ -291,9 +291,9 @@ _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he,
goto out;
}
- memcpy(he->h_addr_list[i], &in, INADDRSZ);
+ memcpy(he->h_addr_list[0], &in, INADDRSZ);
- he->h_addr_list[0] = NULL;
+ he->h_addr_list[1] = NULL;
/* Set h_addr_type and h_length */
--
2.1.4
More information about the samba-technical
mailing list