2 Unix SMB/CIFS implementation.
6 Copyright (C) Simo Sorce 2003
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #define DBGC_CLASS DBGC_IDMAP
28 /* Get a sid from an id */
29 static NTSTATUS db_get_sid_from_id(DOM_SID *sid, unid_t id, int id_type) {
30 switch (id_type & ID_TYPEMASK) {
32 if (winbind_uid_to_sid(sid, id.uid)) {
37 if (winbind_gid_to_sid(sid, id.gid)) {
42 return NT_STATUS_INVALID_PARAMETER;
45 return NT_STATUS_UNSUCCESSFUL;
48 /* Get an id from a sid */
49 static NTSTATUS db_get_id_from_sid(unid_t *id, int *id_type, const DOM_SID *sid) {
50 switch (*id_type & ID_TYPEMASK) {
52 if (winbind_sid_to_uid(&((*id).uid), sid)) {
57 if (winbind_sid_to_gid(&((*id).gid), sid)) {
62 if (winbind_sid_to_uid(&((*id).uid), sid) ||
63 winbind_sid_to_gid(&((*id).gid), sid)) {
68 return NT_STATUS_UNSUCCESSFUL;
71 static NTSTATUS db_set_mapping(DOM_SID *sid, unid_t id, int id_type) {
72 return NT_STATUS_UNSUCCESSFUL;
75 /*****************************************************************************
76 Initialise idmap database.
77 *****************************************************************************/
78 static NTSTATUS db_init(const char *db_name) {
83 static NTSTATUS db_close(void) {
87 static void db_status(void) {
91 struct idmap_methods winbind_methods = {
102 NTSTATUS idmap_reg_winbind(struct idmap_methods **meth)
104 *meth = &winbind_methods;