1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
samba-mirror/nsswitch/winbind_nss_freebsd.c
Sergey Korsak 9bf3dc3ca7 Fix Bug #8099 setpwent() actually does endpwent() and vice versa on FreeBSD
Signed-off-by: Günther Deschner <gd@samba.org>

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Tue Apr 19 19:15:14 CEST 2011 on sn-devel-104
2011-04-19 19:15:13 +02:00

80 lines
3.2 KiB
C

/*
Unix SMB/CIFS implementation.
AIX loadable authentication module, providing identification
routines against Samba winbind/Windows NT Domain
Copyright (C) Aaron Collins 2003
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "winbind_client.h"
/* Make sure that the module gets registered needed by freebsd 5.1 */
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, "setgrent", __nss_compat_setgrent, _nss_winbind_setgrent },
{ NSDB_GROUP, "endgrent", __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, "setpwent", __nss_compat_setpwent, _nss_winbind_setpwent },
{ NSDB_PASSWD, "endpwent", __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);
}