]> git.pld-linux.org Git - packages/nss_nisplus.git/blob - nss_nisplus-update.patch
- new, now separated from glibc
[packages/nss_nisplus.git] / nss_nisplus-update.patch
1 From a24f66c6511f863902ce12352e57643beb11acb4 Mon Sep 17 00:00:00 2001
2 From: Ruslan Bilovol <rbilovol@cisco.com>
3 Date: Mon, 11 Mar 2019 21:45:41 +0200
4 Subject: [PATCH] Include own copy of mapv4v6addr.h to be independent of used
5  Linux Distribution
6
7 The same change as was done for libnss_nis
8
9 Signed-off-by: Ruslan Bilovol <rbilovol@cisco.com>
10 ---
11  src/Makefile.am     |  3 +-
12  src/mapv4v6addr.h   | 69 +++++++++++++++++++++++++++++++++++++++++++++
13  src/nisplus-hosts.c |  2 +-
14  3 files changed, 72 insertions(+), 2 deletions(-)
15  create mode 100644 src/mapv4v6addr.h
16
17 diff --git a/src/Makefile.am b/src/Makefile.am
18 index 37ef86c..e879d5c 100644
19 --- a/src/Makefile.am
20 +++ b/src/Makefile.am
21 @@ -15,7 +15,8 @@ AM_CPPFLAGS = -I$(srcdir) @TIRPC_CFLAGS@ @LIBNSL_CFLAGS@
22  
23  lib_LTLIBRARIES = libnss_nisplus.la
24  
25 -noinst_HEADERS = libc-lock.h nss-nisplus.h netgroup.h nisplus-parser.h
26 +noinst_HEADERS = libc-lock.h nss-nisplus.h netgroup.h nisplus-parser.h \
27 +                mapv4v6addr.h
28  check_PROGRAMS = nss_loader-test
29  nss_loader_test_LDADD = -ldl
30  
31 diff --git a/src/mapv4v6addr.h b/src/mapv4v6addr.h
32 new file mode 100644
33 index 0000000..7f85f7d
34 --- /dev/null
35 +++ b/src/mapv4v6addr.h
36 @@ -0,0 +1,69 @@
37 +/*
38 + * ++Copyright++ 1985, 1988, 1993
39 + * -
40 + * Copyright (c) 1985, 1988, 1993
41 + *    The Regents of the University of California.  All rights reserved.
42 + *
43 + * Redistribution and use in source and binary forms, with or without
44 + * modification, are permitted provided that the following conditions
45 + * are met:
46 + * 1. Redistributions of source code must retain the above copyright
47 + *    notice, this list of conditions and the following disclaimer.
48 + * 2. Redistributions in binary form must reproduce the above copyright
49 + *    notice, this list of conditions and the following disclaimer in the
50 + *    documentation and/or other materials provided with the distribution.
51 + * 4. Neither the name of the University nor the names of its contributors
52 + *    may be used to endorse or promote products derived from this software
53 + *    without specific prior written permission.
54 + *
55 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
56 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
58 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
59 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
60 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
61 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
62 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
63 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
64 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
65 + * SUCH DAMAGE.
66 + * -
67 + * Portions Copyright (c) 1993 by Digital Equipment Corporation.
68 + *
69 + * Permission to use, copy, modify, and distribute this software for any
70 + * purpose with or without fee is hereby granted, provided that the above
71 + * copyright notice and this permission notice appear in all copies, and that
72 + * the name of Digital Equipment Corporation not be used in advertising or
73 + * publicity pertaining to distribution of the document or software without
74 + * specific, written prior permission.
75 + *
76 + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
77 + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
78 + * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
79 + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
80 + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
81 + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
82 + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
83 + * SOFTWARE.
84 + * -
85 + * --Copyright--
86 + */
87 +
88 +#include <string.h>
89 +#include <arpa/nameser.h>
90 +
91 +static void
92 +map_v4v6_address (const char *src, char *dst)
93 +{
94 +  u_char *p = (u_char *) dst;
95 +  int i;
96 +
97 +  /* Move the IPv4 part to the right position.  */
98 +  memcpy (dst + 12, src, INADDRSZ);
99 +
100 +  /* Mark this ipv6 addr as a mapped ipv4. */
101 +  for (i = 0; i < 10; i++)
102 +    *p++ = 0x00;
103 +  *p++ = 0xff;
104 +  *p = 0xff;
105 +}
106 diff --git a/src/nisplus-hosts.c b/src/nisplus-hosts.c
107 index 6e7eda5..cc00aa2 100644
108 --- a/src/nisplus-hosts.c
109 +++ b/src/nisplus-hosts.c
110 @@ -43,7 +43,7 @@ static u_long tablename_len;
111         (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
112  
113  /* Get implementation for some internal functions. */
114 -#include <resolv/mapv4v6addr.h>
115 +#include "mapv4v6addr.h"
116  
117  
118  static int
119 From 184bda40e05053cd2df61c28bec0baa7353697bb Mon Sep 17 00:00:00 2001
120 From: Khem Raj <raj.khem@gmail.com>
121 Date: Wed, 28 Aug 2019 09:49:10 -0700
122 Subject: [PATCH] nisplus-hosts: Remove use of RES_USE_INET6
123
124 Upstream glibc dropped it starting glibc 2.30
125 see
126 https://sourceware.org/git/?p=glibc.git;a=commit;h=3f8b44be0a658266adff5ece1e4bc3ce097a5dbe
127
128 Signed-off-by: Khem Raj <raj.khem@gmail.com>
129 ---
130  src/Makefile.am     |  3 +-
131  src/mapv4v6addr.h   | 69 ---------------------------------------------
132  src/nisplus-hosts.c | 58 ++++++++-----------------------------
133  3 files changed, 13 insertions(+), 117 deletions(-)
134  delete mode 100644 src/mapv4v6addr.h
135
136 diff --git a/src/Makefile.am b/src/Makefile.am
137 index e879d5c..37ef86c 100644
138 --- a/src/Makefile.am
139 +++ b/src/Makefile.am
140 @@ -15,8 +15,7 @@ AM_CPPFLAGS = -I$(srcdir) @TIRPC_CFLAGS@ @LIBNSL_CFLAGS@
141  
142  lib_LTLIBRARIES = libnss_nisplus.la
143  
144 -noinst_HEADERS = libc-lock.h nss-nisplus.h netgroup.h nisplus-parser.h \
145 -                mapv4v6addr.h
146 +noinst_HEADERS = libc-lock.h nss-nisplus.h netgroup.h nisplus-parser.h
147  check_PROGRAMS = nss_loader-test
148  nss_loader_test_LDADD = -ldl
149  
150 diff --git a/src/mapv4v6addr.h b/src/mapv4v6addr.h
151 deleted file mode 100644
152 index 7f85f7d..0000000
153 --- a/src/mapv4v6addr.h
154 +++ /dev/null
155 @@ -1,69 +0,0 @@
156 -/*
157 - * ++Copyright++ 1985, 1988, 1993
158 - * -
159 - * Copyright (c) 1985, 1988, 1993
160 - *    The Regents of the University of California.  All rights reserved.
161 - *
162 - * Redistribution and use in source and binary forms, with or without
163 - * modification, are permitted provided that the following conditions
164 - * are met:
165 - * 1. Redistributions of source code must retain the above copyright
166 - *    notice, this list of conditions and the following disclaimer.
167 - * 2. Redistributions in binary form must reproduce the above copyright
168 - *    notice, this list of conditions and the following disclaimer in the
169 - *    documentation and/or other materials provided with the distribution.
170 - * 4. Neither the name of the University nor the names of its contributors
171 - *    may be used to endorse or promote products derived from this software
172 - *    without specific prior written permission.
173 - *
174 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
175 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
176 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
177 - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
178 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
179 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
180 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
181 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
182 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
183 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
184 - * SUCH DAMAGE.
185 - * -
186 - * Portions Copyright (c) 1993 by Digital Equipment Corporation.
187 - *
188 - * Permission to use, copy, modify, and distribute this software for any
189 - * purpose with or without fee is hereby granted, provided that the above
190 - * copyright notice and this permission notice appear in all copies, and that
191 - * the name of Digital Equipment Corporation not be used in advertising or
192 - * publicity pertaining to distribution of the document or software without
193 - * specific, written prior permission.
194 - *
195 - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
196 - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
197 - * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
198 - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
199 - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
200 - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
201 - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
202 - * SOFTWARE.
203 - * -
204 - * --Copyright--
205 - */
206 -
207 -#include <string.h>
208 -#include <arpa/nameser.h>
209 -
210 -static void
211 -map_v4v6_address (const char *src, char *dst)
212 -{
213 -  u_char *p = (u_char *) dst;
214 -  int i;
215 -
216 -  /* Move the IPv4 part to the right position.  */
217 -  memcpy (dst + 12, src, INADDRSZ);
218 -
219 -  /* Mark this ipv6 addr as a mapped ipv4. */
220 -  for (i = 0; i < 10; i++)
221 -    *p++ = 0x00;
222 -  *p++ = 0xff;
223 -  *p = 0xff;
224 -}
225 diff --git a/src/nisplus-hosts.c b/src/nisplus-hosts.c
226 index cc00aa2..d37b209 100644
227 --- a/src/nisplus-hosts.c
228 +++ b/src/nisplus-hosts.c
229 @@ -42,14 +42,9 @@ static u_long tablename_len;
230  #define NISENTRYLEN(idx, col, res) \
231         (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
232  
233 -/* Get implementation for some internal functions. */
234 -#include "mapv4v6addr.h"
235 -
236 -
237  static int
238  _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
239 -                           char *buffer, size_t buflen, int *errnop,
240 -                           int flags)
241 +                           char *buffer, size_t buflen, int *errnop)
242  {
243    unsigned int i;
244    char *first_unused = buffer;
245 @@ -66,8 +61,7 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
246  
247    char *data = first_unused;
248  
249 -  if (room_left < (af != AF_INET || (flags & AI_V4MAPPED) != 0
250 -                  ? IN6ADDRSZ : INADDRSZ))
251 +  if (room_left < INADDRSZ)
252      {
253      no_more_room:
254        *errnop = ERANGE;
255 @@ -78,18 +72,8 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
256    if (af != AF_INET6
257        && inet_pton (AF_INET, NISENTRYVAL (0, 2, result), data) > 0)
258      {
259 -      assert ((flags & AI_V4MAPPED) == 0 || af != AF_UNSPEC);
260 -      if (flags & AI_V4MAPPED)
261 -       {
262 -         map_v4v6_address (data, data);
263 -         host->h_addrtype = AF_INET6;
264 -         host->h_length = IN6ADDRSZ;
265 -       }
266 -      else
267 -       {
268 -         host->h_addrtype = AF_INET;
269 -         host->h_length = INADDRSZ;
270 -       }
271 +      host->h_addrtype = AF_INET;
272 +      host->h_length = INADDRSZ;
273      }
274    else if (af != AF_INET
275            && inet_pton (AF_INET6, NISENTRYVAL (0, 2, result), data) > 0)
276 @@ -319,12 +303,8 @@ internal_nisplus_gethostent_r (struct hostent *host, char *buffer,
277             }
278         }
279  
280 -      if (_res.options & RES_USE_INET6)
281 -       parse_res = _nss_nisplus_parse_hostent (result, AF_INET6, host, buffer,
282 -                                               buflen, errnop, AI_V4MAPPED);
283 -      else
284 -       parse_res = _nss_nisplus_parse_hostent (result, AF_INET, host, buffer,
285 -                                               buflen, errnop, 0);
286 +      parse_res = _nss_nisplus_parse_hostent (result, AF_INET, host, buffer,
287 +                                               buflen, errnop);
288  
289        if (parse_res == -1)
290         {
291 @@ -379,7 +359,7 @@ get_tablename (int *herrnop)
292  static enum nss_status
293  internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
294                            char *buffer, size_t buflen, int *errnop,
295 -                          int *herrnop, int flags)
296 +                          int *herrnop)
297  {
298    if (tablename_val == NULL)
299      {
300 @@ -454,7 +434,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
301      }
302  
303    int parse_res = _nss_nisplus_parse_hostent (result, af, host, buffer,
304 -                                             buflen, errnop, flags);
305 +                                             buflen, errnop);
306  
307    nis_freeresult (result);
308  
309 @@ -485,8 +465,7 @@ _nss_nisplus_gethostbyname2_r (const char *name, int af, struct hostent *host,
310      }
311  
312    return internal_gethostbyname2_r (name, af, host, buffer, buflen, errnop,
313 -                                   herrnop,
314 -                        ((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0));
315 +                                   herrnop);
316  }
317  
318  
319 @@ -495,19 +474,8 @@ _nss_nisplus_gethostbyname_r (const char *name, struct hostent *host,
320                               char *buffer, size_t buflen, int *errnop,
321                               int *h_errnop)
322  {
323 -  if (_res.options & RES_USE_INET6)
324 -    {
325 -      enum nss_status status;
326 -
327 -      status = internal_gethostbyname2_r (name, AF_INET6, host, buffer,
328 -                                         buflen, errnop, h_errnop,
329 -                                         AI_V4MAPPED);
330 -      if (status == NSS_STATUS_SUCCESS)
331 -       return status;
332 -    }
333 -
334    return internal_gethostbyname2_r (name, AF_INET, host, buffer,
335 -                                  buflen, errnop, h_errnop, 0);
336 +                                  buflen, errnop, h_errnop);
337  }
338  
339  
340 @@ -555,9 +523,7 @@ _nss_nisplus_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
341      }
342  
343    parse_res = _nss_nisplus_parse_hostent (result, af, host,
344 -                                         buffer, buflen, errnop,
345 -                                         ((_res.options & RES_USE_INET6)
346 -                                          ? AI_V4MAPPED : 0));
347 +                                         buffer, buflen, errnop);
348    nis_freeresult (result);
349  
350    if (parse_res > 0)
351 @@ -584,7 +550,7 @@ _nss_nisplus_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
352  
353    enum nss_status status = internal_gethostbyname2_r (name, AF_UNSPEC, &host,
354                                                       buffer, buflen,
355 -                                                     errnop, herrnop, 0);
356 +                                                     errnop, herrnop);
357    if (status == NSS_STATUS_SUCCESS)
358      {
359        if (*pat == NULL)
This page took 0.110695 seconds and 3 git commands to generate.