[27232] in Source-Commits
/svn/athena r26035 - in trunk/debathena/debathena/libnss-nonlocal: . debian
daemon@ATHENA.MIT.EDU (Anders Kaseorg)
Thu Jun 13 05:30:08 2013
Date: Thu, 13 Jun 2013 05:30:01 -0400
From: Anders Kaseorg <andersk@MIT.EDU>
Message-Id: <201306130930.r5D9U1Ku002359@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: andersk
Date: 2013-06-13 05:30:01 -0400 (Thu, 13 Jun 2013)
New Revision: 26035
Added:
trunk/debathena/debathena/libnss-nonlocal/debian/control
trunk/debathena/debathena/libnss-nonlocal/debian/libnss-nonlocal-common.postrm
trunk/debathena/debathena/libnss-nonlocal/debian/libnss-nonlocal-common.preinst
Removed:
trunk/debathena/debathena/libnss-nonlocal/debian/control.in
trunk/debathena/debathena/libnss-nonlocal/debian/libnss-nonlocal.install
trunk/debathena/debathena/libnss-nonlocal/debian/libnss-nonlocal.postrm
trunk/debathena/debathena/libnss-nonlocal/debian/libnss-nonlocal.preinst
Modified:
trunk/debathena/debathena/libnss-nonlocal/Makefile.am
trunk/debathena/debathena/libnss-nonlocal/configure.ac
trunk/debathena/debathena/libnss-nonlocal/debian/changelog
trunk/debathena/debathena/libnss-nonlocal/debian/compat
trunk/debathena/debathena/libnss-nonlocal/debian/rules
trunk/debathena/debathena/libnss-nonlocal/nonlocal-group.c
trunk/debathena/debathena/libnss-nonlocal/nonlocal-passwd.c
trunk/debathena/debathena/libnss-nonlocal/nonlocal-shadow.c
trunk/debathena/debathena/libnss-nonlocal/nonlocal.h
trunk/debathena/debathena/libnss-nonlocal/walk_nss.h
Log:
In libnss-nonlocal:
* New upstream release.
- Support Automake 1.12.
- Guard one-time initialization with memory barriers.
- Make initgroups_dyn succeed when adding only magic groups.
* Rewrite packaging with Debhelper 7.
* Move magic user and group creation to separate libnss-nonlocal-common
package.
Full history: git://andersk.mit.edu/nss_nonlocal.git debian/2.1-0debathena1
Modified: trunk/debathena/debathena/libnss-nonlocal/Makefile.am
===================================================================
--- trunk/debathena/debathena/libnss-nonlocal/Makefile.am 2013-06-13 09:28:48 UTC (rev 26034)
+++ trunk/debathena/debathena/libnss-nonlocal/Makefile.am 2013-06-13 09:30:01 UTC (rev 26035)
@@ -1,7 +1,7 @@
lib_LTLIBRARIES = libnss_nonlocal.la
libnss_nonlocal_la_SOURCES = \
nonlocal-passwd.c nonlocal-group.c nonlocal-shadow.c \
- nonlocal.h nsswitch-internal.h
+ nonlocal.h nsswitch-internal.h walk_nss.h
libnss_nonlocal_la_LDFLAGS = \
-version-info 2:0:0 \
-export-symbols-regex '^_nss_nonlocal_' \
@@ -10,3 +10,6 @@
install-exec-hook:
rm -f $(DESTDIR)$(libdir)/libnss_nonlocal.so
rm -f $(DESTDIR)$(libdir)/libnss_nonlocal.la
+
+uninstall-local:
+ rm -f $(DESTDIR)$(libdir)/libnss_nonlocal.so.*
Modified: trunk/debathena/debathena/libnss-nonlocal/configure.ac
===================================================================
--- trunk/debathena/debathena/libnss-nonlocal/configure.ac 2013-06-13 09:28:48 UTC (rev 26034)
+++ trunk/debathena/debathena/libnss-nonlocal/configure.ac 2013-06-13 09:30:01 UTC (rev 26035)
@@ -1,4 +1,4 @@
-AC_INIT([nss_nonlocal], [2.0], [andersk@mit.edu])
+AC_INIT([nss_nonlocal], [2.1], [andersk@mit.edu])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
@@ -6,7 +6,7 @@
AC_PREFIX_DEFAULT([/])
AC_DISABLE_STATIC
AC_PROG_CC
-AC_PROG_INSTALL
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_PROG_LIBTOOL
AC_HEADER_STDBOOL
Modified: trunk/debathena/debathena/libnss-nonlocal/debian/changelog
===================================================================
--- trunk/debathena/debathena/libnss-nonlocal/debian/changelog 2013-06-13 09:28:48 UTC (rev 26034)
+++ trunk/debathena/debathena/libnss-nonlocal/debian/changelog 2013-06-13 09:30:01 UTC (rev 26035)
@@ -1,3 +1,15 @@
+libnss-nonlocal (2.1-0debathena1) unstable; urgency=low
+
+ * New upstream release.
+ - Support Automake 1.12.
+ - Guard one-time initialization with memory barriers.
+ - Make initgroups_dyn succeed when adding only magic groups.
+ * Rewrite packaging with Debhelper 7.
+ * Move magic user and group creation to separate libnss-nonlocal-common
+ package.
+
+ -- Anders Kaseorg <andersk@mit.edu> Thu, 13 Jun 2013 04:43:16 -0400
+
libnss-nonlocal (2.0-0debathena2) unstable; urgency=low
* Pre-Depend adduser.
Modified: trunk/debathena/debathena/libnss-nonlocal/debian/compat
===================================================================
--- trunk/debathena/debathena/libnss-nonlocal/debian/compat 2013-06-13 09:28:48 UTC (rev 26034)
+++ trunk/debathena/debathena/libnss-nonlocal/debian/compat 2013-06-13 09:30:01 UTC (rev 26035)
@@ -1 +1 @@
-6
+7
Copied: trunk/debathena/debathena/libnss-nonlocal/debian/control (from rev 26034, trunk/debathena/debathena/libnss-nonlocal/debian/control.in)
===================================================================
--- trunk/debathena/debathena/libnss-nonlocal/debian/control (rev 0)
+++ trunk/debathena/debathena/libnss-nonlocal/debian/control 2013-06-13 09:30:01 UTC (rev 26035)
@@ -0,0 +1,60 @@
+Source: libnss-nonlocal
+Section: debathena/libs
+Priority: optional
+Maintainer: Anders Kaseorg <andersk@mit.edu>
+Vcs-Git: git://andersk.mit.edu/nss_nonlocal.git
+Vcs-Browser: http://andersk.mit.edu/gitweb/nss_nonlocal.git
+Standards-Version: 3.9.4
+Build-Depends: debhelper (>= 7.0.50~),
+ autotools-dev, dh-autoreconf,
+ gcc-multilib [amd64 i386] | gcc-4.1 (<< 4.1.2) [amd64 i386],
+ libc6-dev-i386 [amd64], libc6-dev-amd64 [i386],
+ lsb-release
+
+Package: libnss-nonlocal
+Architecture: any
+Pre-Depends: ${misc:Pre-Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Recommends: libnss-nonlocal-common
+Description: nsswitch proxy module to prevent local account spoofing
+ This nsswitch module acts as a proxy for other nsswitch modules like
+ hesiod, but prevents non-local users from potentially gaining local
+ privileges by spoofing local UIDs and GIDs.
+
+Package: lib32nss-nonlocal
+Architecture: amd64
+Pre-Depends: ${misc:Pre-Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Recommends: libnss-nonlocal-common
+Description: nsswitch proxy module to prevent local account spoofing (32-bit library)
+ This nsswitch module acts as a proxy for other nsswitch modules like
+ hesiod, but prevents non-local users from potentially gaining local
+ privileges by spoofing local UIDs and GIDs.
+ .
+ This package contains a 32-bit version of the library for compatibility
+ on 64-bit architectures.
+
+Package: lib64nss-nonlocal
+Architecture: i386
+Pre-Depends: ${misc:Pre-Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Recommends: libnss-nonlocal-common
+Description: nsswitch proxy module to prevent local account spoofing (64-bit library)
+ This nsswitch module acts as a proxy for other nsswitch modules like
+ hesiod, but prevents non-local users from potentially gaining local
+ privileges by spoofing local UIDs and GIDs.
+ .
+ This package contains a 64-bit version of the library for compatibility
+ on 32-bit architectures.
+
+Package: libnss-nonlocal-common
+Architecture: all
+Pre-Depends: ${misc:Pre-Depends}, adduser
+Depends: ${misc:Depends}
+Description: nsswitch proxy module to prevent local account spoofing (common package)
+ This nsswitch module acts as a proxy for other nsswitch modules like
+ hesiod, but prevents non-local users from potentially gaining local
+ privileges by spoofing local UIDs and GIDs.
+ .
+ This package creates the system users and groups that have special
+ meanings to nss_nonlocal.
Copied: trunk/debathena/debathena/libnss-nonlocal/debian/libnss-nonlocal-common.postrm (from rev 26033, trunk/debathena/debathena/libnss-nonlocal/debian/libnss-nonlocal.postrm)
===================================================================
--- trunk/debathena/debathena/libnss-nonlocal/debian/libnss-nonlocal-common.postrm (rev 0)
+++ trunk/debathena/debathena/libnss-nonlocal/debian/libnss-nonlocal-common.postrm 2013-06-13 09:30:01 UTC (rev 26035)
@@ -0,0 +1,51 @@
+#!/bin/sh
+# postrm script for libnss-nonlocal-common
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postrm> `remove'
+# * <postrm> `purge'
+# * <old-postrm> `upgrade' <new-version>
+# * <new-postrm> `failed-upgrade' <old-version>
+# * <new-postrm> `abort-install'
+# * <new-postrm> `abort-install' <old-version>
+# * <new-postrm> `abort-upgrade' <old-version>
+# * <disappearer's-postrm> `disappear' <overwriter>
+# <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ purge)
+ if getent passwd nss-nonlocal-users >/dev/null; then
+ deluser --system nss-nonlocal-users || :
+ fi
+ if getent group nss-local-users >/dev/null; then
+ delgroup --system nss-local-users || :
+ fi
+ if getent group nss-nonlocal-users >/dev/null; then
+ delgroup --system nss-nonlocal-users || :
+ fi
+ ;;
+
+ remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
Copied: trunk/debathena/debathena/libnss-nonlocal/debian/libnss-nonlocal-common.preinst (from rev 26033, trunk/debathena/debathena/libnss-nonlocal/debian/libnss-nonlocal.preinst)
===================================================================
--- trunk/debathena/debathena/libnss-nonlocal/debian/libnss-nonlocal-common.preinst (rev 0)
+++ trunk/debathena/debathena/libnss-nonlocal/debian/libnss-nonlocal-common.preinst 2013-06-13 09:30:01 UTC (rev 26035)
@@ -0,0 +1,50 @@
+#!/bin/sh
+# preinst script for libnss-nonlocal-common
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <new-preinst> `install'
+# * <new-preinst> `install' <old-version>
+# * <new-preinst> `upgrade' <old-version>
+# * <old-preinst> `abort-upgrade' <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ install|upgrade)
+ if ! getent passwd nss-nonlocal-users >/dev/null; then
+ adduser --system --no-create-home --home /nonexistent \
+ --gecos 'Magic user for local group whitelist' \
+ nss-nonlocal-users
+ fi
+ if ! getent group nss-local-users >/dev/null; then
+ addgroup --system nss-local-users
+ fi
+ if ! getent group nss-nonlocal-users >/dev/null; then
+ addgroup --system nss-nonlocal-users
+ fi
+ ;;
+
+ abort-upgrade)
+ ;;
+
+ *)
+ echo "preinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
+
+
Modified: trunk/debathena/debathena/libnss-nonlocal/debian/rules
===================================================================
--- trunk/debathena/debathena/libnss-nonlocal/debian/rules 2013-06-13 09:28:48 UTC (rev 26034)
+++ trunk/debathena/debathena/libnss-nonlocal/debian/rules 2013-06-13 09:30:01 UTC (rev 26035)
@@ -1,90 +1,67 @@
#!/usr/bin/make -f
-DEB_AUTO_UPDATE_AUTOCONF = 2.61
-DEB_AUTO_UPDATE_AUTOHEADER = 2.61
-DEB_AUTO_UPDATE_AUTOMAKE = 1.10
-DEB_AUTO_UPDATE_ACLOCAL = 1.10
-DEB_AUTO_UPDATE_LIBTOOL = pre
+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
-# dh_buildinfo fails at multiarch: http://bugs.debian.org/620104
-CDBS_BUILD_DEPENDS_rules_debhelper_buildinfo =
+# Work around http://bugs.debian.org/572077 (debhelper < 7.4.16)
+binary: binary-arch binary-indep ;
-include /usr/share/cdbs/1/rules/debhelper.mk
-include /usr/share/cdbs/1/class/autotools.mk
+%:
+ dh $@ --with autoreconf
-DEB_DESTDIR = $(CURDIR)/debian/tmp/
-DEB_DH_INSTALL_SOURCEDIR = $(DEB_DESTDIR)
-DEB_CONFIGURE_PREFIX = /
+all_flavors = libnss-nonlocal
+libnss-nonlocal_configure_args += --prefix=/
+libnss-nonlocal_dh_install = 'lib/*'
ifneq ($(DEB_HOST_MULTIARCH),)
- CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS)
export DH_COMPAT = 9
- DEB_CONFIGURE_EXTRA_FLAGS += $(MULTIARCH_CONFIGURE_FLAGS)
- MULTIARCH_CONFIGURE_FLAGS = --libdir='$${prefix}/lib/$(DEB_HOST_MULTIARCH)'
- DEB_DH_GENCONTROL_ARGS_libnss-nonlocal += -- -DMulti-Arch=same
+ libnss-nonlocal_configure_args += --libdir='$${prefix}/lib/$(DEB_HOST_MULTIARCH)'
+ libnss-nonlocal_dh_install = 'lib/$(DEB_HOST_MULTIARCH)/*'
+ libnss-nonlocal_dh_gencontrol = -- -DMulti-Arch=same
+else ifeq ($(shell hash dpkg-buildflags 2>/dev/null && echo y),y)
+ all_configure_args += $(foreach var,CFLAGS CPPFLAGS LDFLAGS,"$(var)=$$(dpkg-buildflags --get $(var))")
endif
IS_UBUNTU := $(if $(filter Ubuntu,$(shell lsb_release -is)),y)
LIBC6_VERSION := $(shell dpkg-query --showformat='$${Version}' --show libc6)
libc6_ge = $(shell dpkg --compare-versions '$(LIBC6_VERSION)' ge '$(1)' && echo y)
-debian/stamp-autotools-files: DEB_AUTO_UPDATE_AUTOMAKE += --foreign --add-missing
-
-debian/stamp-autotools-files: aclocal.m4
-aclocal.m4:
- touch $@
-
-DEB_BUILDDIR = $(or $(DEB_BUILDDIR_$(cdbs_curpkg)),debian/build)
-
-REAL_DEB_HOST_GNU_TYPE := $(DEB_HOST_GNU_TYPE)
-
-DEB_BUILDDIR_lib32nss-nonlocal = debian/build_32
-cleanbuilddir/lib32nss-nonlocal:: clean/lib32nss-nonlocal
-configure/lib32nss-nonlocal:: MULTIARCH_CONFIGURE_FLAGS =
-configure/lib32nss-nonlocal:: cdbs_crossbuild =
+all_flavors += lib32nss-nonlocal
# i386_configure_target in eglibc/debian/sysdeps/amd64.mk
ifeq ($(or $(IS_UBUNTU),$(call libc6_ge,2.8+20080809)),y)
-configure/lib32nss-nonlocal:: DEB_BUILD_GNU_TYPE = i686-linux
+lib32nss-nonlocal_configure_args += --build=i686-linux
else
-configure/lib32nss-nonlocal:: DEB_BUILD_GNU_TYPE = i486-linux
+lib32nss-nonlocal_configure_args += --build=i486-linux
endif
# i386_CC in eglibc/debian/sysdeps/amd64.mk
-configure/lib32nss-nonlocal:: CC += -m32
+lib32nss-nonlocal_configure_args += CC='$(CC) -m32'
# i386_slibdir in eglibc/debian/sysdeps/amd64.mk
ifeq ($(or $(IS_UBUNTU),$(call libc6_ge,2.9-14~)),y)
-configure/lib32nss-nonlocal:: DEB_CONFIGURE_EXTRA_FLAGS += --libdir="\$${prefix}/lib32"
-binary-install/lib32nss-nonlocal:: DEB_DH_INSTALL_ARGS = 'lib32/*'
+lib32nss-nonlocal_configure_args += --prefix=/ --libdir='$${prefix}/lib32'
+lib32nss-nonlocal_dh_install = 'lib32/*'
else
-configure/lib32nss-nonlocal:: DEB_CONFIGURE_PREFIX = /emul/ia32-linux
-binary-install/lib32nss-nonlocal:: DEB_DH_INSTALL_ARGS = 'emul/ia32-linux/lib/*'
+lib32nss-nonlocal_configure_args += --prefix=/emul/ia32-linux
+lib32nss-nonlocal_dh_install = 'emul/ia32-linux/*'
endif
-DEB_BUILDDIR_lib64nss-nonlocal = debian/build_64
-cleanbuilddir/lib64nss-nonlocal:: clean/lib64nss-nonlocal
-configure/lib64nss-nonlocal:: MULTIARCH_CONFIGURE_FLAGS =
-configure/lib64nss-nonlocal:: cdbs_crossbuild =
+all_flavors += lib64nss-nonlocal
# amd64_configure_target in eglibc/debian/sysdeps/i386.mk
-configure/lib64nss-nonlocal:: DEB_BUILD_GNU_TYPE = x86_64-linux
+lib64nss-nonlocal_configure_args += --build=x86_64-linux
# amd64_CC in eglibc/debian/sysdeps/i386.mk
-configure/lib64nss-nonlocal:: CC += -m64 -D__x86_64__
+lib64nss-nonlocal_configure_args += CC='$(CC) -m64 -D__x86_64__'
# amd64_slibdir in eglibc/debian/sysdeps/i386.mk
-configure/lib64nss-nonlocal:: DEB_CONFIGURE_EXTRA_FLAGS += --libdir="\$${prefix}/lib64"
+lib64nss-nonlocal_configure_args += --prefix=/ --libdir="\$${prefix}/lib64"
-# Fix for CDBS ≥ 0.4.59ubuntu4, < 0.4.83ubuntu1 (karmic and lucid).
-configure/lib32nss-nonlocal configure/lib64nss-nonlocal:: DEB_CONFIGURE_SCRIPT_ENV += CC="$(CC)"
+flavors := $(filter $(all_flavors),$(shell dh_listpackages))
-configure/lib32nss-nonlocal configure/lib64nss-nonlocal::
- $(DEB_CONFIGURE_INVOKE) $(cdbs_configure_flags) $(DEB_CONFIGURE_EXTRA_FLAGS) $(DEB_CONFIGURE_USER_FLAGS)
+define do_overrides
+override_$(1): $(addsuffix _$(1),$(2))
+$(addsuffix _$(1),$(filter-out REMAINING,$(2))): %_$(1):
+ $(1) -p$$* $(3)
+REMAINING_$(1): $(addsuffix _$(1),$(filter-out REMAINING,$(2)))
+ $(1) --remaining-packages $(4)
-build/lib32nss-nonlocal build/lib64nss-nonlocal::
- +$(DEB_MAKE_INVOKE) $(DEB_MAKE_BUILD_TARGET)
+endef
-install/lib32nss-nonlocal install/lib64nss-nonlocal::
- +$(DEB_MAKE_INVOKE) $(DEB_MAKE_INSTALL_TARGET)
-
-clean/lib32nss-nonlocal clean/lib64nss-nonlocal::
- +-$(DEB_MAKE_INVOKE) -k $(DEB_MAKE_CLEAN_TARGET)
-
-clean::
- rm -f aclocal.m4 config.guess config.sub install-sh ltmain.sh \
- configure config.h.in missing depcomp Makefile.in
+$(eval $(foreach auto,configure build install test clean,$(call do_overrides,dh_auto_$(auto),$(flavors),-Bdebian/build_$$* -- $$(all_$(auto)_args) $$($$*_$(auto)_args))))
+$(eval $(call do_overrides,dh_install,$(flavors) REMAINING,$$($$*_dh_install)))
+$(eval $(call do_overrides,dh_gencontrol,libnss-nonlocal REMAINING,$$($$*_dh_gencontrol)))
Modified: trunk/debathena/debathena/libnss-nonlocal/nonlocal-group.c
===================================================================
--- trunk/debathena/debathena/libnss-nonlocal/nonlocal-group.c 2013-06-13 09:28:48 UTC (rev 26034)
+++ trunk/debathena/debathena/libnss-nonlocal/nonlocal-group.c 2013-06-13 09:30:01 UTC (rev 26035)
@@ -24,18 +24,20 @@
*/
#define _GNU_SOURCE
+
#include <sys/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
#include <dlfcn.h>
-#include <stdio.h>
-#include <syslog.h>
#include <errno.h>
-#include <pwd.h>
#include <grp.h>
#include <nss.h>
+#include <pwd.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <unistd.h>
+
#include "nsswitch-internal.h"
#include "nonlocal.h"
@@ -169,6 +171,7 @@
return status;
}
+static bool grent_initialized = false;
static service_user *grent_startp, *grent_nip;
static void *grent_fct_start;
static union {
@@ -193,9 +196,12 @@
if (status != NSS_STATUS_SUCCESS)
return status;
- if (grent_fct_start == NULL)
+ if (!grent_initialized) {
__nss_group_nonlocal_lookup(&grent_startp, grent_fct_name,
&grent_fct_start);
+ __sync_synchronize();
+ grent_initialized = true;
+ }
grent_nip = grent_startp;
grent_fct.ptr = grent_fct_start;
return NSS_STATUS_SUCCESS;
@@ -207,7 +213,7 @@
enum nss_status status;
const struct walk_nss w = {
.lookup = &__nss_group_nonlocal_lookup, .fct_name = "endgrent",
- .status = &status
+ .status = &status, .all_values = 1,
};
const __typeof__(&_nss_nonlocal_endgrent) self = NULL;
@@ -355,7 +361,7 @@
enum nss_status status;
const struct walk_nss w = {
.lookup = &__nss_group_nonlocal_lookup, .fct_name = "initgroups_dyn",
- .status = &status, .errnop = errnop
+ .status = &status, .all_values = 1, .errnop = errnop
};
const __typeof__(&_nss_nonlocal_initgroups_dyn) self = NULL;
@@ -444,7 +450,9 @@
#define args (user, group, start, size, groupsp, limit, errnop)
#include "walk_nss.h"
#undef args
- if (status != NSS_STATUS_SUCCESS)
+ if (status == NSS_STATUS_NOTFOUND || status == NSS_STATUS_UNAVAIL)
+ return NSS_STATUS_SUCCESS;
+ else if (status != NSS_STATUS_SUCCESS)
return status;
for (; in < *start; ++in) {
Modified: trunk/debathena/debathena/libnss-nonlocal/nonlocal-passwd.c
===================================================================
--- trunk/debathena/debathena/libnss-nonlocal/nonlocal-passwd.c 2013-06-13 09:28:48 UTC (rev 26034)
+++ trunk/debathena/debathena/libnss-nonlocal/nonlocal-passwd.c 2013-06-13 09:30:01 UTC (rev 26035)
@@ -25,18 +25,19 @@
#define _GNU_SOURCE
+
#include <sys/types.h>
-#include <unistd.h>
+#include <dlfcn.h>
+#include <errno.h>
+#include <nss.h>
+#include <pwd.h>
+#include <stdbool.h>
+#include <stddef.h>
#include <stdlib.h>
-#include <stdint.h>
#include <string.h>
-#include <dlfcn.h>
-#include <stdio.h>
#include <syslog.h>
-#include <errno.h>
-#include <pwd.h>
-#include <grp.h>
-#include <nss.h>
+#include <unistd.h>
+
#include "nsswitch-internal.h"
#include "nonlocal.h"
@@ -161,6 +162,7 @@
}
+static bool pwent_initialized = false;
static service_user *pwent_startp, *pwent_nip;
static void *pwent_fct_start;
static union {
@@ -185,9 +187,12 @@
if (status != NSS_STATUS_SUCCESS)
return status;
- if (pwent_fct_start == NULL)
+ if (!pwent_initialized) {
__nss_passwd_nonlocal_lookup(&pwent_startp, pwent_fct_name,
&pwent_fct_start);
+ __sync_synchronize();
+ pwent_initialized = true;
+ }
pwent_nip = pwent_startp;
pwent_fct.ptr = pwent_fct_start;
return NSS_STATUS_SUCCESS;
@@ -199,7 +204,7 @@
enum nss_status status;
const struct walk_nss w = {
.lookup = &__nss_passwd_nonlocal_lookup, .fct_name = "endpwent",
- .status = &status
+ .status = &status, .all_values = 1,
};
const __typeof__(&_nss_nonlocal_endpwent) self = NULL;
Modified: trunk/debathena/debathena/libnss-nonlocal/nonlocal-shadow.c
===================================================================
--- trunk/debathena/debathena/libnss-nonlocal/nonlocal-shadow.c 2013-06-13 09:28:48 UTC (rev 26034)
+++ trunk/debathena/debathena/libnss-nonlocal/nonlocal-shadow.c 2013-06-13 09:30:01 UTC (rev 26035)
@@ -23,17 +23,17 @@
*/
#define _GNU_SOURCE
+
#include <sys/types.h>
-#include <unistd.h>
+#include <dlfcn.h>
+#include <errno.h>
+#include <nss.h>
+#include <shadow.h>
+#include <stdbool.h>
+#include <stddef.h>
#include <stdlib.h>
-#include <stdint.h>
#include <string.h>
-#include <dlfcn.h>
-#include <stdio.h>
#include <syslog.h>
-#include <errno.h>
-#include <shadow.h>
-#include <nss.h>
#include "nsswitch-internal.h"
#include "nonlocal.h"
@@ -58,6 +58,7 @@
}
+static bool spent_initialized = false;
static service_user *spent_startp, *spent_nip;
static void *spent_fct_start;
static union {
@@ -82,9 +83,12 @@
if (status != NSS_STATUS_SUCCESS)
return status;
- if (spent_fct_start == NULL)
+ if (!spent_initialized) {
__nss_shadow_nonlocal_lookup(&spent_startp, spent_fct_name,
&spent_fct_start);
+ __sync_synchronize();
+ spent_initialized = true;
+ }
spent_nip = spent_startp;
spent_fct.ptr = spent_fct_start;
return NSS_STATUS_SUCCESS;
@@ -113,6 +117,11 @@
int *errnop)
{
enum nss_status status;
+
+ char *nonlocal_ignore = getenv(NONLOCAL_IGNORE_ENV);
+ if (nonlocal_ignore != NULL && nonlocal_ignore[0] != '\0')
+ return NSS_STATUS_UNAVAIL;
+
if (spent_nip == NULL) {
status = _nss_nonlocal_setspent(0);
if (status != NSS_STATUS_SUCCESS)
Modified: trunk/debathena/debathena/libnss-nonlocal/nonlocal.h
===================================================================
--- trunk/debathena/debathena/libnss-nonlocal/nonlocal.h 2013-06-13 09:28:48 UTC (rev 26034)
+++ trunk/debathena/debathena/libnss-nonlocal/nonlocal.h 2013-06-13 09:30:01 UTC (rev 26035)
@@ -49,6 +49,7 @@
struct walk_nss {
enum nss_status *status;
+ int all_values;
int (*lookup)(service_user **ni, const char *fct_name,
void **fctp) internal_function;
const char *fct_name;
Modified: trunk/debathena/debathena/libnss-nonlocal/walk_nss.h
===================================================================
--- trunk/debathena/debathena/libnss-nonlocal/walk_nss.h 2013-06-13 09:28:48 UTC (rev 26034)
+++ trunk/debathena/debathena/libnss-nonlocal/walk_nss.h 2013-06-13 09:30:01 UTC (rev 26035)
@@ -24,8 +24,9 @@
*/
{
- static service_user *startp = NULL;
- static void *fct_start = NULL;
+ static bool initialized = false;
+ static service_user *startp;
+ static void *fct_start;
service_user *nip;
union {
@@ -34,10 +35,13 @@
} fct;
int old_errno = errno;
- if (fct_start == NULL &&
- w.lookup(&startp, w.fct_name, &fct_start) != 0) {
- *w.status = NSS_STATUS_UNAVAIL;
- goto walk_nss_out;
+ if (!initialized) {
+ if (w.lookup(&startp, w.fct_name, &fct_start) != 0) {
+ *w.status = NSS_STATUS_UNAVAIL;
+ goto walk_nss_out;
+ }
+ __sync_synchronize();
+ initialized = true;
}
nip = startp;
@@ -75,7 +79,8 @@
}
goto walk_nss_morebuf;
}
- } while (__nss_next(&nip, w.fct_name, &fct.ptr, *w.status, 0) == 0);
+ } while (__nss_next(&nip, w.fct_name, &fct.ptr, *w.status, w.all_values) ==
+ 0);
if (w.buf != NULL && *w.status != NSS_STATUS_SUCCESS) {
free(*w.buf);