summaryrefslogtreecommitdiff
path: root/sys-libs/pwdb
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-libs/pwdb
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-libs/pwdb')
-rw-r--r--sys-libs/pwdb/Manifest7
-rw-r--r--sys-libs/pwdb/files/pwdb-0.62-build.patch114
-rw-r--r--sys-libs/pwdb/files/pwdb-0.62-selinux.patch443
-rw-r--r--sys-libs/pwdb/metadata.xml8
-rw-r--r--sys-libs/pwdb/pwdb-0.62.ebuild57
5 files changed, 629 insertions, 0 deletions
diff --git a/sys-libs/pwdb/Manifest b/sys-libs/pwdb/Manifest
new file mode 100644
index 000000000000..1980d280134a
--- /dev/null
+++ b/sys-libs/pwdb/Manifest
@@ -0,0 +1,7 @@
+AUX pwdb-0.62-build.patch 2920 SHA256 39203b664af9404a4c10271d695c7644a8de1540c1e2d8b66c389d7bb2cc3852 SHA512 fb6b1bb322daf4a343b31fd8cadb1c546682421775670a361721272ea5811cb87b8215aa1c7bad624334da826ddab4776a4809fce0613346a4560ffce8af3bba WHIRLPOOL 7e4dd3e41690300f1b38c3c329691b3285d8bbd67690092f3c86271c2d6dce5486c31ba7478f4cfd5ca7131deae4896dc3138cfb14bd40058bbefe646fbf2ff1
+AUX pwdb-0.62-selinux.patch 10371 SHA256 cb8fad56d4ade81a0ad3ff117508638736a1b58c9b27dcb1a402911baf4e9496 SHA512 63cb33af31179183c32f738c90ac2144e8d8092034faa5bcd0c5420832e51018e7e9ffcea59c8354ee0ae598e53dbd120cd9338ab80b0e5df6cc1c53eb75b818 WHIRLPOOL c89023691c93a6ece7d7edf40250cb52fe306c12f8062149a2a4c07ae2e0db2efec5891786aecc7af5a9f09a12d52e6676c610bc9815ef89ce32f7540587aa8f
+DIST pwdb-0.62.tar.gz 133183 SHA256 1e0420b92c9996f82b3364b982f7d6c62460c513afa329b78317b3037dc3d4b9 SHA512 baba1f42125a4773f2e645129be79e0e5fbd0b0da7c6624f4b1d13e59cb65f5807bd22997aa1ba360c7627f2aff93c9949b2bb5fbd27d74b516853bcbca96ef4 WHIRLPOOL 02148b696ff00099101d0d9488a0c42c1848cd42db377a14154c3d983bdbb7b4a7d4364e7f29060771ca74e530279f3bc33d49960c0d697dae8bf6a3de8d33f2
+EBUILD pwdb-0.62.ebuild 1368 SHA256 a6d8adca4f910a1673246123c5403a4b4a52411abb0bc18f3569c925d8916f98 SHA512 e98a4769a546ad856d15730ec1337b47fbdac1379d6ed9e8fd9f6dec62eec44947d87333da96cb1494886a2f6c787082c8f26c6a25df712260c87c29ab84047c WHIRLPOOL de5db6b23785219c8ea3a1722ef3878ebc417c115981ddf1b32dfb1325ac14613c75f21fad6f9fccf6c930a056015b8a34d20cd84193181f36d395d87f219125
+MISC ChangeLog 3332 SHA256 9087eee9aebd8700cccd8fc368c5cb620aec00db4a625dcb325fe3853cd48d03 SHA512 a2e47037ef71c92cf7fd98f71ad9308e2c24b28df68e2a76ea2f01eab89f1feb3a0cb4aa50a93c3d6cde7d26b89651c067f308701fa3cede20cd26742af18376 WHIRLPOOL 26b6ef3457d91383aff52ab5fbc6009deb9f2ab0cb8c97737fe6f8a55235967eb88f1d82888786335cd26443aeaa20ac885fe0326e42502842585372d0bfcab4
+MISC ChangeLog-2015 5067 SHA256 4a6b679b2ba91a8530235b79585455e4aac6a768cacce556501cce2b063c24f2 SHA512 d6a85bd4de03f49d17afa3ac59aa9c049e9010c09c9f63109e6c297a77015a713c53d486c85d3371293a4511367ccbcadc85138f0e48d327b9e10471810b82bc WHIRLPOOL 8b10c703c7353dc41408790f90c567d1248000a9c94bc9e5dc2a8ea7aeb85f09e75d90316d0984a16bc34ee760a407db054e9862f794344f90a097dc4b98ffb1
+MISC metadata.xml 253 SHA256 d82c33ef453113a5c1ebe250dcba373c22934a69b0a86c6ab15a5ca589c25b91 SHA512 54a9069aeb4165d2dff3d473c8001bc51613aac9dff3f7f5e9971a9891a737a31511ffa11cbd523febe581ac1d9de2bdf2f40410f0c4239138f2ccca3ef15555 WHIRLPOOL e5aee23acff864609953a1e4de768f0e4aef704b44c53c021f28573e1ca5c99f1a46d92935ecec2449f7b4419a36d8373127d0ecfa8d7bae72d835e1839eb3f8
diff --git a/sys-libs/pwdb/files/pwdb-0.62-build.patch b/sys-libs/pwdb/files/pwdb-0.62-build.patch
new file mode 100644
index 000000000000..ecef517b1ca3
--- /dev/null
+++ b/sys-libs/pwdb/files/pwdb-0.62-build.patch
@@ -0,0 +1,114 @@
+ - drop ldconfig junk
+ - fix types used in socket functions (socklen_t, not int)
+
+http://bugs.gentoo.org/126977
+ - respect user LDFLAGS
+
+http://bugs.gentoo.org/126695
+ - add missing headers
+ - add missing comma to supp_entry
+
+http://bugs.gentoo.org/137134
+ - don't show traditional warnings
+
+--- Makefile
++++ Makefile
+@@ -71,7 +71,7 @@
+
+ WARNINGS += -ansi -D_POSIX_SOURCE -Wall -Wwrite-strings \
+ -Wcast-qual -Wcast-align \
+- -Wtraditional -Wstrict-prototypes -Wmissing-prototypes \
++ -Wstrict-prototypes -Wmissing-prototypes \
+ -Wnested-externs -Winline -Wshadow
+ INCLUDEDIR=-I$(CRTDIR)/include
+
+--- libpwdb/Makefile
++++ libpwdb/Makefile
+@@ -50,7 +50,7 @@
+
+
+ $(LIBDYNAME): $(LIBOBJ)
+- $(LD) -soname $(LIBSONAME) -x -shared -o $(LIBFILENAME) $(LIBOBJ) -lcrypt -lnsl -lc
++ $(CC) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIBSONAME) -Wl,-x -o $(LIBFILENAME) $(LIBOBJ) -lcrypt -lnsl $(LDLIBS)
+ @ln -sf $(LIBFILENAME) $@
+
+ $(LIBSTATIC): $(LIBOBJ)
+@@ -68,7 +68,7 @@
+ $(INSTALL) -m 644 radius.h $(INCLUDED)/radius.h
+ $(INSTALL) -m 644 _pwdb_macros.h $(INCLUDED)/_pwdb_macros.h
+ $(INSTALL) -m 755 $(LIBFILENAME) $(LIBDIR)
+- $(LDCONFIG)
++ ln -sf $(LIBFILENAME) $(LIBDIR)/$(LIBSONAME)
+ ln -sf $(LIBFILENAME) $(LIBDIR)/$(LIBDYNAME)
+ $(INSTALL) -m 644 $(LIBSTATIC) $(LIBDIR)
+
+--- libpwdb/posix/pwd.c
++++ libpwdb/posix/pwd.c
+@@ -7,6 +7,7 @@
+ */
+
+ #include <stdio.h>
++#include <string.h>
+
+ #define PWDB_HARD_CORE 1
+ #include <pwdb/pwdb_public.h>
+--- libpwdb/posix/undefined.c
++++ libpwdb/posix/undefined.c
+@@ -5,6 +5,7 @@
+ */
+
+ #include <stdio.h>
++#include <stdlib.h>
+
+ #define PWDB_HARD_CORE 1
+ #include <pwdb/pwdb_public.h>
+--- libpwdb/pwdb/pwdb_helper.c
++++ libpwdb/pwdb/pwdb_helper.c
+@@ -18,6 +18,7 @@
+ *
+ */
+
++#include <string.h>
+ #include "pwdb_public.h"
+ #include "pwdb_module.h"
+
+--- libpwdb/pwdb/interface/shadow/group.c
++++ libpwdb/pwdb/interface/shadow/group.c
+@@ -533,7 +533,7 @@
+
+ static const char *supp_entry[] = {
+ "group", "passwd",
+- "users", "admins" /* these are from /etc/group */
++ "users", "admins", /* these are from /etc/group */
+ "groups", /* these are serviced by requests */
+ NULL
+ };
+--- libpwdb/radius/radius.c
++++ libpwdb/radius/radius.c
+@@ -145,7 +145,7 @@
+ const char* password,
+ RADIUS_RESULT *rad_result)
+ {
+- int salen;
++ socklen_t salen;
+ int sockfd;
+ struct sockaddr saremote;
+ struct sockaddr_in *s_in;
+@@ -333,7 +333,7 @@
+ const char* new_password,
+ RADIUS_RESULT *rad_result)
+ {
+- int salen;
++ socklen_t salen;
+ int sockfd;
+ struct sockaddr saremote;
+ struct sockaddr_in *s_in;
+@@ -535,7 +535,7 @@
+ int sense,
+ int session_time)
+ {
+- int salen;
++ socklen_t salen;
+ int sockfd;
+ struct sockaddr saremote;
+ struct sockaddr_in *s_in;
diff --git a/sys-libs/pwdb/files/pwdb-0.62-selinux.patch b/sys-libs/pwdb/files/pwdb-0.62-selinux.patch
new file mode 100644
index 000000000000..106be5645176
--- /dev/null
+++ b/sys-libs/pwdb/files/pwdb-0.62-selinux.patch
@@ -0,0 +1,443 @@
+--- pwdb-0.62/examples/Makefile.pwdbselinux 1998-10-06 19:57:04.000000000 -0400
++++ pwdb-0.62/examples/Makefile 2003-07-09 14:45:54.702663000 -0400
+@@ -4,6 +4,8 @@ PROGS = posix gentest tpwdb radtest grou
+ SRCS = $(addsuffix .c,$(PROGS))
+ OBJS = $(addsuffix .o,$(PROGS))
+
++SELINUXLIBS = -lselinux
++
+ # rules
+ junk:
+ @echo "this is not a top-level Makefile"
+@@ -14,20 +16,20 @@ junk:
+
+ all: ${PROGS} ../libpwdb/libpwdb.a
+
+-posix: posix.o ../libpwdb/libpwdb.a
+- $(CC) -o $@ $< ../libpwdb/libpwdb.a -lnsl
++posix: posix.o ../libpwdb/libpwdb.a
++ $(CC) -o $@ $< ../libpwdb/libpwdb.a -lnsl ${SELINUXLIBS}
+
+ tpwdb: tpwdb.o ../libpwdb/libpwdb.a
+- ${CC} -g -o $@ $< ../libpwdb/libpwdb.a -lnsl
++ ${CC} -g -o $@ $< ../libpwdb/libpwdb.a -lnsl ${SELINUXLIBS}
+
+ radtest: radtest.o ../libpwdb/libpwdb.a
+- ${CC} -g -o $@ $< ../libpwdb/libpwdb.a -lnsl
++ ${CC} -g -o $@ $< ../libpwdb/libpwdb.a -lnsl ${SELINUXLIBS}
+
+ gentest: gentest.o ../libpwdb/libpwdb.a
+- ${CC} -g -o $@ $< ../libpwdb/libpwdb.a -lnsl
++ ${CC} -g -o $@ $< ../libpwdb/libpwdb.a -lnsl ${SELINUXLIBS}
+
+ grouptest: grouptest.o ../libpwdb/libpwdb.a
+- ${CC} -g -o $@ $< ../libpwdb/libpwdb.a -lnsl
++ ${CC} -g -o $@ $< ../libpwdb/libpwdb.a -lnsl ${SELINUXLIBS}
+
+ clean:
+ rm -f ${PROGS} *.o *~
+--- pwdb-0.62/libpwdb/shadow/shadowio.c.pwdbselinux 1998-10-06 16:58:43.000000000 -0400
++++ pwdb-0.62/libpwdb/shadow/shadowio.c 2003-07-09 14:45:54.705662544 -0400
+@@ -16,6 +16,12 @@
+
+ #include "../_pwdb_internal.h"
+
++#ifdef WITH_SELINUX
++#include <selinux/selinux.h>
++static int selinux_enabled=0;
++static security_context_t prev_context=NULL;
++#endif
++
+ struct spw_file_entry {
+ char *spwf_line;
+ int spwf_changed;
+@@ -259,8 +265,28 @@ int __pwdb_spw_close (void)
+ if (fstat (fileno (spwfp), &sb))
+ return 0;
+
+- if (create_backup_file(spwfp, backup, &sb))
+- return 0;
++#ifdef WITH_SELINUX
++ if (selinux_enabled=is_selinux_enabled()) {
++ security_context_t passwd_context=NULL;
++ if (fgetfilecon(fileno (spwfp),&passwd_context)<0) {
++ return 0;
++ };
++ if (getfscreatecon(&prev_context)<0) {
++ freecon(passwd_context);
++ return 0;
++ }
++ if (setfscreatecon(passwd_context)) {
++ freecon(passwd_context);
++ freecon(prev_context);
++ return 0;
++ }
++ freecon(passwd_context);
++ }
++#endif
++ if (create_backup_file(spwfp, backup, &sb)){
++ errors++;
++ goto errorexit;
++ }
+
+ isopen = 0;
+ (void) fclose (spwfp);
+@@ -278,11 +304,15 @@ int __pwdb_spw_close (void)
+ */
+
+ spwfp = fopen_with_umask(newfile, "w", 0777);
+- if (!spwfp)
+- return 0;
++ if (!spwfp){
++ errors++;
++ goto errorexit;
++ }
+ if (chown(newfile, sb.st_uid, sb.st_gid) ||
+- chmod(newfile, sb.st_mode))
+- return 0;
++ chmod(newfile, sb.st_mode)){
++ errors++;
++ goto errorexit;
++ }
+
+ /*
+ * Check each member in the list and write out any elements
+@@ -308,7 +338,7 @@ int __pwdb_spw_close (void)
+
+ if (errors) {
+ unlink (newfile);
+- return 0;
++ goto errorexit;
+ }
+
+ /*
+@@ -352,7 +382,20 @@ int __pwdb_spw_close (void)
+ }
+ spwf_tail = 0;
+ isopen = 0;
+- return 1;
++
++ errorexit:
++#ifdef WITH_SELINUX
++ if (selinux_enabled) {
++ if (setfscreatecon(prev_context)) {
++ errors++;
++ }
++ if (prev_context != NULL) {
++ freecon(prev_context);
++ prev_context=NULL;
++ }
++ }
++#endif
++ return errors==0;
+ }
+
+ int __pwdb_spw_update (const struct __pwdb_spwd *spwd)
+--- pwdb-0.62/libpwdb/shadow/sgroupio.c.pwdbselinux 1998-10-06 16:58:43.000000000 -0400
++++ pwdb-0.62/libpwdb/shadow/sgroupio.c 2003-07-09 14:45:54.704662696 -0400
+@@ -16,6 +16,12 @@
+
+ #include "../_pwdb_internal.h"
+
++#ifdef WITH_SELINUX
++#include <selinux/selinux.h>
++static int selinux_enabled=0;
++static security_context_t prev_context=NULL;
++#endif
++
+ static int islocked;
+ static int isopen;
+ static int open_modes;
+@@ -278,8 +284,28 @@ int __pwdb_sgr_close (void)
+ if (fstat (fileno (sgrfp), &sb))
+ return 0;
+
+- if (create_backup_file(sgrfp, backup, &sb))
+- return 0;
++#ifdef WITH_SELINUX
++ if (selinux_enabled=is_selinux_enabled()) {
++ security_context_t passwd_context=NULL;
++ if (fgetfilecon(fileno (sgrfp),&passwd_context)<0) {
++ return 0;
++ };
++ if (getfscreatecon(&prev_context)<0) {
++ freecon(passwd_context);
++ return 0;
++ }
++ if (setfscreatecon(passwd_context)) {
++ freecon(passwd_context);
++ freecon(prev_context);
++ return 0;
++ }
++ freecon(passwd_context);
++ }
++#endif
++ if (create_backup_file(sgrfp, backup, &sb)){
++ errors++;
++ goto errorexit;
++ }
+
+ isopen = 0;
+ (void) fclose (sgrfp);
+@@ -296,11 +322,15 @@ int __pwdb_sgr_close (void)
+ */
+
+ sgrfp = fopen_with_umask(newfile, "w", 0777);
+- if (!sgrfp)
+- return 0;
++ if (!sgrfp){
++ errors++;
++ goto errorexit;
++ }
+ if (chown(newfile, sb.st_uid, sb.st_gid) ||
+- chmod(newfile, sb.st_mode))
+- return 0;
++ chmod(newfile, sb.st_mode)){
++ errors++;
++ goto errorexit;
++ }
+
+ /*
+ * Check each member in the list and write out any elements
+@@ -326,7 +356,7 @@ int __pwdb_sgr_close (void)
+
+ if (errors) {
+ unlink (newfile);
+- return 0;
++ goto errorexit;
+ }
+
+ /*
+@@ -370,7 +400,20 @@ int __pwdb_sgr_close (void)
+ }
+ sgr_tail = 0;
+ isopen = 0;
+- return 1;
++
++ errorexit:
++#ifdef WITH_SELINUX
++ if (selinux_enabled) {
++ if (setfscreatecon(prev_context)) {
++ errors++;
++ }
++ if (prev_context != NULL) {
++ freecon(prev_context);
++ prev_context=NULL;
++ }
++ }
++#endif
++ return errors==0;
+ }
+
+ int __pwdb_sgr_update (const struct __pwdb_sgrp *sgrent)
+--- pwdb-0.62/libpwdb/unix/pwio.c.pwdbselinux 1998-10-06 16:58:43.000000000 -0400
++++ pwdb-0.62/libpwdb/unix/pwio.c 2003-07-09 14:45:54.707662240 -0400
+@@ -16,6 +16,11 @@
+
+ #include "../_pwdb_internal.h"
+
++#ifdef WITH_SELINUX
++#include <selinux/selinux.h>
++static int selinux_enabled=0;
++static security_context_t prev_context=NULL;
++#endif
+ struct pw_file_entry {
+ char *pwf_line;
+ int pwf_changed;
+@@ -204,8 +209,28 @@ int __pwdb_pw_close (void)
+ if (fstat (fileno (pwfp), &sb))
+ return 0;
+
+- if (create_backup_file(pwfp, backup, &sb))
+- return 0;
++#ifdef WITH_SELINUX
++ if (selinux_enabled=is_selinux_enabled()) {
++ security_context_t passwd_context=NULL;
++ if (fgetfilecon(fileno (pwfp),&passwd_context)<0) {
++ return 0;
++ };
++ if (getfscreatecon(&prev_context)<0) {
++ freecon(passwd_context);
++ return 0;
++ }
++ if (setfscreatecon(passwd_context)) {
++ freecon(passwd_context);
++ freecon(prev_context);
++ return 0;
++ }
++ freecon(passwd_context);
++ }
++#endif
++ if (create_backup_file(pwfp, backup, &sb)) {
++ errors++;
++ goto errorexit;
++ }
+
+ isopen = 0;
+ (void) fclose (pwfp);
+@@ -222,11 +247,15 @@ int __pwdb_pw_close (void)
+ */
+
+ pwfp = fopen_with_umask(newfile, "w", 0777);
+- if (!pwfp)
+- return 0;
++ if (!pwfp) {
++ errors++;
++ goto errorexit;
++ }
+ if (chown(newfile, sb.st_uid, sb.st_gid) ||
+- chmod(newfile, sb.st_mode))
+- return 0;
++ chmod(newfile, sb.st_mode)) {
++ errors++;
++ goto errorexit;
++ }
+
+ /*
+ * Check each member in the list and write out any elements
+@@ -251,7 +280,7 @@ int __pwdb_pw_close (void)
+
+ if (errors) {
+ unlink (newfile);
+- return 0;
++ goto errorexit;
+ }
+
+ /*
+@@ -294,7 +323,20 @@ int __pwdb_pw_close (void)
+ }
+ pwf_tail = 0;
+ isopen = 0;
+- return 1;
++
++ errorexit:
++#ifdef WITH_SELINUX
++ if (selinux_enabled) {
++ if (setfscreatecon(prev_context)) {
++ errors++;
++ }
++ if (prev_context != NULL) {
++ freecon(prev_context);
++ prev_context=NULL;
++ }
++ }
++#endif
++ return errors==0;
+ }
+
+ /*
+--- pwdb-0.62/libpwdb/unix/groupio.c.pwdbselinux 1998-10-06 16:58:43.000000000 -0400
++++ pwdb-0.62/libpwdb/unix/groupio.c 2003-07-09 14:45:54.708662088 -0400
+@@ -11,6 +11,12 @@
+ #include "../_pwdb_internal.h"
+
+
++#ifdef WITH_SELINUX
++#include <selinux/selinux.h>
++int selinux_enabled=0;
++static security_context_t prev_context=NULL;
++#endif
++
+ static int islocked;
+ static int isopen;
+ static int open_modes;
+@@ -259,8 +265,28 @@ int __pwdb_gr_close (void)
+ if (fstat (fileno (grfp), &sb))
+ return 0;
+
+- if (create_backup_file(grfp, backup, &sb))
+- return 0;
++#ifdef WITH_SELINUX
++ if (selinux_enabled=is_selinux_enabled()) {
++ security_context_t group_context=NULL;
++ if (fgetfilecon(fileno (grfp),&group_context)<0) {
++ return 0;
++ };
++ if (getfscreatecon(&prev_context)<0) {
++ freecon(group_context);
++ return 0;
++ }
++ if (setfscreatecon(group_context)) {
++ freecon(group_context);
++ freecon(prev_context);
++ return 0;
++ }
++ freecon(group_context);
++ }
++#endif
++ if (create_backup_file(grfp, backup, &sb)) {
++ errors++;
++ goto errorexit;
++ }
+
+ isopen = 0;
+ (void) fclose (grfp);
+@@ -278,11 +304,15 @@ int __pwdb_gr_close (void)
+ */
+
+ grfp = fopen_with_umask(newfile, "w", 0777);
+- if (!grfp)
+- return 0;
++ if (!grfp) {
++ errors++;
++ goto errorexit;
++ }
+ if (chown(newfile, sb.st_uid, sb.st_gid) ||
+- chmod(newfile, sb.st_mode))
+- return 0;
++ chmod(newfile, sb.st_mode)) {
++ errors++;
++ goto errorexit;
++ }
+
+ /*
+ * Check each member in the list and write out any elements
+@@ -308,7 +338,7 @@ int __pwdb_gr_close (void)
+
+ if (errors) {
+ unlink (newfile);
+- return 0;
++ goto errorexit;
+ }
+
+ /*
+@@ -351,7 +381,19 @@ int __pwdb_gr_close (void)
+ }
+ grf_tail = 0;
+ isopen = 0;
+- return 1;
++ errorexit:
++#ifdef WITH_SELINUX
++ if (selinux_enabled) {
++ if (setfscreatecon(prev_context)) {
++ errors++;
++ }
++ if (prev_context != NULL) {
++ freecon(prev_context);
++ prev_context=NULL;
++ }
++ }
++#endif
++ return errors==0;
+ }
+
+ /* update an entry */
+--- pwdb-0.62/libpwdb/Makefile.pwdbselinux 1999-04-10 05:31:20.000000000 -0400
++++ pwdb-0.62/libpwdb/Makefile 2003-07-09 14:45:54.709661936 -0400
+@@ -22,7 +22,7 @@ HEADERS = pwdb/pwdb_public.h pwdb/pwdb_c
+
+ # needed for generic interface compilation
+ # if header files are not installed (CG)
+-CFLAGS+=-I.
++CFLAGS+=-I. -DWITH_SELINUX
+
+ CFLAGS+=# -DDEBUG
+
+@@ -50,6 +50,7 @@
+
+ all: $(LIBSTATIC) $(LIBDYNAME)
+
++$(LIBDYNAME): LDLIBS += -lselinux
+
+ $(LIBDYNAME): $(LIBOBJ)
+ $(CC) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIBSONAME) -Wl,-x -o $(LIBFILENAME) $(LIBOBJ) -lcrypt -lnsl $(LDLIBS)
diff --git a/sys-libs/pwdb/metadata.xml b/sys-libs/pwdb/metadata.xml
new file mode 100644
index 000000000000..56c124413057
--- /dev/null
+++ b/sys-libs/pwdb/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>base-system@gentoo.org</email>
+ <name>Gentoo Base System</name>
+</maintainer>
+</pkgmetadata>
diff --git a/sys-libs/pwdb/pwdb-0.62.ebuild b/sys-libs/pwdb/pwdb-0.62.ebuild
new file mode 100644
index 000000000000..28bcc00b9e71
--- /dev/null
+++ b/sys-libs/pwdb/pwdb-0.62.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="4"
+
+inherit eutils toolchain-funcs flag-o-matic
+
+DESCRIPTION="Password database"
+HOMEPAGE="https://packages.gentoo.org/package/sys-libs/pwdb"
+SRC_URI="mirror://gentoo/${P}.tar.gz"
+
+LICENSE="|| ( BSD GPL-2 )"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
+IUSE="selinux"
+RESTRICT="test" #122603
+
+# Note: NIS could probably be made conditional if anyone cared ...
+RDEPEND="selinux? ( sys-libs/libselinux )
+ net-libs/libtirpc"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-build.patch
+
+ use selinux && epatch "${FILESDIR}"/${P}-selinux.patch
+
+ append-cppflags $($(tc-getPKG_CONFIG) --cflags libtirpc)
+ export LDLIBS=$($(tc-getPKG_CONFIG) --libs libtirpc)
+
+ sed -i \
+ -e "s/^DIRS = .*/DIRS = libpwdb/" \
+ -e "s:EXTRAS += :EXTRAS += ${CFLAGS} :" \
+ Makefile || die
+ sed -i \
+ -e "s:=gcc:=$(tc-getCC):g" \
+ -e "s:=ar:=$(tc-getAR):g" \
+ -e "s:=ranlib:=$(tc-getRANLIB):g" \
+ default.defs || die
+}
+
+src_install() {
+ dodir /usr/$(get_libdir) /usr/include/pwdb
+ emake \
+ INCLUDED="${D}"/usr/include/pwdb \
+ LIBDIR="${D}"/usr/$(get_libdir) \
+ LDCONFIG="echo" \
+ install
+
+ gen_usr_ldscript -a pwdb
+
+ insinto /etc
+ doins conf/pwdb.conf
+
+ dodoc CHANGES CREDITS README doc/*.txt
+ dohtml -r doc/html/*
+}