diff options
author | pi <pi@FreeBSD.org> | 2016-04-10 20:27:48 +0800 |
---|---|---|
committer | pi <pi@FreeBSD.org> | 2016-04-10 20:27:48 +0800 |
commit | 8690a202b41ab6f18d3e698b53daa274cff51f56 (patch) | |
tree | d7c5c716510758a6e10fff18500dbee4f8d9d157 /net/libnss-pgsql | |
parent | 5b10ba9d4f67b6a1f8c65387996623b179e15e87 (diff) | |
download | freebsd-ports-gnome-8690a202b41ab6f18d3e698b53daa274cff51f56.tar.gz freebsd-ports-gnome-8690a202b41ab6f18d3e698b53daa274cff51f56.tar.zst freebsd-ports-gnome-8690a202b41ab6f18d3e698b53daa274cff51f56.zip |
New port: net/libnss-pgsql
libNSS-PostgreSQL allows you to authenticate UNIX groups and users
using a PostgreSQL database. It uses the NSS API which provides an
abstraction layer between the UNIX authentication API and the related
data. NSS-PostgreSQL currently supports the passwd and groups services.
WWW: https://ftp.postgresql.org/pub/projects/pgFoundry/sysauth/NSS/
PR: 178333
Submitted by: berend@pobox.com, felix@userspace.com.au
Reviewed by: lippe, robak
Diffstat (limited to 'net/libnss-pgsql')
-rw-r--r-- | net/libnss-pgsql/Makefile | 28 | ||||
-rw-r--r-- | net/libnss-pgsql/distinfo | 2 | ||||
-rw-r--r-- | net/libnss-pgsql/files/nsswitch.conf | 17 | ||||
-rw-r--r-- | net/libnss-pgsql/files/patch-configure.ac | 11 | ||||
-rw-r--r-- | net/libnss-pgsql/files/patch-src_backend.c | 11 | ||||
-rw-r--r-- | net/libnss-pgsql/files/patch-src_interface.c | 60 | ||||
-rw-r--r-- | net/libnss-pgsql/files/patch-src_nss-pgsql.h | 33 | ||||
-rw-r--r-- | net/libnss-pgsql/pkg-descr | 6 | ||||
-rw-r--r-- | net/libnss-pgsql/pkg-plist | 11 |
9 files changed, 179 insertions, 0 deletions
diff --git a/net/libnss-pgsql/Makefile b/net/libnss-pgsql/Makefile new file mode 100644 index 000000000000..084440fcb80d --- /dev/null +++ b/net/libnss-pgsql/Makefile @@ -0,0 +1,28 @@ +# Created by: Felix Hanley <felix@userspace.com.au> +# $FreeBSD$ + +PORTNAME= libnss-pgsql +PORTVERSION= 1.5.0 +CATEGORIES= net +MASTER_SITES= ${MASTER_SITE_PGSQL} +MASTER_SITE_SUBDIR= projects/pgFoundry/sysauth/NSS/nss1.5.0-beta +DISTNAME= ${PORTNAME}-${PORTVERSION}-beta + +MAINTAINER= felix@userspace.com.au +COMMENT= NSS module using a PostgreSQL database for backend + +LICENSE= GPLv2 + +BUILD_DEPENDS= xmlto:${PORTSDIR}/textproc/xmlto + +USES= autoreconf gmake libtool pgsql tar:tgz +CONFIGURE_ARGS= --sysconfdir=${PREFIX}/etc --includedir=${PREFIX}/include --libdir=${PREFIX}/lib --with-docdir=${DOCSDIR} +USE_LDCONFIG= yes +GNU_CONFIGURE= yes + +post-install: + ${MKDIR} ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/README ${WRKSRC}/conf/* ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} files/nsswitch.conf ${STAGEDIR}${DOCSDIR} + +.include <bsd.port.mk> diff --git a/net/libnss-pgsql/distinfo b/net/libnss-pgsql/distinfo new file mode 100644 index 000000000000..5d8b7dde08a6 --- /dev/null +++ b/net/libnss-pgsql/distinfo @@ -0,0 +1,2 @@ +SHA256 (libnss-pgsql-1.5.0-beta.tgz) = 84808c47fd21a09e2c487a0efc72cc18b352275082335be8c6de39d325e6c000 +SIZE (libnss-pgsql-1.5.0-beta.tgz) = 305543 diff --git a/net/libnss-pgsql/files/nsswitch.conf b/net/libnss-pgsql/files/nsswitch.conf new file mode 100644 index 000000000000..7db8e4ac0e59 --- /dev/null +++ b/net/libnss-pgsql/files/nsswitch.conf @@ -0,0 +1,17 @@ +# +# nsswitch.conf(5) - name service switch configuration file +# $FreeBSD$ +# +#group: compat +group: files [notfound=continue] pgsql +group_compat: nis +hosts: files dns +networks: files +#passwd: compat +passwd: files [notfound=continue] pgsql +passwd_compat: nis +shells: files +services: compat +services_compat: nis +protocols: files +rpc: files diff --git a/net/libnss-pgsql/files/patch-configure.ac b/net/libnss-pgsql/files/patch-configure.ac new file mode 100644 index 000000000000..131bace42d7e --- /dev/null +++ b/net/libnss-pgsql/files/patch-configure.ac @@ -0,0 +1,11 @@ +--- configure.ac.orig 2015-12-21 07:52:02 UTC ++++ configure.ac +@@ -26,7 +26,7 @@ AC_CHECK_LIB([pq], [PQsetdbLogin]) + + # Checks for header files. + AC_HEADER_STDC +-AC_CHECK_HEADERS([stdlib.h string.h unistd.h nss.h]) ++AC_CHECK_HEADERS([stdlib.h string.h unistd.h nss.h shadow.h]) + + # Checks for typedefs, structures, and compiler characteristics. + AC_C_CONST diff --git a/net/libnss-pgsql/files/patch-src_backend.c b/net/libnss-pgsql/files/patch-src_backend.c new file mode 100644 index 000000000000..0637d5a02d65 --- /dev/null +++ b/net/libnss-pgsql/files/patch-src_backend.c @@ -0,0 +1,11 @@ +--- src/backend.c.orig 2015-12-21 07:40:53 UTC ++++ src/backend.c +@@ -11,7 +11,7 @@ + */ + + #include "nss-pgsql.h" +-#include <postgresql/libpq-fe.h> ++#include <libpq-fe.h> + #include <stdlib.h> + #include <string.h> + #include <stdio.h> diff --git a/net/libnss-pgsql/files/patch-src_interface.c b/net/libnss-pgsql/files/patch-src_interface.c new file mode 100644 index 000000000000..f3c4f91ebc43 --- /dev/null +++ b/net/libnss-pgsql/files/patch-src_interface.c @@ -0,0 +1,60 @@ +--- src/interface.c.orig 2015-12-21 07:49:44 UTC ++++ src/interface.c +@@ -285,3 +285,57 @@ _nss_pgsql_getspnam_r(const char *spnam, + + return retval; + } ++ ++/* Thanks to Clement Laforet for most of this */ ++#if defined(__FreeBSD__) ++ ++NSS_METHOD_PROTOTYPE(__nss_compat_getpwnam_r); ++NSS_METHOD_PROTOTYPE(__nss_compat_getpwuid_r); ++NSS_METHOD_PROTOTYPE(__nss_compat_getpwent_r); ++NSS_METHOD_PROTOTYPE(__nss_compat_setpwent); ++NSS_METHOD_PROTOTYPE(__nss_compat_endpwent); ++NSS_METHOD_PROTOTYPE(__nss_compat_getgrnam_r); ++NSS_METHOD_PROTOTYPE(__nss_compat_getgrgid_r); ++NSS_METHOD_PROTOTYPE(__nss_compat_getgrent_r); ++NSS_METHOD_PROTOTYPE(__nss_compat_setgrent); ++NSS_METHOD_PROTOTYPE(__nss_compat_endgrent); ++ ++enum nss_status _nss_pgsql_getpwnam_r (const char *, struct passwd *, char *, ++ size_t, int *); ++enum nss_status _nss_pgsql_getpwuid_r (uid_t, struct passwd *, char *, ++ size_t, int *); ++enum nss_status _nss_pgsql_getpwent_r (struct passwd *, char *, size_t, int *); ++enum nss_status _nss_pgsql_setpwent (void); ++enum nss_status _nss_pgsql_endpwent (void); ++ ++enum nss_status _nss_pgsql_getgrnam_r (const char *, struct group *, char *, ++ size_t, int *); ++enum nss_status _nss_pgsql_getgrgid_r (gid_t, struct group *, char *, ++ size_t, int *); ++enum nss_status _nss_pgsql_getgrent_r (struct group *, char *, size_t, int *); ++enum nss_status _nss_pgsql_setgrent (void); ++enum nss_status _nss_pgsql_endgrent (void); ++ ++static ns_mtab methods[] = { ++ { NSDB_PASSWD, "getpwnam_r", __nss_compat_getpwnam_r, _nss_pgsql_getpwnam_r }, ++ { NSDB_PASSWD, "getpwuid_r", __nss_compat_getpwuid_r, _nss_pgsql_getpwuid_r }, ++ { NSDB_PASSWD, "getpwent_r", __nss_compat_getpwent_r, _nss_pgsql_getpwent_r }, ++ { NSDB_PASSWD, "endpwent", __nss_compat_setpwent, _nss_pgsql_setpwent }, ++ { NSDB_PASSWD, "setpwent", __nss_compat_endpwent, _nss_pgsql_endpwent }, ++ { NSDB_GROUP, "getgrnam_r", __nss_compat_getgrnam_r, _nss_pgsql_getgrnam_r }, ++ { NSDB_GROUP, "getgrgid_r", __nss_compat_getgrgid_r, _nss_pgsql_getgrgid_r }, ++ { NSDB_GROUP, "getgrent_r", __nss_compat_getgrent_r, _nss_pgsql_getgrent_r }, ++ { NSDB_GROUP, "endgrent", __nss_compat_setgrent, _nss_pgsql_setgrent }, ++ { NSDB_GROUP, "setgrent", __nss_compat_endgrent, _nss_pgsql_endgrent }, ++}; ++ ++ns_mtab * ++nss_module_register (const char *name, unsigned int *size, ++ nss_module_unregister_fn *unregister) ++{ ++ *size = sizeof (methods) / sizeof (methods[0]); ++ *unregister = NULL; ++ return (methods); ++} ++ ++#endif /* defined(__FreeBSD__) */ diff --git a/net/libnss-pgsql/files/patch-src_nss-pgsql.h b/net/libnss-pgsql/files/patch-src_nss-pgsql.h new file mode 100644 index 000000000000..a4007a306563 --- /dev/null +++ b/net/libnss-pgsql/files/patch-src_nss-pgsql.h @@ -0,0 +1,33 @@ +--- src/nss-pgsql.h.orig 2015-12-21 07:47:28 UTC ++++ src/nss-pgsql.h +@@ -15,9 +15,30 @@ + + # include <pwd.h> + # include <grp.h> ++#ifdef HAVE_SHADOW_H + # include <shadow.h> ++#endif + # include <sys/types.h> + ++#ifndef HAVE_SHADOW_H ++/* Structure of the password file. */ ++struct spwd ++ { ++ char *sp_namp; /* Login name. */ ++ char *sp_pwdp; /* Encrypted password. */ ++ long int sp_lstchg; /* Date of last change. */ ++ long int sp_min; /* Minimum number of days between changes. */ ++ long int sp_max; /* Maximum number of days between changes. */ ++ long int sp_warn; /* Number of days to warn user to change ++ the password. */ ++ long int sp_inact; /* Number of days the account may be ++ inactive. */ ++ long int sp_expire; /* Number of days since 1970-01-01 until ++ account expires. */ ++ unsigned long int sp_flag; /* Reserved. */ ++ }; ++#endif ++ + #define CFGFILE SYSCONFDIR"/nss-pgsql.conf" + #define CFGROOTFILE SYSCONFDIR"/nss-pgsql-root.conf" + diff --git a/net/libnss-pgsql/pkg-descr b/net/libnss-pgsql/pkg-descr new file mode 100644 index 000000000000..1ac88b05d601 --- /dev/null +++ b/net/libnss-pgsql/pkg-descr @@ -0,0 +1,6 @@ +libNSS-PostgreSQL allows you to authenticate UNIX groups and users +using a PostgreSQL database. It uses the NSS API which provides an +abstraction layer between the UNIX authentication API and the related +data. NSS-PostgreSQL currently supports the passwd and groups services. + +WWW: https://ftp.postgresql.org/pub/projects/pgFoundry/sysauth/NSS/ diff --git a/net/libnss-pgsql/pkg-plist b/net/libnss-pgsql/pkg-plist new file mode 100644 index 000000000000..f0828646c1e8 --- /dev/null +++ b/net/libnss-pgsql/pkg-plist @@ -0,0 +1,11 @@ +lib/libnss_pgsql.a +lib/libnss_pgsql.so +lib/libnss_pgsql.so.2 +lib/libnss_pgsql.so.2.0.0 +%%PORTDOCS%%%%DOCSDIR%%/README +%%PORTDOCS%%%%DOCSDIR%%/caution.png +%%PORTDOCS%%%%DOCSDIR%%/dbschema.sql +%%PORTDOCS%%%%DOCSDIR%%/nss-pgsql-root.conf +%%PORTDOCS%%%%DOCSDIR%%/nss-pgsql.conf +%%PORTDOCS%%%%DOCSDIR%%/nss-pgsql.html +%%PORTDOCS%%%%DOCSDIR%%/nsswitch.conf |