librpc: Shorten dcerpc_binding_handle_call a bit
[Samba/gebeck_regimport.git] / lib / ldb / nssldb / ldb-nss.h
blob583876fea67b485696600063f11ab5822319ec13
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 Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 3 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 Lesser General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef _LDB_NSS
21 #define _LDB_NSS
23 #include "includes.h"
24 #include "ldb/include/includes.h"
26 #include <nss.h>
27 #include <pwd.h>
28 #include <grp.h>
30 #define _LDB_NSS_URL "etc/users.ldb"
31 #define _LDB_NSS_BASEDN "CN=Users,CN=System"
32 #define _LDB_NSS_PWENT_FILTER "(&(objectClass=posixAccount)(!(uidNumber=0))(!(gidNumber=0)))"
33 #define _LDB_NSS_PWUID_FILTER "(&(objectClass=posixAccount)(uidNumber=%d)(!(gidNumber=0)))"
34 #define _LDB_NSS_PWNAM_FILTER "(&(objectClass=posixAccount)(uid=%s)(!(uidNumber=0))(!(gidNumber=0)))"
36 #define _LDB_NSS_GRENT_FILTER "(&(objectClass=posixGroup)(!(gidNumber=0)))"
37 #define _LDB_NSS_GRGID_FILTER "(&(objectClass=posixGroup)(gidNumber=%d)))"
38 #define _LDB_NSS_GRNAM_FILTER "(&(objectClass=posixGroup)(cn=%s)(!(gidNumber=0)))"
40 typedef enum nss_status NSS_STATUS;
42 struct _ldb_nss_context {
44 pid_t pid;
46 struct ldb_context *ldb;
47 struct ldb_dn *base;
49 int pw_cur;
50 struct ldb_result *pw_res;
52 int gr_cur;
53 struct ldb_result *gr_res;
56 NSS_STATUS _ldb_nss_init(void);
58 NSS_STATUS _ldb_nss_fill_passwd(struct passwd *result,
59 char *buffer,
60 int buflen,
61 int *errnop,
62 struct ldb_message *msg);
64 NSS_STATUS _ldb_nss_fill_group(struct group *result,
65 char *buffer,
66 int buflen,
67 int *errnop,
68 struct ldb_message *group,
69 struct ldb_result *members);
71 NSS_STATUS _ldb_nss_fill_initgr(gid_t group,
72 long int limit,
73 long int *start,
74 long int *size,
75 gid_t **groups,
76 int *errnop,
77 struct ldb_result *grlist);
79 NSS_STATUS _ldb_nss_group_request(struct ldb_result **res,
80 struct ldb_dn *group_dn,
81 const char * const *attrs,
82 const char *mattr);
84 #endif /* _LDB_NSS */