1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-16 07:58:04 +00:00

Add WITH_WINBIND_NSS knob, which will cause nss_winbind to be installed.

Currently only the getpwent(3) and getgrent(3) family of functions are
supported.
This commit is contained in:
Jacques Vidrine 2003-04-17 14:20:20 +00:00
parent 8e282b7bde
commit d0d6299345
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=79140
4 changed files with 107 additions and 13 deletions

View File

@ -36,6 +36,7 @@ RECYCLE?= "@comment "
LIBSAMBA?= "@comment "
BUILD_VFS?= "@comment "
WINBIND?= "@comment "
WINBIND_NSS?= "@comment "
WINBIND_AUTH_CHALLENGE?= "@comment "
.if defined(WITH_AUDIT)
@ -50,7 +51,6 @@ LIBSAMBA= ""
BUILD_VFS= ""
.endif
VARDIR= /var
SAMBA_SPOOL= ${VARDIR}/spool/samba
SCRIPTS_ENV= WRKDIRPREFIX="${WRKDIRPREFIX}" \
@ -116,6 +116,14 @@ CONFIGURE_ARGS+= --with-winbind
WINBIND= ""
.endif
.if defined(WITH_WINBIND_NSS)
.if ${OSVERSION} < 500112
BROKEN= NSS modules only supported on FreeBSD 5.1 or later
.else
WINBIND_NSS= ""
.endif
.endif
.if defined(WITH_WINBIND_AUTH_CHALLENGE)
CONFIGURE_ARGS+= --with-winbind-auth-challenge
WINBIND_AUTH_CHALLENGE= ""
@ -125,8 +133,9 @@ pre-fetch:
@${SETENV} ${SCRIPTS_ENV} ${SH} ${SCRIPTDIR}/configure.samba
post-patch:
${FIND} ${PATCH_WRKSRC} -type f -name '*.orig' -exec ${RM} {} \;
#${FIND} ${PATCH_WRKSRC} -type f -name '*.orig' -exec ${RM} {} \;
${FIND} ${PATCH_WRKSRC} -type f -empty -exec ${RM} {} \;
${CP} ${FILESDIR}/winbind_nss_bsd.c ${WRKSRC}/nsswitch/
post-clean:
@${RM} -f ${WRKDIRPREFIX}${.CURDIR}/Makefile.inc
@ -172,6 +181,7 @@ PLIST_SUB= AUDIT=${AUDIT} \
LIBSAMBA=${LIBSAMBA} \
BUILD_VFS=${BUILD_VFS} \
WINBIND=${WINBIND} \
WINBIND_NSS=${WINBIND_NSS} \
WINBIND_AUTH_CHALLENGE=${WINBIND_AUTH_CHALLENGE}
.if defined(WITH_RECYCLE) || defined(WITH_AUDIT)
@ -186,6 +196,9 @@ pre-build:
(cd ${WRKSRC} && make proto)
post-install:
.if defined(WITH_WINBIND_NSS)
${INSTALL_PROGRAM} ${WRKSRC}/nsswitch/libnss_winbind.so ${PREFIX}/lib/nss_winbind.so.1
.endif
.if defined(WITH_AUDIT) || defined(WITH_RECYCLE)
@test -d ${SAMBA_VFSDIR} || ${MKDIR} ${SAMBA_VFSDIR}
.if defined(WITH_AUDIT)

View File

