From 7f148e725b0809b612173a0e022f63422adaaa2a Mon Sep 17 00:00:00 2001 From: Jakub Bogusz Date: Wed, 19 Aug 2020 21:05:11 +0200 Subject: [PATCH] - new, now separated from glibc - added update patch (updates from git, required to build with glibc 2.31+) - epoch 7 to allow transition from glibc version (6:2.x) --- nss_nisplus-update.patch | 359 +++++++++++++++++++++++++++++++++++++++ nss_nisplus.spec | 76 +++++++++ 2 files changed, 435 insertions(+) create mode 100644 nss_nisplus-update.patch create mode 100644 nss_nisplus.spec diff --git a/nss_nisplus-update.patch b/nss_nisplus-update.patch new file mode 100644 index 0000000..9ebb576 --- /dev/null +++ b/nss_nisplus-update.patch @@ -0,0 +1,359 @@ +From a24f66c6511f863902ce12352e57643beb11acb4 Mon Sep 17 00:00:00 2001 +From: Ruslan Bilovol +Date: Mon, 11 Mar 2019 21:45:41 +0200 +Subject: [PATCH] Include own copy of mapv4v6addr.h to be independent of used + Linux Distribution + +The same change as was done for libnss_nis + +Signed-off-by: Ruslan Bilovol +--- + src/Makefile.am | 3 +- + src/mapv4v6addr.h | 69 +++++++++++++++++++++++++++++++++++++++++++++ + src/nisplus-hosts.c | 2 +- + 3 files changed, 72 insertions(+), 2 deletions(-) + create mode 100644 src/mapv4v6addr.h + +diff --git a/src/Makefile.am b/src/Makefile.am +index 37ef86c..e879d5c 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -15,7 +15,8 @@ AM_CPPFLAGS = -I$(srcdir) @TIRPC_CFLAGS@ @LIBNSL_CFLAGS@ + + lib_LTLIBRARIES = libnss_nisplus.la + +-noinst_HEADERS = libc-lock.h nss-nisplus.h netgroup.h nisplus-parser.h ++noinst_HEADERS = libc-lock.h nss-nisplus.h netgroup.h nisplus-parser.h \ ++ mapv4v6addr.h + check_PROGRAMS = nss_loader-test + nss_loader_test_LDADD = -ldl + +diff --git a/src/mapv4v6addr.h b/src/mapv4v6addr.h +new file mode 100644 +index 0000000..7f85f7d +--- /dev/null ++++ b/src/mapv4v6addr.h +@@ -0,0 +1,69 @@ ++/* ++ * ++Copyright++ 1985, 1988, 1993 ++ * - ++ * Copyright (c) 1985, 1988, 1993 ++ * The Regents of the University of California. All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 4. Neither the name of the University nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ * - ++ * Portions Copyright (c) 1993 by Digital Equipment Corporation. ++ * ++ * Permission to use, copy, modify, and distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies, and that ++ * the name of Digital Equipment Corporation not be used in advertising or ++ * publicity pertaining to distribution of the document or software without ++ * specific, written prior permission. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL ++ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES ++ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT ++ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL ++ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR ++ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ++ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ++ * SOFTWARE. ++ * - ++ * --Copyright-- ++ */ ++ ++#include ++#include ++ ++static void ++map_v4v6_address (const char *src, char *dst) ++{ ++ u_char *p = (u_char *) dst; ++ int i; ++ ++ /* Move the IPv4 part to the right position. */ ++ memcpy (dst + 12, src, INADDRSZ); ++ ++ /* Mark this ipv6 addr as a mapped ipv4. */ ++ for (i = 0; i < 10; i++) ++ *p++ = 0x00; ++ *p++ = 0xff; ++ *p = 0xff; ++} +diff --git a/src/nisplus-hosts.c b/src/nisplus-hosts.c +index 6e7eda5..cc00aa2 100644 +--- a/src/nisplus-hosts.c ++++ b/src/nisplus-hosts.c +@@ -43,7 +43,7 @@ static u_long tablename_len; + (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len) + + /* Get implementation for some internal functions. */ +-#include ++#include "mapv4v6addr.h" + + + static int +From 184bda40e05053cd2df61c28bec0baa7353697bb Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 28 Aug 2019 09:49:10 -0700 +Subject: [PATCH] nisplus-hosts: Remove use of RES_USE_INET6 + +Upstream glibc dropped it starting glibc 2.30 +see +https://sourceware.org/git/?p=glibc.git;a=commit;h=3f8b44be0a658266adff5ece1e4bc3ce097a5dbe + +Signed-off-by: Khem Raj +--- + src/Makefile.am | 3 +- + src/mapv4v6addr.h | 69 --------------------------------------------- + src/nisplus-hosts.c | 58 ++++++++----------------------------- + 3 files changed, 13 insertions(+), 117 deletions(-) + delete mode 100644 src/mapv4v6addr.h + +diff --git a/src/Makefile.am b/src/Makefile.am +index e879d5c..37ef86c 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -15,8 +15,7 @@ AM_CPPFLAGS = -I$(srcdir) @TIRPC_CFLAGS@ @LIBNSL_CFLAGS@ + + lib_LTLIBRARIES = libnss_nisplus.la + +-noinst_HEADERS = libc-lock.h nss-nisplus.h netgroup.h nisplus-parser.h \ +- mapv4v6addr.h ++noinst_HEADERS = libc-lock.h nss-nisplus.h netgroup.h nisplus-parser.h + check_PROGRAMS = nss_loader-test + nss_loader_test_LDADD = -ldl + +diff --git a/src/mapv4v6addr.h b/src/mapv4v6addr.h +deleted file mode 100644 +index 7f85f7d..0000000 +--- a/src/mapv4v6addr.h ++++ /dev/null +@@ -1,69 +0,0 @@ +-/* +- * ++Copyright++ 1985, 1988, 1993 +- * - +- * Copyright (c) 1985, 1988, 1993 +- * The Regents of the University of California. All rights reserved. +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions +- * are met: +- * 1. Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimer. +- * 2. Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * 4. Neither the name of the University nor the names of its contributors +- * may be used to endorse or promote products derived from this software +- * without specific prior written permission. +- * +- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +- * SUCH DAMAGE. +- * - +- * Portions Copyright (c) 1993 by Digital Equipment Corporation. +- * +- * Permission to use, copy, modify, and distribute this software for any +- * purpose with or without fee is hereby granted, provided that the above +- * copyright notice and this permission notice appear in all copies, and that +- * the name of Digital Equipment Corporation not be used in advertising or +- * publicity pertaining to distribution of the document or software without +- * specific, written prior permission. +- * +- * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL +- * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES +- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT +- * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +- * SOFTWARE. +- * - +- * --Copyright-- +- */ +- +-#include +-#include +- +-static void +-map_v4v6_address (const char *src, char *dst) +-{ +- u_char *p = (u_char *) dst; +- int i; +- +- /* Move the IPv4 part to the right position. */ +- memcpy (dst + 12, src, INADDRSZ); +- +- /* Mark this ipv6 addr as a mapped ipv4. */ +- for (i = 0; i < 10; i++) +- *p++ = 0x00; +- *p++ = 0xff; +- *p = 0xff; +-} +diff --git a/src/nisplus-hosts.c b/src/nisplus-hosts.c +index cc00aa2..d37b209 100644 +--- a/src/nisplus-hosts.c ++++ b/src/nisplus-hosts.c +@@ -42,14 +42,9 @@ static u_long tablename_len; + #define NISENTRYLEN(idx, col, res) \ + (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len) + +-/* Get implementation for some internal functions. */ +-#include "mapv4v6addr.h" +- +- + static int + _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host, +- char *buffer, size_t buflen, int *errnop, +- int flags) ++ char *buffer, size_t buflen, int *errnop) + { + unsigned int i; + char *first_unused = buffer; +@@ -66,8 +61,7 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host, + + char *data = first_unused; + +- if (room_left < (af != AF_INET || (flags & AI_V4MAPPED) != 0 +- ? IN6ADDRSZ : INADDRSZ)) ++ if (room_left < INADDRSZ) + { + no_more_room: + *errnop = ERANGE; +@@ -78,18 +72,8 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host, + if (af != AF_INET6 + && inet_pton (AF_INET, NISENTRYVAL (0, 2, result), data) > 0) + { +- assert ((flags & AI_V4MAPPED) == 0 || af != AF_UNSPEC); +- if (flags & AI_V4MAPPED) +- { +- map_v4v6_address (data, data); +- host->h_addrtype = AF_INET6; +- host->h_length = IN6ADDRSZ; +- } +- else +- { +- host->h_addrtype = AF_INET; +- host->h_length = INADDRSZ; +- } ++ host->h_addrtype = AF_INET; ++ host->h_length = INADDRSZ; + } + else if (af != AF_INET + && inet_pton (AF_INET6, NISENTRYVAL (0, 2, result), data) > 0) +@@ -319,12 +303,8 @@ internal_nisplus_gethostent_r (struct hostent *host, char *buffer, + } + } + +- if (_res.options & RES_USE_INET6) +- parse_res = _nss_nisplus_parse_hostent (result, AF_INET6, host, buffer, +- buflen, errnop, AI_V4MAPPED); +- else +- parse_res = _nss_nisplus_parse_hostent (result, AF_INET, host, buffer, +- buflen, errnop, 0); ++ parse_res = _nss_nisplus_parse_hostent (result, AF_INET, host, buffer, ++ buflen, errnop); + + if (parse_res == -1) + { +@@ -379,7 +359,7 @@ get_tablename (int *herrnop) + static enum nss_status + internal_gethostbyname2_r (const char *name, int af, struct hostent *host, + char *buffer, size_t buflen, int *errnop, +- int *herrnop, int flags) ++ int *herrnop) + { + if (tablename_val == NULL) + { +@@ -454,7 +434,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host, + } + + int parse_res = _nss_nisplus_parse_hostent (result, af, host, buffer, +- buflen, errnop, flags); ++ buflen, errnop); + + nis_freeresult (result); + +@@ -485,8 +465,7 @@ _nss_nisplus_gethostbyname2_r (const char *name, int af, struct hostent *host, + } + + return internal_gethostbyname2_r (name, af, host, buffer, buflen, errnop, +- herrnop, +- ((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0)); ++ herrnop); + } + + +@@ -495,19 +474,8 @@ _nss_nisplus_gethostbyname_r (const char *name, struct hostent *host, + char *buffer, size_t buflen, int *errnop, + int *h_errnop) + { +- if (_res.options & RES_USE_INET6) +- { +- enum nss_status status; +- +- status = internal_gethostbyname2_r (name, AF_INET6, host, buffer, +- buflen, errnop, h_errnop, +- AI_V4MAPPED); +- if (status == NSS_STATUS_SUCCESS) +- return status; +- } +- + return internal_gethostbyname2_r (name, AF_INET, host, buffer, +- buflen, errnop, h_errnop, 0); ++ buflen, errnop, h_errnop); + } + + +@@ -555,9 +523,7 @@ _nss_nisplus_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af, + } + + parse_res = _nss_nisplus_parse_hostent (result, af, host, +- buffer, buflen, errnop, +- ((_res.options & RES_USE_INET6) +- ? AI_V4MAPPED : 0)); ++ buffer, buflen, errnop); + nis_freeresult (result); + + if (parse_res > 0) +@@ -584,7 +550,7 @@ _nss_nisplus_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, + + enum nss_status status = internal_gethostbyname2_r (name, AF_UNSPEC, &host, + buffer, buflen, +- errnop, herrnop, 0); ++ errnop, herrnop); + if (status == NSS_STATUS_SUCCESS) + { + if (*pat == NULL) diff --git a/nss_nisplus.spec b/nss_nisplus.spec new file mode 100644 index 0000000..46fc6f8 --- /dev/null +++ b/nss_nisplus.spec @@ -0,0 +1,76 @@ +Summary: NIS+ NSS glibc module (DEPRECATED) +Summary(es.UTF-8): Módulo NIS+ NSS de glibc +Summary(pl.UTF-8): Moduł glibc NSS NIS+ (PRZESTARZAŁY) +Name: nss_nisplus +Version: 1.3 +Release: 1 +Epoch: 7 +License: LGPL v2.1+ +Group: Base +#Source0Download: https://github.com/thkukuk/libnss_nisplus/releases +Source0: https://github.com/thkukuk/libnss_nisplus/archive/libnss_nisplus-%{version}.tar.gz +# Source0-md5: 8e86cde0cb0abcd1387fd24aa8421698 +Patch0: %{name}-update.patch +URL: https://github.com/thkukuk/libnss_nisplus +BuildRequires: autoconf >= 2.50 +BuildRequires: automake >= 1:1.9 +BuildRequires: libnsl-devel +BuildRequires: libtirpc-devel +BuildRequires: libtool >= 2:2 +BuildRequires: pkgconfig +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +%description +glibc NSS (Name Service Switch) module for NIS+ databases access. + +This code was formerly part of glibc, but is now standalone to be able +to link against TI-RPC for IPv6 support. + +Note: the NIS+ stuff is deprecated and shouldn't be used anymore. + +%description -l es.UTF-8 +Módulo NSS de glibc para acceder las bases de datos NIS+. + +%description -l pl.UTF-8 +Moduł glibc NSS (Name Service Switch) dostępu do baz danych NIS+. + +Ten kod wcześniej był częścią glibc, ale został wydzielony, aby mógł +używać TI-RPC w celu obsługi IPv6. + +Uwaga: kod NIS+ jest przestarzały i nie powinien być już używany. + +%prep +%setup -q -n libnss_nisplus-libnss_nisplus-%{version} +%patch0 -p1 + +%build +%{__libtoolize} +%{__aclocal} -I m4 +%{__autoconf} +%{__autoheader} +%{__automake} +%configure \ + --libdir=/%{_lib} \ + --disable-static + +%{__make} + +%install +rm -rf $RPM_BUILD_ROOT + +%{__make} install \ + DESTDIR=$RPM_BUILD_ROOT + +%{__rm} $RPM_BUILD_ROOT/%{_lib}/libnss_nisplus.{la,so} + +%clean +rm -rf $RPM_BUILD_ROOT + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%defattr(644,root,root,755) +%doc ChangeLog NEWS README +%attr(755,root,root) /%{_lib}/libnss_nisplus.so.*.*.* +%attr(755,root,root) %ghost /%{_lib}/libnss_nisplus.so.2 -- 2.43.0