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/>.
24 #include "ldb/include/includes.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
{
46 struct ldb_context
*ldb
;
50 struct ldb_result
*pw_res
;
53 struct ldb_result
*gr_res
;
56 NSS_STATUS
_ldb_nss_init(void);
58 NSS_STATUS
_ldb_nss_fill_passwd(struct passwd
*result
,
62 struct ldb_message
*msg
);
64 NSS_STATUS
_ldb_nss_fill_group(struct group
*result
,
68 struct ldb_message
*group
,
69 struct ldb_result
*members
);
71 NSS_STATUS
_ldb_nss_fill_initgr(gid_t group
,
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
,