diff -Nru libnss-extrausers-0.6/debian/changelog libnss-extrausers-0.6/debian/changelog --- libnss-extrausers-0.6/debian/changelog 2012-05-16 09:29:05.000000000 +0000 +++ libnss-extrausers-0.6/debian/changelog 2016-09-05 14:08:15.000000000 +0000 @@ -1,3 +1,13 @@ +libnss-extrausers (0.6-4) unstable; urgency=medium + + * orphan package + * apply some patches from Philipp Hahn + * move git repository to collab-maint + * replace ldconfig call with a trigger + * switch debian/compat to 9 + + -- Bernhard R. Link Mon, 05 Sep 2016 16:08:15 +0200 + libnss-extrausers (0.6-3) unstable; urgency=low * fix building lib32 on x390x (needs -m31 instead of -m32) diff -Nru libnss-extrausers-0.6/debian/compat libnss-extrausers-0.6/debian/compat --- libnss-extrausers-0.6/debian/compat 2012-05-15 12:08:30.000000000 +0000 +++ libnss-extrausers-0.6/debian/compat 2016-09-05 14:08:15.000000000 +0000 @@ -1 +1 @@ -7 +9 diff -Nru libnss-extrausers-0.6/debian/control libnss-extrausers-0.6/debian/control --- libnss-extrausers-0.6/debian/control 2012-05-15 14:04:17.000000000 +0000 +++ libnss-extrausers-0.6/debian/control 2016-09-05 14:08:15.000000000 +0000 @@ -1,11 +1,11 @@ Source: libnss-extrausers Section: admin Priority: extra -Maintainer: Bernhard R. Link +Maintainer: Debian QA Group Build-Depends: debhelper (>= 7), gcc-multilib [sparc i386 kfreebsd-amd64 amd64 mips mipsel powerpc s390 s390x], dpkg-dev (>= 1.15.7~) Standards-Version: 3.9.3 -Vcs-Browser: http://git.debian.org/?p=users/brlink/libnss-extrausers.git;a=shortlog;h=refs/heads/debian -Vcs-Git: git://git.debian.org/users/brlink/libnss-extrausers.git -b debian +Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/libnss-extrausers.git/log/?h=debian +Vcs-Git: git://anonscm.debian.org/collab-maint/libnss-extrausers.git -b debian Package: libnss-extrausers Architecture: any diff -Nru libnss-extrausers-0.6/debian/patches/0001-Bug-29915-CLO_EXEC.patch libnss-extrausers-0.6/debian/patches/0001-Bug-29915-CLO_EXEC.patch --- libnss-extrausers-0.6/debian/patches/0001-Bug-29915-CLO_EXEC.patch 1970-01-01 00:00:00.000000000 +0000 +++ libnss-extrausers-0.6/debian/patches/0001-Bug-29915-CLO_EXEC.patch 2016-09-05 14:08:15.000000000 +0000 @@ -0,0 +1,78 @@ +From 7fff46e1778ab85c7767dfe96dfa67877502d377 Mon Sep 17 00:00:00 2001 +From: Philipp Hahn +Date: Thu, 21 Jul 2016 09:42:45 +0200 +Subject: Bug #29915: CLO_EXEC + +Open files CLO_EXEC for process safety. +--- + group.c | 6 +++--- + passwd.c | 4 ++-- + shadow.c | 2 +- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/group.c b/group.c +index 41b72d3..e523064 100644 +--- a/group.c ++++ b/group.c +@@ -213,7 +213,7 @@ static inline enum nss_status g_search(FILE *stream, const char *name, const gid + + + enum nss_status _nss_extrausers_setgrent(void) { +- groupsfile = fopen(GROUPSFILE, "r"); ++ groupsfile = fopen(GROUPSFILE, "re"); + if (groupsfile == NULL) + return NSS_STATUS_UNAVAIL; + return NSS_STATUS_SUCCESS; +@@ -245,7 +245,7 @@ enum nss_status _nss_extrausers_getgrnam_r(const char *name, struct group *gr, c + if (gr == NULL || name == NULL) + return NSS_STATUS_UNAVAIL; + +- f = fopen(GROUPSFILE, "r"); ++ f = fopen(GROUPSFILE, "re"); + if (f == NULL) { + *errnop = errno; + return NSS_STATUS_UNAVAIL; +@@ -265,7 +265,7 @@ enum nss_status _nss_extrausers_getgrgid_r(const gid_t gid, struct group *gr, ch + if (gid == 0 || gid < MINGID) + return NSS_STATUS_NOTFOUND; + +- f = fopen(GROUPSFILE, "r"); ++ f = fopen(GROUPSFILE, "re"); + if (f == NULL) { + *errnop = errno; + return NSS_STATUS_UNAVAIL; +diff --git a/passwd.c b/passwd.c +index 88cb1b7..bb97c52 100644 +--- a/passwd.c ++++ b/passwd.c +@@ -73,7 +73,7 @@ static inline enum nss_status p_search(FILE *f, const char *name, const uid_t ui + char *t_name, *t_passwd, *t_gecos, *t_shell, *t_dir; + + if (stream == NULL) { +- stream = fopen(USERSFILE, "r"); ++ stream = fopen(USERSFILE, "re"); + if (stream == NULL) { + *errnop = errno; + return NSS_STATUS_UNAVAIL; +@@ -209,7 +209,7 @@ enum nss_status _nss_extrausers_setpwent(void) { + fclose(usersfile); + usersfile = NULL; + } +- usersfile = fopen(USERSFILE, "r"); ++ usersfile = fopen(USERSFILE, "re"); + if (usersfile == NULL) + { + return NSS_STATUS_UNAVAIL; +diff --git a/shadow.c b/shadow.c +index 9685174..625ac98 100644 +--- a/shadow.c ++++ b/shadow.c +@@ -61,7 +61,7 @@ enum nss_status _nss_extrausers_getspnam_r(const char *name, struct spwd *spw, c + return NSS_STATUS_UNAVAIL; + } + +- stream = fopen(SHADOWFILE, "r"); ++ stream = fopen(SHADOWFILE, "re"); + if( stream == NULL ) { + *errnop = errno; + return NSS_STATUS_UNAVAIL; diff -Nru libnss-extrausers-0.6/debian/patches/0002-Bug-29915-NSS-error-reporting.patch libnss-extrausers-0.6/debian/patches/0002-Bug-29915-NSS-error-reporting.patch --- libnss-extrausers-0.6/debian/patches/0002-Bug-29915-NSS-error-reporting.patch 1970-01-01 00:00:00.000000000 +0000 +++ libnss-extrausers-0.6/debian/patches/0002-Bug-29915-NSS-error-reporting.patch 2016-09-05 14:08:15.000000000 +0000 @@ -0,0 +1,119 @@ +From 3ff1121b47387a3280c0e235e8fed81c434a8403 Mon Sep 17 00:00:00 2001 +From: Philipp Hahn +Date: Thu, 21 Jul 2016 09:42:46 +0200 +Subject: Bug #29915: NSS error reporting + +Report proper error on out-of-memory-errors as required by NSS spec. +--- + group.c | 6 +++++- + passwd.c | 4 +++- + shadow.c | 4 +++- + 3 files changed, 11 insertions(+), 3 deletions(-) + +diff --git a/group.c b/group.c +index e523064..dc84c63 100644 +--- a/group.c ++++ b/group.c +@@ -109,6 +109,7 @@ static inline char **parse_list(char *line, char *data, size_t datalen, int *err + return list; + } + ++/* Advance pointer p to next column and set h to end of previous column terminated by \0 */ + #define TOCOLON(p, h) { \ + while (*p && *p != ':') \ + p++; \ +@@ -140,10 +141,12 @@ static inline enum nss_status g_search(FILE *stream, const char *name, const gid + p = fgets_unlocked(buffer, buflen, stream); + if (p == NULL) { + if (feof_unlocked(stream)) { ++ /* EOF reached: not found */ + funlockfile(stream); + *errnop = ENOENT; + return NSS_STATUS_NOTFOUND; + } else { ++ /* other error */ + funlockfile(stream); + *errnop = errno; + return NSS_STATUS_UNAVAIL; +@@ -151,6 +154,7 @@ static inline enum nss_status g_search(FILE *stream, const char *name, const gid + } + h = index(p, '\n'); + if (buffer[buflen - 1] != '\xff' || h == NULL) { ++ /* buffer too small */ + funlockfile(stream); + *errnop = ERANGE; + fseeko(stream, last_position, SEEK_SET); +@@ -199,6 +203,7 @@ static inline enum nss_status g_search(FILE *stream, const char *name, const gid + if (t_mem == NULL){ + funlockfile(stream); + fseeko(stream, last_position, SEEK_SET); ++ *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + funlockfile(stream); +@@ -235,7 +240,6 @@ enum nss_status _nss_extrausers_getgrent_r(struct group *gr, char *buffer, size_ + return g_search(groupsfile, NULL, 0, gr, errnop, buffer, buflen); + } + +- + enum nss_status _nss_extrausers_getgrnam_r(const char *name, struct group *gr, char *buffer, size_t buflen, int *errnop) { + enum nss_status e; + FILE *f; +diff --git a/passwd.c b/passwd.c +index bb97c52..80fb916 100644 +--- a/passwd.c ++++ b/passwd.c +@@ -76,7 +76,7 @@ static inline enum nss_status p_search(FILE *f, const char *name, const uid_t ui + stream = fopen(USERSFILE, "re"); + if (stream == NULL) { + *errnop = errno; +- return NSS_STATUS_UNAVAIL; ++ return *errnop == ENOMEM ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL; + } + } + flockfile(stream); +@@ -96,6 +96,7 @@ static inline enum nss_status p_search(FILE *f, const char *name, const uid_t ui + } + h = index(p, '\n'); + if (buffer[buflen - 1] != '\xff' || h == NULL) { ++ /* buffer too small */ + SANEQUIT + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; +@@ -107,6 +108,7 @@ static inline enum nss_status p_search(FILE *f, const char *name, const uid_t ui + /* Ignore comments */ + if (*p == '#') + continue; ++ + /* extract name */ + while (isspace(*p)) + ++p; +diff --git a/shadow.c b/shadow.c +index 625ac98..0b48255 100644 +--- a/shadow.c ++++ b/shadow.c +@@ -64,7 +64,7 @@ enum nss_status _nss_extrausers_getspnam_r(const char *name, struct spwd *spw, c + stream = fopen(SHADOWFILE, "re"); + if( stream == NULL ) { + *errnop = errno; +- return NSS_STATUS_UNAVAIL; ++ return *errnop == ENOMEM ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL; + } + flockfile(stream); + s = shadow_search(stream, name, spw, buffer, buflen, errnop); +@@ -145,6 +145,7 @@ static enum nss_status shadow_search(FILE *stream, const char *name, struct spwd + } + h = index(p, '\n'); + if( buffer[buflen - 1] != '\xff' || h == NULL ) { ++ /* buffer too small */ + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } +@@ -200,6 +201,7 @@ static enum nss_status shadow_search(FILE *stream, const char *name, struct spwd + return NSS_STATUS_UNAVAIL; + } else if (p == h) + t_flag = -1; ++ + *errnop = 0; + spw->sp_namp = t_namp; + spw->sp_pwdp = t_pwdp; diff -Nru libnss-extrausers-0.6/debian/patches/0003-Bug-29915-min-GID.patch libnss-extrausers-0.6/debian/patches/0003-Bug-29915-min-GID.patch --- libnss-extrausers-0.6/debian/patches/0003-Bug-29915-min-GID.patch 1970-01-01 00:00:00.000000000 +0000 +++ libnss-extrausers-0.6/debian/patches/0003-Bug-29915-min-GID.patch 2016-09-05 14:08:15.000000000 +0000 @@ -0,0 +1,26 @@ +From 56f52cf1ec2cf3eba13c68c733ab35b5feae8ace Mon Sep 17 00:00:00 2001 +From: Philipp Hahn +Date: Thu, 21 Jul 2016 09:42:47 +0200 +Subject: Bug #29915: min GID + +Check for gid < MINGID before loop instead of terminating the loop on the first line with gid < MINGID. +--- + passwd.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/passwd.c b/passwd.c +index 80fb916..0e20074 100644 +--- a/passwd.c ++++ b/passwd.c +@@ -72,6 +72,11 @@ static inline enum nss_status p_search(FILE *f, const char *name, const uid_t ui + gid_t t_gid; + char *t_name, *t_passwd, *t_gecos, *t_shell, *t_dir; + ++ if (uid != 0 && uid < MINUID) { ++ *errnop = ENOENT; ++ return NSS_STATUS_NOTFOUND; ++ } ++ + if (stream == NULL) { + stream = fopen(USERSFILE, "re"); + if (stream == NULL) { diff -Nru libnss-extrausers-0.6/debian/patches/0004-Bug-29915-fseek-thread-safety.patch libnss-extrausers-0.6/debian/patches/0004-Bug-29915-fseek-thread-safety.patch --- libnss-extrausers-0.6/debian/patches/0004-Bug-29915-fseek-thread-safety.patch 1970-01-01 00:00:00.000000000 +0000 +++ libnss-extrausers-0.6/debian/patches/0004-Bug-29915-fseek-thread-safety.patch 2016-09-05 14:08:15.000000000 +0000 @@ -0,0 +1,35 @@ +From 5481271781001ee06e9caa66b7eb4b95e4df68b3 Mon Sep 17 00:00:00 2001 +From: Philipp Hahn +Date: Thu, 21 Jul 2016 09:42:48 +0200 +Subject: Bug #29915: fseek() thread safety + +Restore file position before unlock for thread safety. +--- + group.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/group.c b/group.c +index dc84c63..1ff4269 100644 +--- a/group.c ++++ b/group.c +@@ -155,9 +155,9 @@ static inline enum nss_status g_search(FILE *stream, const char *name, const gid + h = index(p, '\n'); + if (buffer[buflen - 1] != '\xff' || h == NULL) { + /* buffer too small */ ++ fseeko(stream, last_position, SEEK_SET); + funlockfile(stream); + *errnop = ERANGE; +- fseeko(stream, last_position, SEEK_SET); + return NSS_STATUS_TRYAGAIN; + } + while (isspace(*h) && h != p) { +@@ -201,8 +201,8 @@ static inline enum nss_status g_search(FILE *stream, const char *name, const gid + h++; // Over ':' + t_mem = parse_list(h, buffer, buflen, errnop); + if (t_mem == NULL){ +- funlockfile(stream); + fseeko(stream, last_position, SEEK_SET); ++ funlockfile(stream); + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } diff -Nru libnss-extrausers-0.6/debian/patches/0005-Bug-29915-strip-trailing-whitespace.patch libnss-extrausers-0.6/debian/patches/0005-Bug-29915-strip-trailing-whitespace.patch --- libnss-extrausers-0.6/debian/patches/0005-Bug-29915-strip-trailing-whitespace.patch 1970-01-01 00:00:00.000000000 +0000 +++ libnss-extrausers-0.6/debian/patches/0005-Bug-29915-strip-trailing-whitespace.patch 2016-09-05 14:08:15.000000000 +0000 @@ -0,0 +1,51 @@ +From 7111866968f6f34c417df653dc0aee32525dc566 Mon Sep 17 00:00:00 2001 +From: Philipp Hahn +Date: Thu, 21 Jul 2016 09:42:49 +0200 +Subject: Bug #29915: strip trailing whitespace + +Fix stripping trailing whitespace. +--- + group.c | 2 +- + passwd.c | 2 +- + shadow.c | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/group.c b/group.c +index 1ff4269..7d49e7d 100644 +--- a/group.c ++++ b/group.c +@@ -160,7 +160,7 @@ static inline enum nss_status g_search(FILE *stream, const char *name, const gid + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } +- while (isspace(*h) && h != p) { ++ while (h >= p && isspace(*h)) { + *h = '\0'; + h--; + } +diff --git a/passwd.c b/passwd.c +index 0e20074..c44b52a 100644 +--- a/passwd.c ++++ b/passwd.c +@@ -106,7 +106,7 @@ static inline enum nss_status p_search(FILE *f, const char *name, const uid_t ui + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } +- while (isspace(*h) && h != p) { ++ while (h >= p && isspace(*h)) { + *h = '\0'; + h--; + } +diff --git a/shadow.c b/shadow.c +index 0b48255..093e8c4 100644 +--- a/shadow.c ++++ b/shadow.c +@@ -149,7 +149,7 @@ static enum nss_status shadow_search(FILE *stream, const char *name, struct spwd + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } +- while( isspace(*h) && h >= p) { ++ while (h >= p && isspace(*h)) { + *h = '\0'; + h--; + } diff -Nru libnss-extrausers-0.6/debian/patches/0006-Bug-39775-Fix-setgrent.patch libnss-extrausers-0.6/debian/patches/0006-Bug-39775-Fix-setgrent.patch --- libnss-extrausers-0.6/debian/patches/0006-Bug-39775-Fix-setgrent.patch 1970-01-01 00:00:00.000000000 +0000 +++ libnss-extrausers-0.6/debian/patches/0006-Bug-39775-Fix-setgrent.patch 2016-09-05 14:08:15.000000000 +0000 @@ -0,0 +1,36 @@ +From 75950a89b5cde8cf33c1be6451b3fe36ccc26a61 Mon Sep 17 00:00:00 2001 +From: Philipp Hahn +Date: Thu, 21 Jul 2016 09:42:50 +0200 +Subject: Bug #39775: Fix setgrent() + +If setgrent() is called a 2nd time, the stream must be rewinded. +--- + group.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/group.c b/group.c +index 7d49e7d..5109570 100644 +--- a/group.c ++++ b/group.c +@@ -218,10 +218,17 @@ static inline enum nss_status g_search(FILE *stream, const char *name, const gid + + + enum nss_status _nss_extrausers_setgrent(void) { +- groupsfile = fopen(GROUPSFILE, "re"); +- if (groupsfile == NULL) +- return NSS_STATUS_UNAVAIL; +- return NSS_STATUS_SUCCESS; ++ enum nss_status status = NSS_STATUS_SUCCESS; ++ ++ if (groupsfile == NULL) { ++ groupsfile = fopen(GROUPSFILE, "re"); ++ if (groupsfile == NULL) ++ status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL; ++ } else { ++ rewind(groupsfile); ++ } ++ ++ return status; + } + + enum nss_status _nss_extrausers_endgrent(void) { diff -Nru libnss-extrausers-0.6/debian/patches/series libnss-extrausers-0.6/debian/patches/series --- libnss-extrausers-0.6/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ libnss-extrausers-0.6/debian/patches/series 2016-09-05 14:08:15.000000000 +0000 @@ -0,0 +1,6 @@ +0001-Bug-29915-CLO_EXEC.patch +0002-Bug-29915-NSS-error-reporting.patch +0003-Bug-29915-min-GID.patch +0004-Bug-29915-fseek-thread-safety.patch +0005-Bug-29915-strip-trailing-whitespace.patch +0006-Bug-39775-Fix-setgrent.patch diff -Nru libnss-extrausers-0.6/debian/postinst libnss-extrausers-0.6/debian/postinst --- libnss-extrausers-0.6/debian/postinst 2012-05-15 12:08:30.000000000 +0000 +++ libnss-extrausers-0.6/debian/postinst 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -#!/bin/sh - -set -e - -if [ "$1" = "configure" ]; then - ldconfig -fi - -#DEBHELPER# - -exit 0 - - diff -Nru libnss-extrausers-0.6/debian/triggers libnss-extrausers-0.6/debian/triggers --- libnss-extrausers-0.6/debian/triggers 1970-01-01 00:00:00.000000000 +0000 +++ libnss-extrausers-0.6/debian/triggers 2016-09-05 14:08:15.000000000 +0000 @@ -0,0 +1,2 @@ +# Is this necessary? This is no library but a plugin in public directory for historic reasons... +activate-noawait ldconfig