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.
26 #include "ldb/include/includes.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
{
48 struct ldb_context
*ldb
;
49 const struct ldb_dn
*base
;
52 struct ldb_result
*pw_res
;
55 struct ldb_result
*gr_res
;
58 NSS_STATUS
_ldb_nss_init(void);
60 NSS_STATUS
_ldb_nss_fill_passwd(struct passwd
*result
,
64 struct ldb_message
*msg
);
66 NSS_STATUS
_ldb_nss_fill_group(struct group
*result
,
70 struct ldb_message
*group
,
71 struct ldb_result
*members
);
73 NSS_STATUS
_ldb_nss_fill_initgr(gid_t group
,
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
,