Samba 3: added Samba 3.0.24 sources
[tomato.git] / release / src / router / samba3 / source / nsswitch / winbind_nss_freebsd.c
blobb73a4ce44f87844f79723251f3b1cb100e0a7fc2
1 /*
2 Unix SMB/CIFS implementation.
4 AIX loadable authentication module, providing identification
5 routines against Samba winbind/Windows NT Domain
7 Copyright (C) Aaron Collins 2003
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public
11 License as published by the Free Software Foundation; either
12 version 2 of the License, or (at your option) any later version.
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Library General Public License for more details.
19 You should have received a copy of the GNU Library General Public
20 License along with this library; if not, write to the
21 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA.
25 #include "winbind_client.h"
27 /* Make sure that the module gets registered needed by freebsd 5.1 */
29 extern enum nss_status _nss_winbind_getgrent_r(struct group *, char *, size_t,
30 int *);
31 extern enum nss_status _nss_winbind_getgrnam_r(const char *, struct group *,
32 char *, size_t, int *);
33 extern enum nss_status _nss_winbind_getgrgid_r(gid_t gid, struct group *, char *,
34 size_t, int *);
35 extern enum nss_status _nss_winbind_setgrent(void);
36 extern enum nss_status _nss_winbind_endgrent(void);
38 extern enum nss_status _nss_winbind_getpwent_r(struct passwd *, char *, size_t,
39 int *);
40 extern enum nss_status _nss_winbind_getpwnam_r(const char *, struct passwd *,
41 char *, size_t, int *);
42 extern enum nss_status _nss_winbind_getpwuid_r(gid_t gid, struct passwd *, char *,
43 size_t, int *);
44 extern enum nss_status _nss_winbind_setpwent(void);
45 extern enum nss_status _nss_winbind_endpwent(void);
47 NSS_METHOD_PROTOTYPE(__nss_compat_getgrnam_r);
48 NSS_METHOD_PROTOTYPE(__nss_compat_getgrgid_r);
49 NSS_METHOD_PROTOTYPE(__nss_compat_getgrent_r);
50 NSS_METHOD_PROTOTYPE(__nss_compat_setgrent);
51 NSS_METHOD_PROTOTYPE(__nss_compat_endgrent);
53 NSS_METHOD_PROTOTYPE(__nss_compat_getpwnam_r);
54 NSS_METHOD_PROTOTYPE(__nss_compat_getpwuid_r);
55 NSS_METHOD_PROTOTYPE(__nss_compat_getpwent_r);
56 NSS_METHOD_PROTOTYPE(__nss_compat_setpwent);
57 NSS_METHOD_PROTOTYPE(__nss_compat_endpwent);
59 static ns_mtab methods[] = {
60 { NSDB_GROUP, "getgrnam_r", __nss_compat_getgrnam_r, _nss_winbind_getgrnam_r },
61 { NSDB_GROUP, "getgrgid_r", __nss_compat_getgrgid_r, _nss_winbind_getgrgid_r },
62 { NSDB_GROUP, "getgrent_r", __nss_compat_getgrent_r, _nss_winbind_getgrent_r },
63 { NSDB_GROUP, "endgrent", __nss_compat_setgrent, _nss_winbind_setgrent },
64 { NSDB_GROUP, "setgrent", __nss_compat_endgrent, _nss_winbind_endgrent },
66 { NSDB_PASSWD, "getpwnam_r", __nss_compat_getpwnam_r, _nss_winbind_getpwnam_r },
67 { NSDB_PASSWD, "getpwuid_r", __nss_compat_getpwuid_r, _nss_winbind_getpwuid_r },
68 { NSDB_PASSWD, "getpwent_r", __nss_compat_getpwent_r, _nss_winbind_getpwent_r },
69 { NSDB_PASSWD, "endpwent", __nss_compat_setpwent, _nss_winbind_setpwent },
70 { NSDB_PASSWD, "setpwent", __nss_compat_endpwent, _nss_winbind_endpwent },
74 ns_mtab *
75 nss_module_register(const char *source, unsigned int *mtabsize,
76 nss_module_unregister_fn *unreg)
78 *mtabsize = sizeof(methods)/sizeof(methods[0]);
79 *unreg = NULL;
80 return (methods);