2 Unix SMB/Netbios implementation.
5 Copyright (C) Jeremy Allison 1998-2000.
6 Copyright (C) Luke Kenneth Casson Leighton 1996-2000.
7 Copyright (C) Luke Howard 2000.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program 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
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 * LDAP implementation of a SURS (sid to uid resolution) table.
35 /******************************************************************
36 converts SID + SID_NAME_USE type to a UNIX id.
37 ********************************************************************/
38 BOOL
surs_nt5ldap_sam_sid_to_unixid(LDAPDB
*hds
, DOM_SID
* sid
, uint32 type
,
39 uint32
* id
, BOOL create
)
41 if (!ldapdb_lookup_by_sid(hds
, sid
))
47 return ldapdb_get_uint32(hds
, "uidNumber", id
);
50 return ldapdb_get_uint32(hds
, "gidNumber", id
);
58 /******************************************************************
59 converts UNIX gid + SID_NAME_USE type to a SID.
60 ********************************************************************/
61 BOOL
surs_nt5ldap_unixid_to_sam_sid(LDAPDB
*hds
, uint32 id
, uint32 type
,
62 DOM_SID
* sid
, BOOL create
)
66 char *attrs
[] = { "objectSid", NULL
};
73 attribute
= "uidNumber";
77 case SID_NAME_DOM_GRP
:
78 case SID_NAME_WKN_GRP
:
80 attribute
= "gidNumber";
89 slprintf(filter
, sizeof(filter
) - 1, "(&(objectSid=*)(%s=%d))",
91 return ldapdb_search(hds
, NULL
, filter
, attrs
, 1)
92 && ldapdb_get_sid(hds
, "objectSid", sid
);
95 #endif /* WITH_NT5LDAP */