@ -1,11 +1,32 @@
--- source/configure.in.orig Thu Nov 7 17:52:42 2002
+++ source/configure.in Thu Nov 7 17:53:09 2002
@@ -168,7 +168,7 @@
AC_SUBST(LIBSMBCLIENT)
# compile with optimization and without debugging by default
-CFLAGS="-O ${CFLAGS}"
+CFLAGS="${CFLAGS}"
AC_ARG_ENABLE(debug,
[ --enable-debug Turn on compiler debugging information (default=no)],
*** source/configure.in.orig Wed Apr 16 20:59:48 2003
--- source/configure.in Wed Apr 16 21:00:36 2003
***************
*** 170,176 ****
AC_SUBST(LIBSMBCLIENT)
# compile with optimization and without debugging by default
! CFLAGS="-O ${CFLAGS}"
AC_ARG_ENABLE(debug,
[ --enable-debug Turn on compiler debugging information (default=no)],
--- 170,176 ----
AC_SUBST(LIBSMBCLIENT)
# compile with optimization and without debugging by default
! CFLAGS="${CFLAGS}"
AC_ARG_ENABLE(debug,
[ --enable-debug Turn on compiler debugging information (default=no)],
***************
*** 2954,2959 ****
--- 2954,2963 ----
*linux*|*irix*)
HAVE_WINBIND=yes
;;
+ *freebsd5*)
+ HAVE_WINBIND=yes
+ WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_bsd.o"
+ ;;
*solaris*)
HAVE_WINBIND=yes
WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_solaris.o"

View File

@ -0,0 +1,59 @@
#include <sys/param.h>
#include <pwd.h>
#include <grp.h>
#include <nss.h>
extern enum nss_status _nss_winbind_getgrent_r(struct group *, char *, size_t,
int *);
extern enum nss_status _nss_winbind_getgrnam_r(const char *, struct group *,
char *, size_t, int *);
extern enum nss_status _nss_winbind_getgrgid_r(gid_t gid, struct group *, char *,
size_t, int *);
extern enum nss_status _nss_winbind_setgrent(void);
extern enum nss_status _nss_winbind_endgrent(void);
extern enum nss_status _nss_winbind_getpwent_r(struct passwd *, char *, size_t,
int *);
extern enum nss_status _nss_winbind_getpwnam_r(const char *, struct passwd *,
char *, size_t, int *);
extern enum nss_status _nss_winbind_getpwuid_r(gid_t gid, struct passwd *, char *,
size_t, int *);
extern enum nss_status _nss_winbind_setpwent(void);
extern enum nss_status _nss_winbind_endpwent(void);
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);
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);
static ns_mtab methods[] = {
{ NSDB_GROUP, "getgrnam_r", __nss_compat_getgrnam_r, _nss_winbind_getgrnam_r },
{ NSDB_GROUP, "getgrgid_r", __nss_compat_getgrgid_r, _nss_winbind_getgrgid_r },
{ NSDB_GROUP, "getgrent_r", __nss_compat_getgrent_r, _nss_winbind_getgrent_r },
{ NSDB_GROUP, "endgrent", __nss_compat_setgrent, _nss_winbind_setgrent },
{ NSDB_GROUP, "setgrent", __nss_compat_endgrent, _nss_winbind_endgrent },
{ NSDB_PASSWD, "getpwnam_r", __nss_compat_getpwnam_r, _nss_winbind_getpwnam_r },
{ NSDB_PASSWD, "getpwuid_r", __nss_compat_getpwuid_r, _nss_winbind_getpwuid_r },
{ NSDB_PASSWD, "getpwent_r", __nss_compat_getpwent_r, _nss_winbind_getpwent_r },
{ NSDB_PASSWD, "endpwent", __nss_compat_setpwent, _nss_winbind_setpwent },
{ NSDB_PASSWD, "setpwent", __nss_compat_endpwent, _nss_winbind_endpwent },
};
ns_mtab *
nss_module_register(const char *source, unsigned int *mtabsize,
nss_module_unregister_fn *unreg)
{
*mtabsize = sizeof(methods)/sizeof(methods[0]);
*unreg = NULL;
return (methods);
}

View File

@ -16,6 +16,7 @@ bin/tdbbackup
bin/testparm
bin/testprns
%%WINBIND_AUTH_CHALLENGE%%bin/wbinfo
%%WINBIND_NSS%%lib/nss_winbind.so.1
%%WINBIND%%sbin/winbindd
etc/codepages/codepage.1125
etc/codepages/unicode_map.1125