From 57abdf3eaa424deafda497a4a896328238353e18 Mon Sep 17 00:00:00 2001
From: Laurent Bercot
Date: Sun, 6 Dec 2020 15:32:11 +0000
Subject: Prepare for 0.1.0.0, add --enable-libc-includes configure switch
pwd.h, grp.h and shadow.h will not overwrite the libc headers
by default anymore; you need to explicitly add the switch.
---
INSTALL | 4 ++--
Makefile | 12 +++---------
NEWS | 5 ++++-
configure | 12 ++++++++++--
doc/index.html | 8 ++++----
doc/libnsss/index.html | 25 ++++++++++++++++++++++---
doc/upgrade.html | 10 ++++++++--
package/info | 2 +-
package/targets.mak | 4 ++++
src/include/grp.h | 13 -------------
src/include/nsss/grp.h | 19 +++++++++++++++++++
src/include/nsss/pwd.h | 13 +++++++++++++
src/include/nsss/shadow.h | 19 +++++++++++++++++++
src/include/pwd.h | 7 -------
src/include/shadow.h | 13 -------------
15 files changed, 109 insertions(+), 57 deletions(-)
diff --git a/INSTALL b/INSTALL
index e57679e..4424944 100644
--- a/INSTALL
+++ b/INSTALL
@@ -6,8 +6,8 @@ Build Instructions
- A POSIX-compliant C development environment
- GNU make version 3.81 or later
- - skalibs version 2.9.2.1 or later: https://skarnet.org/software/skalibs/
- - To run the test suite and the nsssd-* programs: s6 version 2.9.1.0 or later: https://skarnet.org/software/s6/
+ - skalibs version 2.10.0.0 or later: https://skarnet.org/software/skalibs/
+ - To run the test suite and the nsssd-* programs: s6 version 2.10.0.0 or later: https://skarnet.org/software/s6/
This software will run on any operating system that implements
POSIX.1-2008, available at:
diff --git a/Makefile b/Makefile
index ce18023..68599cb 100644
--- a/Makefile
+++ b/Makefile
@@ -57,7 +57,7 @@ ALL_BINS := $(LIBEXEC_TARGETS) $(BIN_TARGETS)
ALL_LIBS := $(SHARED_LIBS) $(STATIC_LIBS) $(INTERNAL_LIBS)
ALL_INCLUDES := $(wildcard src/include/$(package)/*.h)
-all: $(ALL_LIBS) $(ALL_BINS) $(ALL_INCLUDES) src/include/pwd.h src/include/grp.h src/include/shadow.h
+all: $(ALL_LIBS) $(ALL_BINS) $(ALL_INCLUDES) $(EXTRA_INCLUDES)
clean:
@exec rm -f $(ALL_LIBS) $(ALL_BINS) $(wildcard src/*/*.o src/*/*.lo) $(TEST_BINS) $(EXTRA_TARGETS)
@@ -86,7 +86,7 @@ install-dynlib: $(SHARED_LIBS:lib%.so.xyzzy=$(DESTDIR)$(dynlibdir)/lib%.so)
install-libexec: $(LIBEXEC_TARGETS:%=$(DESTDIR)$(libexecdir)/%)
install-bin: $(BIN_TARGETS:%=$(DESTDIR)$(bindir)/%)
install-lib: $(STATIC_LIBS:lib%.a.xyzzy=$(DESTDIR)$(libdir)/lib%.a)
-install-include: $(ALL_INCLUDES:src/include/$(package)/%.h=$(DESTDIR)$(includedir)/$(package)/%.h) $(DESTDIR)$(includedir)/pwd.h $(DESTDIR)$(includedir)/grp.h $(DESTDIR)$(includedir)/shadow.h
+install-include: $(ALL_INCLUDES:src/include/$(package)/%.h=$(DESTDIR)$(includedir)/$(package)/%.h) $(EXTRA_INCLUDES:src/include/%.h=$(DESTDIR)$(includedir)/%.h)
install-data: $(ALL_DATA:src/etc/%=$(DESTDIR)$(datadir)/%)
tests: $(TEST_BINS)
@@ -134,13 +134,7 @@ $(DESTDIR)$(libdir)/lib%.a: lib%.a.xyzzy
$(DESTDIR)$(includedir)/$(package)/%.h: src/include/$(package)/%.h
exec $(INSTALL) -D -m 644 $< $@
-$(DESTDIR)$(includedir)/pwd.h: src/include/pwd.h
- exec $(INSTALL) -D -m 644 $< $@
-
-$(DESTDIR)$(includedir)/grp.h: src/include/grp.h
- exec $(INSTALL) -D -m 644 $< $@
-
-$(DESTDIR)$(includedir)/shadow.h: src/include/shadow.h
+$(DESTDIR)$(includedir)/%.h: src/include/%.h
exec $(INSTALL) -D -m 644 $< $@
%.o: %.c
diff --git a/NEWS b/NEWS
index 71084aa..5cac770 100644
--- a/NEWS
+++ b/NEWS
@@ -1,9 +1,12 @@
Changelog for nsss.
-In 0.0.2.3
+In 0.1.0.0
----------
- Bugfixes.
+ - pwd.h, grp.h and shadow.h are not installed by default anymore.
+You now need to explicitly give the --enable-libc-includes
+configure option.
In 0.0.2.2
diff --git a/configure b/configure
index 24a4a52..365404c 100755
--- a/configure
+++ b/configure
@@ -47,6 +47,7 @@ Optional features:
hardcode absolute BINDIR/foobar paths instead [disabled]
--with-nsssd-socket=PATH assume the nsssd socket is at PATH [/run/service/nsssd/s]
+ --enable-libc-includes overwrite {pwd,grp,shadow}.h in includedir [disabled]
EOF
exit 0
@@ -161,6 +162,7 @@ vpaths=''
vpathd=''
build=
nsssdpath=/run/service/nsssd/s
+libcincludes=false
for arg ; do
case "$arg" in
@@ -191,10 +193,12 @@ for arg ; do
--disable-slashpackage) sproot= ; slashpackage=false ;;
--enable-absolute-paths|--enable-absolute-paths=yes) abspath=true ;;
--disable-absolute-paths|--enable-absolute-paths=no) abspath=false ;;
+ --enable-libc-includes|--enable-libc-includes=yes) libcincludes=true ;;
+ --disable-libc-includes|--enable-libc-includes=no) libcincludes=false ;;
+ --with-nsssd-socket=*) nsssdpath=${arg#*=} ;;
--enable-*|--disable-*|--with-*|--without-*|--*dir=*) ;;
--host=*|--target=*) target=${arg#*=} ;;
--build=*) build=${arg#*=} ;;
- --with-nsssd-socket=*) nsssdpath=${arg#*=} ;;
-* ) echo "$0: unknown option $arg" ;;
*=*) ;;
*) target=$arg ;;
@@ -434,7 +438,11 @@ if $allpic ; then
else
echo "STATIC_LIBS_ARE_PIC :="
fi
-
+if $libcincludes ; then
+ echo "DO_LIBC_INCLUDES := 1"
+else
+ echo "DO_LIBC_INCLUDES :="
+fi
exec 1>&3 3>&-
echo " ... done."
diff --git a/doc/index.html b/doc/index.html
index 9c155a1..62b37bd 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -81,11 +81,11 @@ functions.
A POSIX-compliant system with a standard C development environment
GNU make, version 3.81 or later
skalibs version
-2.9.2.1 or later. It's a build-time requirement. It's also a run-time
+2.10.0.0 or later. It's a build-time requirement. It's also a run-time
requirement if you link against the shared version of the skalibs
library.
s6 version
-2.9.1.0 or later. It's a run-time requirement only, to run
+2.10.0.0 or later. It's a run-time requirement only, to run
the nsssd service (and can be done without if you have a suitable replacement
for s6-ipcserver).
@@ -94,13 +94,13 @@ for s6-ipcserver).
nsss is free software. It is available under the
-ISC license.
+ISC license.
Download
- - The current released version of nsss is 0.0.2.2.
+ - The current released version of nsss is 0.1.0.0.
- Alternatively, you can checkout a copy of the
nsss
git repository:
diff --git a/doc/libnsss/index.html b/doc/libnsss/index.html
index 3514c42..bbe5029 100644
--- a/doc/libnsss/index.html
+++ b/doc/libnsss/index.html
@@ -102,6 +102,17 @@ will automatically be aliased to nsss_all_getpwnam(), and
the other functions will be aliased similarly.
+
+ pwd.h can be found in the nsss/ subdirectory of
+the header installation directory; if the --enable-libc-includes
+option has been given to configure, it can also be found directly
+in that directory. (Example: /usr/include/nsss/pwd.h is
+always installed, but if the option has been given at nsss build time,
+/usr/include/pwd.h is also installed and replaces the
+version provided by the libc.) This also applies to the grp.h
+and shadow.h files.
+
+
If the NSSS_DISABLE_SWITCH macro is defined before inclusion of the
nsss headers, then getpwnam() will be aliased to
@@ -121,9 +132,17 @@ functions will follow the same pattern.
are visible in your header search path.
Use #include <nsss/nsss.h>
To use the standard pwd.h interface, you can
-just #include <pwd.h>, which will work as long
-as the nsss/pwd.h header is accessible in your header
-search path.
+just #include <pwd.h>, which will work:
+
+ - either if the --enable-libc-includes option
+has been given at nsss build time
+ - or if you give the -I/usr/include/nsss option
+to your compiler. (Depending on your standard header location,
+specify that the header search path should include the
+nsss subdirectory of that location.) This is useful when
+the administrator did not want to overwrite the libc-provided
+pwd.h file when they installed nsss.
+
Same thing for grp.h and shadow.h.
If don't want to use the nsss-all implementation of
"try nsss-switch and fall back to nsss-unix if it fails", then
diff --git a/doc/upgrade.html b/doc/upgrade.html
index b0ae772..00fffe3 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -18,11 +18,17 @@
What has changed in nsss
- in 0.0.2.3
+ in 0.1.0.0
- skalibs dependency bumped to
-2.9.2.1.
+2.10.0.0.
+ s6 optional dependency bumped to
+2.10.0.0.
+ The pwd.h, grp.h and shadow.h header files are
+not installed by default anymore. You now need to explicitly give the
+--enable-libc-includes configure option in order to install them. The
+point of this change is to avoid overwriting libc headers accidentally.
in 0.0.2.2
diff --git a/package/info b/package/info
index 5c1c699..aafdb5e 100644
--- a/package/info
+++ b/package/info
@@ -1,4 +1,4 @@
package=nsss
-version=0.0.2.3
+version=0.1.0.0
category=admin
package_macro_name=NSSS
diff --git a/package/targets.mak b/package/targets.mak
index e58f396..bc1f9c0 100644
--- a/package/targets.mak
+++ b/package/targets.mak
@@ -10,3 +10,7 @@ test-unix \
test-all-fallback
LIB_DEFS := NSSS=nsss NSSSD=nsssd
+
+ifneq ($(DO_LIBC_INCLUDES),)
+EXTRA_INCLUDES := src/include/pwd.h src/include/grp.h src/include/shadow.h
+endif
diff --git a/src/include/grp.h b/src/include/grp.h
index a30fe79..7c5b8f9 100644
--- a/src/include/grp.h
+++ b/src/include/grp.h
@@ -10,17 +10,4 @@
#include
-#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-#include
-extern int setgroups (size_t, gid_t const *) ;
-extern int initgroups (char const *, gid_t) ;
-#endif
-
-#ifdef _GNU_SOURCE
-#include
-extern struct group *fgetgrent (FILE *) ;
-extern int fgetgrent_r (FILE *, struct group *, char *, size_t, struct group **) ;
-extern int putgrent (struct group const *, FILE *) ;
-#endif
-
#endif
diff --git a/src/include/nsss/grp.h b/src/include/nsss/grp.h
index 0d56cbd..e26ae05 100644
--- a/src/include/nsss/grp.h
+++ b/src/include/nsss/grp.h
@@ -62,6 +62,25 @@ extern "C" {
#endif
#endif
+ /*
+ The following functions are not implemented by nsss.
+ However, the libc may implement them, so we still need to
+ declare them. Of course, we only declare functions that
+ do not conflict with nsss operation.
+ */
+
+#if defined(_GNU_SOURCE) || defined(_DEFAULT_SOURCE)
+#include
+extern int setgroups (size_t, gid_t const *) ;
+extern int initgroups (char const *, gid_t) ;
+#endif
+
+#ifdef _GNU_SOURCE
+#include
+extern struct group *fgetgrent (FILE *) ;
+extern int fgetgrent_r (FILE *, struct group *, char *, size_t, struct group **) ;
+extern int putgrent (struct group const *, FILE *) ;
+#endif
#ifdef __cplusplus
}
diff --git a/src/include/nsss/pwd.h b/src/include/nsss/pwd.h
index 950a5ce..f3c7000 100644
--- a/src/include/nsss/pwd.h
+++ b/src/include/nsss/pwd.h
@@ -50,6 +50,19 @@ extern "C" {
#endif
#endif
+ /*
+ The following functions are not implemented by nsss.
+ However, the libc may implement them, so we still need to
+ declare them. Of course, we only declare functions that
+ do not conflict with nsss operation.
+ */
+
+#ifdef _GNU_SOURCE
+#include
+extern struct passwd *fgetpwent (FILE *) ;
+extern int fgetpwent_r (FILE *, struct passwd *, char *, size_t, struct passwd **) ;
+extern int putpwent (struct passwd const *, FILE *) ;
+#endif
#ifdef __cplusplus
}
diff --git a/src/include/nsss/shadow.h b/src/include/nsss/shadow.h
index c3357fd..5665fc8 100644
--- a/src/include/nsss/shadow.h
+++ b/src/include/nsss/shadow.h
@@ -44,6 +44,25 @@ extern "C" {
#endif
#endif
+ /*
+ The following functions are not implemented by nsss.
+ However, the libc may implement them, so we still need to
+ declare them. Of course, we only declare functions that
+ do not conflict with nsss operation.
+ */
+
+#include
+
+extern struct spwd *fgetspent (FILE *) ;
+extern struct spwd *sgetspent (char const *) ;
+extern int putspent (struct spwd const *, FILE *) ;
+extern int lckpwdf (void) ;
+extern int ulckpwdf (void) ;
+
+#ifdef _DEFAULT_SOURCE
+extern int fgetspent_r(FILE *, struct spwd *, char *, size_t, struct spwd **) ;
+extern int sgetspent_r (char const *, struct spwd *, char *, size_t, struct spwd **) ;
+#endif
#ifdef __cplusplus
}
diff --git a/src/include/pwd.h b/src/include/pwd.h
index 6ad4faf..22aa835 100644
--- a/src/include/pwd.h
+++ b/src/include/pwd.h
@@ -10,11 +10,4 @@
#include
-#ifdef _GNU_SOURCE
-#include
-extern struct passwd *fgetpwent (FILE *) ;
-extern int fgetpwent_r (FILE *, struct passwd *, char *, size_t, struct passwd **) ;
-extern int putpwent (struct passwd const *, FILE *) ;
-#endif
-
#endif
diff --git a/src/include/shadow.h b/src/include/shadow.h
index 00d1944..96a2719 100644
--- a/src/include/shadow.h
+++ b/src/include/shadow.h
@@ -10,17 +10,4 @@
#include
-#include
-
-extern struct spwd *fgetspent (FILE *) ;
-extern struct spwd *sgetspent (char const *) ;
-extern int putspent (struct spwd const *, FILE *) ;
-extern int lckpwdf (void) ;
-extern int ulckpwdf (void) ;
-
-#ifdef _DEFAULT_SOURCE
-extern int fgetspent_r(FILE *, struct spwd *, char *, size_t, struct spwd **) ;
-extern int sgetspent_r (char const *, struct spwd *, char *, size_t, struct spwd **) ;
-#endif
-
#endif
--
cgit 1.4.1