diff options
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | src/libnsss/nsss_switch_grp_end.c | 2 | ||||
-rw-r--r-- | tests/src/test-all.c | 46 | ||||
-rw-r--r-- | tests/src/test-unix.c | 46 |
4 files changed, 101 insertions, 3 deletions
@@ -87,7 +87,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)/utmpx.h +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-data: $(ALL_DATA:src/etc/%=$(DESTDIR)$(datadir)/%) ifneq ($(exthome),) @@ -130,7 +130,13 @@ $(DESTDIR)$(libdir)/lib%.a: lib%.a.xyzzy $(DESTDIR)$(includedir)/$(package)/%.h: src/include/$(package)/%.h exec $(INSTALL) -D -m 644 $< $@ -$(DESTDIR)$(includedir)/utmpx.h: src/include/utmpx.h +$(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 exec $(INSTALL) -D -m 644 $< $@ %.o: %.c diff --git a/src/libnsss/nsss_switch_grp_end.c b/src/libnsss/nsss_switch_grp_end.c index 3b25cdf..3b8ba21 100644 --- a/src/libnsss/nsss_switch_grp_end.c +++ b/src/libnsss/nsss_switch_grp_end.c @@ -3,7 +3,7 @@ #include <nsss/nsss-switch.h> #include "nsss-switch-internal.h" -int nsss_grent_end (nsss_switch_t *a, tain_t const *deadline, tain_t *stamp) +int nsss_switch_grp_end (nsss_switch_t *a, tain_t const *deadline, tain_t *stamp) { return nsss_switch_op(a, NSSS_SWITCH_GRP_END, deadline, stamp) ; } diff --git a/tests/src/test-all.c b/tests/src/test-all.c new file mode 100644 index 0000000..147868a --- /dev/null +++ b/tests/src/test-all.c @@ -0,0 +1,46 @@ +/* ISC license. */ + +#include <errno.h> +#include <skalibs/buffer.h> +#include <skalibs/lolstdio.h> +#include <nsss/pwd.h> +#include <nsss/nsss-all.h> + +int main (void) +{ + for (;;) + { + struct passwd *pw ; + errno = 0 ; + pw = nsss_all_getpwent() ; + if (!pw) break ; + lolprintf("%s:%s:%d:%d:%s:%s:%s\n", pw->pw_name, pw->pw_passwd, (int)pw->pw_uid, (int)pw->pw_gid, pw->pw_gecos, pw->pw_dir, pw->pw_shell) ; + } + if (errno) + strerr_diefu1sys(111, "nsss_all_getpwent") ; + nsss_all_endpwent() ; + buffer_flush(buffer_1) ; + lolprintf("\n") ; + + for (;;) + { + struct group *gr ; + char **p ; + errno = 0 ; + gr = nsss_all_getgrent() ; + if (!gr) break ; + p = gr->gr_mem ; + lolprintf("%s:%s:%d:", gr->gr_name, gr->gr_passwd, (int)gr->gr_gid) ; + if (*p) + { + while (*p) lolprintf("%s,", *p++) ; + buffer_unput(buffer_1, 1) ; + } + buffer_put(buffer_1, "\n", 1) ; + } + if (errno) + strerr_diefu1sys(111, "nsss_all_getgrent") ; + nsss_all_endgrent() ; + buffer_flush(buffer_1) ; + return 0 ; +} diff --git a/tests/src/test-unix.c b/tests/src/test-unix.c new file mode 100644 index 0000000..e62fa01 --- /dev/null +++ b/tests/src/test-unix.c @@ -0,0 +1,46 @@ +/* ISC license. */ + +#include <errno.h> +#include <skalibs/buffer.h> +#include <skalibs/lolstdio.h> +#include <nsss/pwd.h> +#include <nsss/nsss-unix.h> + +int main (void) +{ + for (;;) + { + struct passwd *pw ; + errno = 0 ; + pw = nsss_unix_getpwent() ; + if (!pw) break ; + lolprintf("%s:%s:%d:%d:%s:%s:%s\n", pw->pw_name, pw->pw_passwd, (int)pw->pw_uid, (int)pw->pw_gid, pw->pw_gecos, pw->pw_dir, pw->pw_shell) ; + } + if (errno) + strerr_diefu1sys(111, "nsss_unix_getpwent") ; + nsss_unix_endpwent() ; + buffer_flush(buffer_1) ; + lolprintf("\n") ; + + for (;;) + { + struct group *gr ; + char **p ; + errno = 0 ; + gr = nsss_unix_getgrent() ; + if (!gr) break ; + p = gr->gr_mem ; + lolprintf("%s:%s:%d:", gr->gr_name, gr->gr_passwd, (int)gr->gr_gid) ; + if (*p) + { + while (*p) lolprintf("%s,", *p++) ; + buffer_unput(buffer_1, 1) ; + } + buffer_put(buffer_1, "\n", 1) ; + } + if (errno) + strerr_diefu1sys(111, "nsss_unix_getgrent") ; + nsss_unix_endgrent() ; + buffer_flush(buffer_1) ; + return 0 ; +} |