about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-12-06 15:32:11 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-12-06 15:32:11 +0000
commit57abdf3eaa424deafda497a4a896328238353e18 (patch)
treebf991c3cec997d65842f52c2e09a8ba439e98e83
parentec85192dacc1bc1ca2efaad4e469d4d1831bce9c (diff)
downloadnsss-57abdf3eaa424deafda497a4a896328238353e18.tar.gz
nsss-57abdf3eaa424deafda497a4a896328238353e18.tar.xz
nsss-57abdf3eaa424deafda497a4a896328238353e18.zip
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.
-rw-r--r--INSTALL4
-rw-r--r--Makefile12
-rw-r--r--NEWS5
-rwxr-xr-xconfigure12
-rw-r--r--doc/index.html8
-rw-r--r--doc/libnsss/index.html25
-rw-r--r--doc/upgrade.html10
-rw-r--r--package/info2
-rw-r--r--package/targets.mak4
-rw-r--r--src/include/grp.h13
-rw-r--r--src/include/nsss/grp.h19
-rw-r--r--src/include/nsss/pwd.h13
-rw-r--r--src/include/nsss/shadow.h19
-rw-r--r--src/include/pwd.h7
-rw-r--r--src/include/shadow.h13
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.
  <li> A POSIX-compliant system with a standard C development environment </li>
  <li> GNU make, version 3.81 or later </li>
  <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> 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. </li>
  <li> <a href="//skarnet.org/software/s6/">s6</a> version
-2.9.1.0 or later. It's a <em>run-time</em> requirement only, to run
+2.10.0.0 or later. It's a <em>run-time</em> requirement only, to run
 the nsssd service (and can be done without if you have a suitable replacement
 for <a href="//skarnet.org/software/s6/s6-ipcserver">s6-ipcserver</a>). </li>
 </ul>
@@ -94,13 +94,13 @@ for <a href="//skarnet.org/software/s6/s6-ipcserver">s6-ipcserver</a>). </li>
 
 <p>
  nsss is free software. It is available under the
-<a href="http://opensource.org/licenses/ISC">ISC license</a>.
+<a href="https://opensource.org/licenses/ISC">ISC license</a>.
 </p>
 
 <h3> Download </h3>
 
 <ul>
- <li> The current released version of nsss is <a href="nsss-0.0.2.2.tar.gz">0.0.2.2</a>. </li>
+ <li> The current released version of nsss is <a href="nsss-0.1.0.0.tar.gz">0.1.0.0</a>. </li>
  <li> Alternatively, you can checkout a copy of the
 <a href="//git.skarnet.org/cgi-bin/cgit.cgi/nsss/">nsss
 git repository</a>:
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
@@ -103,6 +103,17 @@ the other functions will be aliased similarly.
 </p>
 
 <p>
+ <tt>pwd.h</tt> can be found in the <tt>nsss/</tt> subdirectory of
+the header installation directory; if the <tt>--enable-libc-includes</tt>
+option has been given to configure, it can also be found directly
+in that directory. (Example: <tt>/usr/include/nsss/pwd.h</tt> is
+always installed, but if the option has been given at nsss build time,
+<tt>/usr/include/pwd.h</tt> is also installed and replaces the
+version provided by the libc.) This also applies to the <tt>grp.h</tt>
+and <tt>shadow.h</tt> files.
+</p>
+
+<p>
  If the NSSS_DISABLE_SWITCH macro is defined before inclusion of the
 nsss headers, then <tt>getpwnam()</tt> will be aliased to
 <tt>nsss_unix_getpwnam()</tt> instead, and the other functions will
@@ -121,9 +132,17 @@ functions will follow the same pattern.
 are visible in your header search path. </li>
  <li> Use <tt>#include &lt;nsss/nsss.h&gt;</tt> </li>
  <li> To use the standard <tt>pwd.h</tt> interface, you can
-just <tt>#include &lt;pwd.h&gt;</tt>, which will work as long
-as the <tt>nsss/pwd.h</tt> header is accessible in your header
-search path. </li>
+just <tt>#include &lt;pwd.h&gt;</tt>, which will work:
+  <ul>
+   <li> either if the <tt>--enable-libc-includes</tt> option
+has been given at nsss build time </li>
+   <li> or if you give the <tt>-I/usr/include/nsss</tt> option
+to your compiler. (Depending on your standard header location,
+specify that the header search path should include the
+<tt>nsss</tt> subdirectory of that location.) This is useful when
+the administrator did not want to overwrite the libc-provided
+<tt>pwd.h</tt> file when they installed nsss. </li>
+  </ul> </li>
  <li> Same thing for <tt>grp.h</tt> and <tt>shadow.h</tt>. </li>
  <li> 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 @@
 
 <h1> What has changed in nsss </h1>
 
-<h2> in 0.0.2.3 </h2>
+<h2> in 0.1.0.0 </h2>
 
 <ul>
  <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> dependency bumped to
-2.9.2.1. </li>
+2.10.0.0. </li>
+ <li> <a href="//skarnet.org/software/s6/">s6</a> optional dependency bumped to
+2.10.0.0. </li>
+ <li> The <tt>pwd.h</tt>, <tt>grp.h</tt> and <tt>shadow.h</tt> header files are
+not installed by default anymore. You now need to explicitly give the
+<tt>--enable-libc-includes</tt> configure option in order to install them. The
+point of this change is to avoid overwriting libc headers accidentally. </li>
 </ul>
 
 <h2> in 0.0.2.2 </h2>
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 <nsss/grp.h>
 
-#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-#include <sys/types.h>
-extern int setgroups (size_t, gid_t const *) ;
-extern int initgroups (char const *, gid_t) ;
-#endif
-
-#ifdef _GNU_SOURCE
-#include <stdio.h>
-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 <sys/types.h>
+extern int setgroups (size_t, gid_t const *) ;
+extern int initgroups (char const *, gid_t) ;
+#endif
+
+#ifdef _GNU_SOURCE
+#include <stdio.h>
+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 <stdio.h>
+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 <stdio.h>
+
+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 <nsss/pwd.h>
 
-#ifdef _GNU_SOURCE
-#include <stdio.h>
-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 <nsss/shadow.h>
 
-#include <stdio.h>
-
-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