pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/databases/nss_ldap import nss_ldap-239, an nsswitch pl...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ccf7018b0f80
branches:  trunk
changeset: 497943:ccf7018b0f80
user:      drochner <drochner%pkgsrc.org@localhost>
date:      Mon Aug 08 09:47:42 2005 +0000

description:
import nss_ldap-239, an nsswitch plugin for LDAP lookup
(passwd and group for now)

diffstat:

 databases/nss_ldap/DESCR            |    4 +
 databases/nss_ldap/Makefile         |   23 +
 databases/nss_ldap/PLIST            |    5 +
 databases/nss_ldap/distinfo         |    8 +
 databases/nss_ldap/files/netbsd.c   |  447 ++++++++++++++++++++++++++++++++++++
 databases/nss_ldap/files/netbsd.h   |   12 +
 databases/nss_ldap/patches/patch-ab |   12 +
 databases/nss_ldap/patches/patch-af |   30 ++
 databases/nss_ldap/patches/patch-ag |   12 +
 9 files changed, 553 insertions(+), 0 deletions(-)

diffs (truncated from 589 to 300 lines):

diff -r 7e9a5272c575 -r ccf7018b0f80 databases/nss_ldap/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/nss_ldap/DESCR  Mon Aug 08 09:47:42 2005 +0000
@@ -0,0 +1,4 @@
+This is the nss_ldap library, an LDAP module for the Solaris Nameservice
+Switch (NSS), the GNU libc NSS, and the ISC BIND IRS (used on BSDI
+and IRS).
+The LDAP schema used is described in RFC 2307
diff -r 7e9a5272c575 -r ccf7018b0f80 databases/nss_ldap/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/nss_ldap/Makefile       Mon Aug 08 09:47:42 2005 +0000
@@ -0,0 +1,23 @@
+# $NetBSD: Makefile,v 1.1.1.1 2005/08/08 09:47:42 drochner Exp $
+#
+
+DISTNAME=              nss_ldap-239
+CATEGORIES=            databases
+MASTER_SITES=          http://www.padl.com/download/
+
+MAINTAINER=            tech-pkg%NetBSD.org@localhost
+HOMEPAGE=              http://www.padl.com/OSS/nss_ldap.html
+COMMENT=               LDAP client for nsswitch
+
+GNU_CONFIGURE=         yes
+USE_TOOLS+=            gmake
+
+CONFIGURE_ARGS+=       --with-ldap-conf-file=/etc/nss_ldap.conf
+CONFIGURE_ARGS+=       --with-ldap-secret-file=/etc/nss_ldap.secret
+
+pre-build:
+       ${CP} ${FILESDIR}/netbsd.c  ${FILESDIR}/netbsd.h ${WRKSRC}
+       ${LN} -s /usr/include/nsswitch.h ${BUILDLINK_DIR}/include/nss.h
+
+.include "../../databases/openldap/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff -r 7e9a5272c575 -r ccf7018b0f80 databases/nss_ldap/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/nss_ldap/PLIST  Mon Aug 08 09:47:42 2005 +0000
@@ -0,0 +1,5 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2005/08/08 09:47:42 drochner Exp $
+etc/nsswitch.ldap
+lib/nss_ldap.so
+lib/nss_ldap.so.1
+man/man5/nss_ldap.5
diff -r 7e9a5272c575 -r ccf7018b0f80 databases/nss_ldap/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/nss_ldap/distinfo       Mon Aug 08 09:47:42 2005 +0000
@@ -0,0 +1,8 @@
+$NetBSD: distinfo,v 1.1.1.1 2005/08/08 09:47:42 drochner Exp $
+
+SHA1 (nss_ldap-239.tar.gz) = beee30b433a01dccd863e7a0cdb7fe87cefda7fd
+RMD160 (nss_ldap-239.tar.gz) = 525ed402ef5959a2740a7539c309c478a4765381
+Size (nss_ldap-239.tar.gz) = 222276 bytes
+SHA1 (patch-ab) = 01493e92ffff0125dd3267810ee33cdeaab32ab2
+SHA1 (patch-af) = 54251bd1798ce4137760b8a84997cbe23e5f1fa0
+SHA1 (patch-ag) = 95741f39fb03195b3238d4f9c24360049fdd3698
diff -r 7e9a5272c575 -r ccf7018b0f80 databases/nss_ldap/files/netbsd.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/nss_ldap/files/netbsd.c Mon Aug 08 09:47:42 2005 +0000
@@ -0,0 +1,447 @@
+/* $NetBSD: netbsd.c,v 1.1.1.1 2005/08/08 09:47:42 drochner Exp $ */
+
+#include <sys/param.h>
+#include <pwd.h>
+#include <grp.h>
+#include <nsswitch.h>
+#include <stdarg.h>
+#include <string.h>
+
+#include "netbsd.h"
+typedef enum nss_status NSS_STATUS;
+
+extern NSS_STATUS _nss_ldap_setpwent(void);
+static int netbsd_setpwent(void *, void *, va_list);
+static int netbsd_setpassent(void *, void *, va_list);
+extern NSS_STATUS _nss_ldap_endpwent(void);
+static int netbsd_endpwent(void *, void *, va_list);
+extern NSS_STATUS _nss_ldap_getpwent_r(struct passwd *,
+                                      char *, size_t, int *);
+static int netbsd_getpwent(void *, void *, va_list);
+static int netbsd_getpwent_r(void *, void *, va_list);
+extern NSS_STATUS _nss_ldap_getpwnam_r(const char *, struct passwd *,
+                                      char *, size_t, int *);
+static int netbsd_getpwnam(void *, void *, va_list);
+static int netbsd_getpwnam_r(void *, void *, va_list);
+extern NSS_STATUS _nss_ldap_getpwuid_r(uid_t, struct passwd *,
+                                      char *, size_t, int *);
+static int netbsd_getpwuid(void *, void *, va_list);
+static int netbsd_getpwuid_r(void *, void *, va_list);
+
+extern NSS_STATUS _nss_ldap_setgrent(void);
+static int netbsd_setgrent(void *, void *, va_list);
+static int netbsd_setgroupent(void *, void *, va_list);
+extern NSS_STATUS _nss_ldap_endgrent(void);
+static int netbsd_endgrent(void *, void *, va_list);
+extern NSS_STATUS _nss_ldap_getgrent_r(struct group *,
+                                      char *, size_t, int *);
+static int netbsd_getgrent(void *, void *, va_list);
+static int netbsd_getgrent_r(void *, void *, va_list);
+extern NSS_STATUS _nss_ldap_getgrnam_r(const char *, struct group *,
+                                      char *, size_t, int *);
+static int netbsd_getgrnam(void *, void *, va_list);
+static int netbsd_getgrnam_r(void *, void *, va_list);
+extern NSS_STATUS _nss_ldap_getgrgid_r(gid_t, struct group *,
+                                      char *, size_t, int *);
+static int netbsd_getgrgid(void *, void *, va_list);
+static int netbsd_getgrgid_r(void *, void *, va_list);
+
+static int nss2netbsderr[] = {
+       NS_SUCCESS, NS_NOTFOUND, NS_UNAVAIL, NS_TRYAGAIN, NS_RETURN
+};
+static struct passwd rpw;
+static struct group rg;
+static char pwbuf[1024], grpbuf[1024]; /* two necessary? */
+
+static ns_mtab methods[] = {
+       { NSDB_PASSWD, "setpwent", netbsd_setpwent, 0 },
+       { NSDB_PASSWD, "setpassent", netbsd_setpassent, 0 },
+       { NSDB_PASSWD, "endpwent", netbsd_endpwent, 0 },
+       { NSDB_PASSWD, "getpwent", netbsd_getpwent, 0 },
+       { NSDB_PASSWD, "getpwent_r", netbsd_getpwent_r, 0 },
+       { NSDB_PASSWD, "getpwnam", netbsd_getpwnam, 0 },
+       { NSDB_PASSWD, "getpwnam_r", netbsd_getpwnam_r, 0 },
+       { NSDB_PASSWD, "getpwuid", netbsd_getpwuid, 0 },
+       { NSDB_PASSWD, "getpwuid_r", netbsd_getpwuid_r, 0 },
+
+       { NSDB_GROUP, "setgrent", netbsd_setgrent, 0 },
+       { NSDB_GROUP, "setgroupent", netbsd_setgroupent, 0 },
+       { NSDB_GROUP, "endgrent", netbsd_endgrent, 0 },
+       { NSDB_GROUP, "getgrent", netbsd_getgrent, 0 },
+       { NSDB_GROUP, "getgrent_r", netbsd_getgrent_r, 0 },
+       { NSDB_GROUP, "getgrnam", netbsd_getgrnam, 0 },
+       { NSDB_GROUP, "getgrnam_r", netbsd_getgrnam_r, 0 },
+       { NSDB_GROUP, "getgrgid", netbsd_getgrgid, 0 },
+       { NSDB_GROUP, "getgrgid_r", netbsd_getgrgid_r, 0 },
+};
+
+static int
+netbsd_setpwent(void *rv, void *cb_data, va_list ap)
+{
+       NSS_STATUS s;
+
+       s = _nss_ldap_setpwent();
+
+       return nss2netbsderr[s];
+}
+
+static int
+netbsd_setpassent(void *rv, void *cb_data, va_list ap)
+{
+       NSS_STATUS s;
+       int *retval = va_arg(ap, int *);
+       int stayopen = va_arg(ap, int);
+
+       /* XXX stayopen ignored */
+       s = _nss_ldap_setpwent();
+
+       if (s == NSS_STATUS_SUCCESS)
+               *retval = 1;
+       else
+               *retval = 0;
+
+       return nss2netbsderr[s];
+}
+
+static int
+netbsd_endpwent(void *rv, void *cb_data, va_list ap)
+{
+       NSS_STATUS s;
+
+       s = _nss_ldap_endpwent();
+
+       return nss2netbsderr[s];
+}
+
+static int
+netbsd_getpwent(void *rv, void *cb_data, va_list ap)
+{
+       int err;
+       NSS_STATUS s;
+       struct passwd **retval = va_arg(ap, struct passwd **);
+
+       memset(&rpw, 0, sizeof(rpw));
+       s = _nss_ldap_getpwent_r(&rpw, pwbuf, sizeof(pwbuf), &err);
+
+       if (s == NSS_STATUS_SUCCESS) {
+               rpw.pw_class = ""; /* XXX */
+               *retval = &rpw;
+       } else
+               *retval = 0;
+
+       return nss2netbsderr[s];
+}
+
+static int
+netbsd_getpwent_r(void *rv, void *cb_data, va_list ap)
+{
+       int err;
+       NSS_STATUS s;
+       int *retval = va_arg(ap, int *);
+       struct passwd *pw = va_arg(ap, struct passwd *);
+       char *buf = va_arg(ap, char *);
+       size_t buflen = va_arg(ap, size_t);
+       struct passwd **result = va_arg(ap, struct passwd **);
+
+       memset(pw, 0, sizeof(*pw));
+       s = _nss_ldap_getpwent_r(pw, buf, buflen, &err);
+
+       if (s == NSS_STATUS_SUCCESS) {
+               pw->pw_class = ""; /* XXX */
+               *result = pw;
+       } else
+               *result = 0;
+
+       if (s == NSS_STATUS_SUCCESS || s == NSS_STATUS_NOTFOUND)
+               *retval = 0;
+       else
+               *retval = 1;
+
+       return nss2netbsderr[s];
+}
+
+static int
+netbsd_getpwnam(void *rv, void *cb_data, va_list ap)
+{
+       int err;
+       NSS_STATUS s;
+       struct passwd **retval = va_arg(ap, struct passwd **);
+       const char *name = va_arg(ap, const char *);
+
+       memset(&rpw, 0, sizeof(rpw));
+       s = _nss_ldap_getpwnam_r(name, &rpw, pwbuf, sizeof(pwbuf), &err);
+
+       if (s == NSS_STATUS_SUCCESS) {
+               rpw.pw_class = ""; /* XXX */
+               *retval = &rpw;
+       } else
+               *retval = 0;
+
+       return nss2netbsderr[s];
+}
+
+static int
+netbsd_getpwnam_r(void *rv, void *cb_data, va_list ap)
+{
+       int err;
+       NSS_STATUS s;
+       int *retval = va_arg(ap, int *);
+       const char *name = va_arg(ap, const char *);
+       struct passwd *pw = va_arg(ap, struct passwd *);
+       char *buf = va_arg(ap, char *);
+       size_t buflen = va_arg(ap, size_t);
+       struct passwd **result = va_arg(ap, struct passwd **);
+
+       memset(pw, 0, sizeof(*pw));
+       s = _nss_ldap_getpwnam_r(name, pw, buf, buflen, &err);
+
+       if (s == NSS_STATUS_SUCCESS) {
+               pw->pw_class = ""; /* XXX */
+               *result = pw;
+       } else
+               *result = 0;
+
+       if (s == NSS_STATUS_SUCCESS || s == NSS_STATUS_NOTFOUND)
+               *retval = 0;
+       else
+               *retval = 1;
+
+       return nss2netbsderr[s];
+}
+
+static int
+netbsd_getpwuid(void *rv, void *cb_data, va_list ap)
+{
+       int err;
+       NSS_STATUS s;
+       struct passwd **retval = va_arg(ap, struct passwd **);
+       uid_t uid = va_arg(ap, uid_t);
+
+       memset(&rpw, 0, sizeof(rpw));
+       s = _nss_ldap_getpwuid_r(uid, &rpw, pwbuf, sizeof(pwbuf), &err);
+
+       if (s == NSS_STATUS_SUCCESS) {
+               rpw.pw_class = ""; /* XXX */
+               *retval = &rpw;
+       } else
+               *retval = 0;
+
+       return nss2netbsderr[s];
+}
+
+static int
+netbsd_getpwuid_r(void *rv, void *cb_data, va_list ap)
+{
+       int err;
+       NSS_STATUS s;
+       int *retval = va_arg(ap, int *);
+       uid_t uid = va_arg(ap, uid_t);
+       struct passwd *pw = va_arg(ap, struct passwd *);
+       char *buf = va_arg(ap, char *);



Home | Main Index | Thread Index | Old Index