1 |
unnilennium |
1.1 |
From 119825e3df9b65ea24f28a7faf39b54861d62f0c Mon Sep 17 00:00:00 2001 |
2 |
|
|
From: Andreas Schneider <asn@samba.org> |
3 |
|
|
Date: Mon, 19 Sep 2016 16:21:31 +0200 |
4 |
|
|
Subject: [PATCH] waf: Explicitly link libreplace against libnss_wins.so |
5 |
|
|
|
6 |
|
|
If we do not specify replace as a depencency here, it will not link to |
7 |
|
|
libreplace using an rpath. |
8 |
|
|
|
9 |
|
|
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12277 |
10 |
|
|
|
11 |
|
|
Signed-off-by: Andreas Schneider <asn@samba.org> |
12 |
|
|
Reviewed-by: Jeremy Allison <jra@samba.org> |
13 |
|
|
Reviewed-by: Jim McDonough <jmcd@samba.org> |
14 |
|
|
|
15 |
|
|
(cherry picked from commit d8a5565ae647352d11d622bd4e73ff4568678a7c) |
16 |
|
|
--- |
17 |
|
|
nsswitch/wscript_build | 2 +- |
18 |
|
|
1 file changed, 1 insertion(+), 1 deletion(-) |
19 |
|
|
|
20 |
|
|
diff --git a/nsswitch/wscript_build b/nsswitch/wscript_build |
21 |
|
|
index f286896..ab8f8ea 100644 |
22 |
|
|
--- a/nsswitch/wscript_build |
23 |
|
|
+++ b/nsswitch/wscript_build |
24 |
|
|
@@ -42,7 +42,7 @@ if (Utils.unversioned_sys_platform() == 'linux' or (host_os.rfind('gnu') > -1)): |
25 |
|
|
bld.SAMBA3_LIBRARY('nss_wins', |
26 |
|
|
keep_underscore=True, |
27 |
|
|
source='wins.c', |
28 |
|
|
- deps='''wbclient''', |
29 |
|
|
+ deps='wbclient replace', |
30 |
|
|
public_headers=[], |
31 |
|
|
public_headers_install=False, |
32 |
|
|
pc_files=[], |
33 |
|
|
-- |
34 |
|
|
2.10.0 |
35 |
|
|
|
36 |
|
|
From 33bc85d9060340e4ce3d2edecb3fb76dd85a5195 Mon Sep 17 00:00:00 2001 |
37 |
|
|
From: Andreas Schneider <asn@samba.org> |
38 |
|
|
Date: Mon, 19 Sep 2016 16:17:11 +0200 |
39 |
|
|
Subject: [PATCH 1/2] nsswitch: Add missing arguments to wins gethostbyname* |
40 |
|
|
|
41 |
|
|
The errno pointer argument is missing. |
42 |
|
|
|
43 |
|
|
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12269 |
44 |
|
|
|
45 |
|
|
Signed-off-by: Andreas Schneider <asn@samba.org> |
46 |
|
|
Reviewed-by: Jeremy Allison <jra@samba.org> |
47 |
|
|
Reviewed-by: Jim McDonough <jmcd@samba.org> |
48 |
|
|
(cherry picked from commit 124ae4e861f048fe015bff32ace4abff4d3e6c62) |
49 |
|
|
--- |
50 |
|
|
nsswitch/wins.c | 51 +++++++++++++++++++++++++++++++++++++++++---------- |
51 |
|
|
1 file changed, 41 insertions(+), 10 deletions(-) |
52 |
|
|
|
53 |
|
|
diff --git a/nsswitch/wins.c b/nsswitch/wins.c |
54 |
|
|
index fc65c03..be84f2e 100644 |
55 |
|
|
--- a/nsswitch/wins.c |
56 |
|
|
+++ b/nsswitch/wins.c |
57 |
|
|
@@ -39,10 +39,19 @@ static pthread_mutex_t wins_nss_mutex = PTHREAD_MUTEX_INITIALIZER; |
58 |
|
|
#define INADDRSZ 4 |
59 |
|
|
#endif |
60 |
|
|
|
61 |
|
|
-NSS_STATUS _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he, |
62 |
|
|
- char *buffer, size_t buflen, int *h_errnop); |
63 |
|
|
-NSS_STATUS _nss_wins_gethostbyname2_r(const char *name, int af, struct hostent *he, |
64 |
|
|
- char *buffer, size_t buflen, int *h_errnop); |
65 |
|
|
+NSS_STATUS _nss_wins_gethostbyname_r(const char *hostname, |
66 |
|
|
+ struct hostent *he, |
67 |
|
|
+ char *buffer, |
68 |
|
|
+ size_t buflen, |
69 |
|
|
+ int *errnop, |
70 |
|
|
+ int *h_errnop); |
71 |
|
|
+NSS_STATUS _nss_wins_gethostbyname2_r(const char *name, |
72 |
|
|
+ int af, |
73 |
|
|
+ struct hostent *he, |
74 |
|
|
+ char *buffer, |
75 |
|
|
+ size_t buflen, |
76 |
|
|
+ int *errnop, |
77 |
|
|
+ int *h_errnop); |
78 |
|
|
|
79 |
|
|
static char *lookup_byname_backend(const char *name) |
80 |
|
|
{ |
81 |
|
|
@@ -225,8 +234,12 @@ gethostbyname() - we ignore any domain portion of the name and only |
82 |
|
|
handle names that are at most 15 characters long |
83 |
|
|
**************************************************************************/ |
84 |
|
|
NSS_STATUS |
85 |
|
|
-_nss_wins_gethostbyname_r(const char *hostname, struct hostent *he, |
86 |
|
|
- char *buffer, size_t buflen, int *h_errnop) |
87 |
|
|
+_nss_wins_gethostbyname_r(const char *hostname, |
88 |
|
|
+ struct hostent *he, |
89 |
|
|
+ char *buffer, |
90 |
|
|
+ size_t buflen, |
91 |
|
|
+ int *errnop, |
92 |
|
|
+ int *h_errnop) |
93 |
|
|
{ |
94 |
|
|
NSS_STATUS nss_status = NSS_STATUS_SUCCESS; |
95 |
|
|
char *ip; |
96 |
|
|
@@ -247,6 +260,7 @@ _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he, |
97 |
|
|
|
98 |
|
|
ip = lookup_byname_backend(name); |
99 |
|
|
if (ip == NULL) { |
100 |
|
|
+ *errnop = EINVAL; |
101 |
|
|
nss_status = NSS_STATUS_NOTFOUND; |
102 |
|
|
goto out; |
103 |
|
|
} |
104 |
|
|
@@ -254,6 +268,7 @@ _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he, |
105 |
|
|
rc = inet_pton(AF_INET, ip, &in); |
106 |
|
|
wbcFreeMemory(ip); |
107 |
|
|
if (rc == 0) { |
108 |
|
|
+ *errnop = errno; |
109 |
|
|
nss_status = NSS_STATUS_TRYAGAIN; |
110 |
|
|
goto out; |
111 |
|
|
} |
112 |
|
|
@@ -263,6 +278,7 @@ _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he, |
113 |
|
|
namelen = strlen(name) + 1; |
114 |
|
|
|
115 |
|
|
if ((he->h_name = get_static(&buffer, &buflen, namelen)) == NULL) { |
116 |
|
|
+ *errnop = EAGAIN; |
117 |
|
|
nss_status = NSS_STATUS_TRYAGAIN; |
118 |
|
|
goto out; |
119 |
|
|
} |
120 |
|
|
@@ -275,18 +291,21 @@ _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he, |
121 |
|
|
i = sizeof(char*) - i; |
122 |
|
|
|
123 |
|
|
if (get_static(&buffer, &buflen, i) == NULL) { |
124 |
|
|
+ *errnop = EAGAIN; |
125 |
|
|
nss_status = NSS_STATUS_TRYAGAIN; |
126 |
|
|
goto out; |
127 |
|
|
} |
128 |
|
|
|
129 |
|
|
if ((he->h_addr_list = (char **)get_static( |
130 |
|
|
&buffer, &buflen, 2 * sizeof(char *))) == NULL) { |
131 |
|
|
+ *errnop = EAGAIN; |
132 |
|
|
nss_status = NSS_STATUS_TRYAGAIN; |
133 |
|
|
goto out; |
134 |
|
|
} |
135 |
|
|
|
136 |
|
|
if ((he->h_addr_list[0] = get_static(&buffer, &buflen, |
137 |
|
|
INADDRSZ)) == NULL) { |
138 |
|
|
+ *errnop = EAGAIN; |
139 |
|
|
nss_status = NSS_STATUS_TRYAGAIN; |
140 |
|
|
goto out; |
141 |
|
|
} |
142 |
|
|
@@ -306,12 +325,14 @@ _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he, |
143 |
|
|
i = sizeof(char*) - i; |
144 |
|
|
|
145 |
|
|
if (get_static(&buffer, &buflen, i) == NULL) { |
146 |
|
|
+ *errnop = EAGAIN; |
147 |
|
|
nss_status = NSS_STATUS_TRYAGAIN; |
148 |
|
|
goto out; |
149 |
|
|
} |
150 |
|
|
|
151 |
|
|
if ((he->h_aliases = (char **)get_static( |
152 |
|
|
&buffer, &buflen, sizeof(char *))) == NULL) { |
153 |
|
|
+ *errnop = EAGAIN; |
154 |
|
|
nss_status = NSS_STATUS_TRYAGAIN; |
155 |
|
|
goto out; |
156 |
|
|
} |
157 |
|
|
@@ -330,17 +351,27 @@ _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he, |
158 |
|
|
|
159 |
|
|
|
160 |
|
|
NSS_STATUS |
161 |
|
|
-_nss_wins_gethostbyname2_r(const char *name, int af, struct hostent *he, |
162 |
|
|
- char *buffer, size_t buflen, int *h_errnop) |
163 |
|
|
+_nss_wins_gethostbyname2_r(const char *name, |
164 |
|
|
+ int af, |
165 |
|
|
+ struct hostent *he, |
166 |
|
|
+ char *buffer, |
167 |
|
|
+ size_t buflen, |
168 |
|
|
+ int *errnop, |
169 |
|
|
+ int *h_errnop) |
170 |
|
|
{ |
171 |
|
|
NSS_STATUS nss_status; |
172 |
|
|
|
173 |
|
|
if(af!=AF_INET) { |
174 |
|
|
+ *errnop = EAFNOSUPPORT; |
175 |
|
|
*h_errnop = NO_DATA; |
176 |
|
|
nss_status = NSS_STATUS_UNAVAIL; |
177 |
|
|
} else { |
178 |
|
|
- nss_status = _nss_wins_gethostbyname_r( |
179 |
|
|
- name, he, buffer, buflen, h_errnop); |
180 |
|
|
+ nss_status = _nss_wins_gethostbyname_r(name, |
181 |
|
|
+ he, |
182 |
|
|
+ buffer, |
183 |
|
|
+ buflen, |
184 |
|
|
+ errnop, |
185 |
|
|
+ h_errnop); |
186 |
|
|
} |
187 |
|
|
return nss_status; |
188 |
|
|
} |
189 |
|
|
-- |
190 |
|
|
2.10.0 |
191 |
|
|
|
192 |
|
|
|
193 |
|
|
From b8d9c7b69509555f40335a0dd7b93ef032354b0d Mon Sep 17 00:00:00 2001 |
194 |
|
|
From: Andreas Schneider <asn@samba.org> |
195 |
|
|
Date: Tue, 20 Sep 2016 13:26:52 +0200 |
196 |
|
|
Subject: [PATCH 2/2] nsswitch: Also set h_errnop for nss_wins functions |
197 |
|
|
|
198 |
|
|
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12269 |
199 |
|
|
|
200 |
|
|
Signed-off-by: Andreas Schneider <asn@samba.org> |
201 |
|
|
Reviewed-by: Jim McDonough <jmcd@samba.org> |
202 |
|
|
|
203 |
|
|
(cherry picked from commit 382345126c56e26d3dbc319f1c7c1dae3c4fafc9) |
204 |
|
|
--- |
205 |
|
|
nsswitch/wins.c | 9 +++++++++ |
206 |
|
|
1 file changed, 9 insertions(+) |
207 |
|
|
|
208 |
|
|
diff --git a/nsswitch/wins.c b/nsswitch/wins.c |
209 |
|
|
index be84f2e..dccb6dd 100644 |
210 |
|
|
--- a/nsswitch/wins.c |
211 |
|
|
+++ b/nsswitch/wins.c |
212 |
|
|
@@ -261,6 +261,7 @@ _nss_wins_gethostbyname_r(const char *hostname, |
213 |
|
|
ip = lookup_byname_backend(name); |
214 |
|
|
if (ip == NULL) { |
215 |
|
|
*errnop = EINVAL; |
216 |
|
|
+ *h_errnop = NETDB_INTERNAL; |
217 |
|
|
nss_status = NSS_STATUS_NOTFOUND; |
218 |
|
|
goto out; |
219 |
|
|
} |
220 |
|
|
@@ -269,6 +270,7 @@ _nss_wins_gethostbyname_r(const char *hostname, |
221 |
|
|
wbcFreeMemory(ip); |
222 |
|
|
if (rc == 0) { |
223 |
|
|
*errnop = errno; |
224 |
|
|
+ *h_errnop = NETDB_INTERNAL; |
225 |
|
|
nss_status = NSS_STATUS_TRYAGAIN; |
226 |
|
|
goto out; |
227 |
|
|
} |
228 |
|
|
@@ -279,6 +281,7 @@ _nss_wins_gethostbyname_r(const char *hostname, |
229 |
|
|
|
230 |
|
|
if ((he->h_name = get_static(&buffer, &buflen, namelen)) == NULL) { |
231 |
|
|
*errnop = EAGAIN; |
232 |
|
|
+ *h_errnop = NETDB_INTERNAL; |
233 |
|
|
nss_status = NSS_STATUS_TRYAGAIN; |
234 |
|
|
goto out; |
235 |
|
|
} |
236 |
|
|
@@ -292,6 +295,7 @@ _nss_wins_gethostbyname_r(const char *hostname, |
237 |
|
|
|
238 |
|
|
if (get_static(&buffer, &buflen, i) == NULL) { |
239 |
|
|
*errnop = EAGAIN; |
240 |
|
|
+ *h_errnop = NETDB_INTERNAL; |
241 |
|
|
nss_status = NSS_STATUS_TRYAGAIN; |
242 |
|
|
goto out; |
243 |
|
|
} |
244 |
|
|
@@ -299,6 +303,7 @@ _nss_wins_gethostbyname_r(const char *hostname, |
245 |
|
|
if ((he->h_addr_list = (char **)get_static( |
246 |
|
|
&buffer, &buflen, 2 * sizeof(char *))) == NULL) { |
247 |
|
|
*errnop = EAGAIN; |
248 |
|
|
+ *h_errnop = NETDB_INTERNAL; |
249 |
|
|
nss_status = NSS_STATUS_TRYAGAIN; |
250 |
|
|
goto out; |
251 |
|
|
} |
252 |
|
|
@@ -306,6 +311,7 @@ _nss_wins_gethostbyname_r(const char *hostname, |
253 |
|
|
if ((he->h_addr_list[0] = get_static(&buffer, &buflen, |
254 |
|
|
INADDRSZ)) == NULL) { |
255 |
|
|
*errnop = EAGAIN; |
256 |
|
|
+ *h_errnop = NETDB_INTERNAL; |
257 |
|
|
nss_status = NSS_STATUS_TRYAGAIN; |
258 |
|
|
goto out; |
259 |
|
|
} |
260 |
|
|
@@ -326,6 +332,7 @@ _nss_wins_gethostbyname_r(const char *hostname, |
261 |
|
|
|
262 |
|
|
if (get_static(&buffer, &buflen, i) == NULL) { |
263 |
|
|
*errnop = EAGAIN; |
264 |
|
|
+ *h_errnop = NETDB_INTERNAL; |
265 |
|
|
nss_status = NSS_STATUS_TRYAGAIN; |
266 |
|
|
goto out; |
267 |
|
|
} |
268 |
|
|
@@ -333,12 +340,14 @@ _nss_wins_gethostbyname_r(const char *hostname, |
269 |
|
|
if ((he->h_aliases = (char **)get_static( |
270 |
|
|
&buffer, &buflen, sizeof(char *))) == NULL) { |
271 |
|
|
*errnop = EAGAIN; |
272 |
|
|
+ *h_errnop = NETDB_INTERNAL; |
273 |
|
|
nss_status = NSS_STATUS_TRYAGAIN; |
274 |
|
|
goto out; |
275 |
|
|
} |
276 |
|
|
|
277 |
|
|
he->h_aliases[0] = NULL; |
278 |
|
|
|
279 |
|
|
+ *h_errnop = NETDB_SUCCESS; |
280 |
|
|
nss_status = NSS_STATUS_SUCCESS; |
281 |
|
|
|
282 |
|
|
out: |
283 |
|
|
-- |
284 |
|
|
2.10.0 |
285 |
|
|
|
286 |
|
|
From c91544eb234af9a13ab08f2b1e31d2915965985b Mon Sep 17 00:00:00 2001 |
287 |
|
|
From: Andreas Schneider <asn@samba.org> |
288 |
|
|
Date: Sun, 13 Nov 2016 17:40:21 +0100 |
289 |
|
|
Subject: [PATCH] nss_wins: Fix errno values for HOST_NOT_FOUND |
290 |
|
|
|
291 |
|
|
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12269 |
292 |
|
|
|
293 |
|
|
Signed-off-by: Andreas Schneider <asn@samba.org> |
294 |
|
|
--- |
295 |
|
|
nsswitch/wins.c | 3 +-- |
296 |
|
|
1 file changed, 1 insertion(+), 2 deletions(-) |
297 |
|
|
|
298 |
|
|
diff --git a/nsswitch/wins.c b/nsswitch/wins.c |
299 |
|
|
index dccb6dd..19d3c5b 100644 |
300 |
|
|
--- a/nsswitch/wins.c |
301 |
|
|
+++ b/nsswitch/wins.c |
302 |
|
|
@@ -260,8 +260,7 @@ _nss_wins_gethostbyname_r(const char *hostname, |
303 |
|
|
|
304 |
|
|
ip = lookup_byname_backend(name); |
305 |
|
|
if (ip == NULL) { |
306 |
|
|
- *errnop = EINVAL; |
307 |
|
|
- *h_errnop = NETDB_INTERNAL; |
308 |
|
|
+ *h_errnop = HOST_NOT_FOUND; |
309 |
|
|
nss_status = NSS_STATUS_NOTFOUND; |
310 |
|
|
goto out; |
311 |
|
|
} |
312 |
|
|
-- |
313 |
|
|
2.10.2 |
314 |
|
|
|