r25068: Older samba3 DCs will return DCERPC_FAULT_OP_RNG_ERROR for every opcode on the
[Samba.git] / source / lib / ldb / nssldb / ldb-nss.h
blobc780a21e8119ee80b22c19787c168cffc01bf029
1 /*
2 LDB nsswitch module
4 Copyright (C) Simo Sorce 2006
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with this library; if not, write to the
18 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.
22 #ifndef _LDB_NSS
23 #define _LDB_NSS
25 #include "includes.h"
26 #include "ldb/include/includes.h"
28 #include <nss.h>
29 #include <pwd.h>
30 #include <grp.h>
32 #define _LDB_NSS_URL "etc/users.ldb"
33 #define _LDB_NSS_BASEDN "CN=Users,CN=System"
34 #define _LDB_NSS_PWENT_FILTER "(&(objectClass=posixAccount)(!(uidNumber=0))(!(gidNumber=0)))"
35 #define _LDB_NSS_PWUID_FILTER "(&(objectClass=posixAccount)(uidNumber=%d)(!(gidNumber=0)))"
36 #define _LDB_NSS_PWNAM_FILTER "(&(objectClass=posixAccount)(uid=%s)(!(uidNumber=0))(!(gidNumber=0)))"
38 #define _LDB_NSS_GRENT_FILTER "(&(objectClass=posixGroup)(!(gidNumber=0)))"
39 #define _LDB_NSS_GRGID_FILTER "(&(objectClass=posixGroup)(gidNumber=%d)))"
40 #define _LDB_NSS_GRNAM_FILTER "(&(objectClass=posixGroup)(cn=%s)(!(gidNumber=0)))"
42 typedef enum nss_status NSS_STATUS;
44 struct _ldb_nss_context {
46 pid_t pid;
48 struct ldb_context *ldb;
49 const struct ldb_dn *base;
51 int pw_cur;
52 struct ldb_result *pw_res;
54 int gr_cur;
55 struct ldb_result *gr_res;
58 NSS_STATUS _ldb_nss_init(void);
60 NSS_STATUS _ldb_nss_fill_passwd(struct passwd *result,
61 char *buffer,
62 int buflen,
63 int *errnop,
64 struct ldb_message *msg);
66 NSS_STATUS _ldb_nss_fill_group(struct group *result,
67 char *buffer,
68 int buflen,
69 int *errnop,
70 struct ldb_message *group,
71 struct ldb_result *members);
73 NSS_STATUS _ldb_nss_fill_initgr(gid_t group,
74 long int limit,
75 long int *start,
76 long int *size,
77 gid_t **groups,
78 int *errnop,
79 struct ldb_result *grlist);
81 NSS_STATUS _ldb_nss_group_request(struct ldb_result **res,
82 struct ldb_dn *group_dn,
83 const char * const *attrs,
84 const char *mattr);
86 #endif /* _LDB_NSS */