svn commit: r412926 - in head/net: . libnss-pgsql libnss-pgsql/files

Kurt Jaeger pi at FreeBSD.org
Sun Apr 10 12:27:50 UTC 2016


Author: pi
Date: Sun Apr 10 12:27:48 2016
New Revision: 412926
URL: https://svnweb.freebsd.org/changeset/ports/412926

Log:
  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 at pobox.com, felix at userspace.com.au
  Reviewed by:	lippe, robak

Added:
  head/net/libnss-pgsql/
  head/net/libnss-pgsql/Makefile   (contents, props changed)
  head/net/libnss-pgsql/distinfo   (contents, props changed)
  head/net/libnss-pgsql/files/
  head/net/libnss-pgsql/files/nsswitch.conf   (contents, props changed)
  head/net/libnss-pgsql/files/patch-configure.ac   (contents, props changed)
  head/net/libnss-pgsql/files/patch-src_backend.c   (contents, props changed)
  head/net/libnss-pgsql/files/patch-src_interface.c   (contents, props changed)
  head/net/libnss-pgsql/files/patch-src_nss-pgsql.h   (contents, props changed)
  head/net/libnss-pgsql/pkg-descr   (contents, props changed)
  head/net/libnss-pgsql/pkg-plist   (contents, props changed)
Modified:
  head/net/Makefile

Modified: head/net/Makefile
==============================================================================
--- head/net/Makefile	Sun Apr 10 12:17:04 2016	(r412925)
+++ head/net/Makefile	Sun Apr 10 12:27:48 2016	(r412926)
@@ -331,6 +331,7 @@
     SUBDIR += libnids
     SUBDIR += libnss-cache
     SUBDIR += libnss-mysql
+    SUBDIR += libnss-pgsql
     SUBDIR += liboauth
     SUBDIR += libopennet
     SUBDIR += liboping

Added: head/net/libnss-pgsql/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/libnss-pgsql/Makefile	Sun Apr 10 12:27:48 2016	(r412926)
@@ -0,0 +1,28 @@
+# Created by: Felix Hanley <felix at 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 at 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>

Added: head/net/libnss-pgsql/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/libnss-pgsql/distinfo	Sun Apr 10 12:27:48 2016	(r412926)
@@ -0,0 +1,2 @@
+SHA256 (libnss-pgsql-1.5.0-beta.tgz) = 84808c47fd21a09e2c487a0efc72cc18b352275082335be8c6de39d325e6c000
+SIZE (libnss-pgsql-1.5.0-beta.tgz) = 305543

Added: head/net/libnss-pgsql/files/nsswitch.conf
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/libnss-pgsql/files/nsswitch.conf	Sun Apr 10 12:27:48 2016	(r412926)
@@ -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

Added: head/net/libnss-pgsql/files/patch-configure.ac
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/libnss-pgsql/files/patch-configure.ac	Sun Apr 10 12:27:48 2016	(r412926)
@@ -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

Added: head/net/libnss-pgsql/files/patch-src_backend.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/libnss-pgsql/files/patch-src_backend.c	Sun Apr 10 12:27:48 2016	(r412926)
@@ -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>

Added: head/net/libnss-pgsql/files/patch-src_interface.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/libnss-pgsql/files/patch-src_interface.c	Sun Apr 10 12:27:48 2016	(r412926)
@@ -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__) */

Added: head/net/libnss-pgsql/files/patch-src_nss-pgsql.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/libnss-pgsql/files/patch-src_nss-pgsql.h	Sun Apr 10 12:27:48 2016	(r412926)
@@ -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"
+ 

Added: head/net/libnss-pgsql/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/libnss-pgsql/pkg-descr	Sun Apr 10 12:27:48 2016	(r412926)
@@ -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/

Added: head/net/libnss-pgsql/pkg-plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/libnss-pgsql/pkg-plist	Sun Apr 10 12:27:48 2016	(r412926)
@@ -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


More information about the svn-ports-head mailing list