THE Idmap patch :-)
[amitay/samba.git] / source3 / include / idmap.h
1 /* 
2    Unix SMB/CIFS implementation.
3
4    Idmap headers
5
6    Copyright (C) Anthony Liguori 2003
7    Copyright (C) Simo Sorce 2003
8    
9    This library is free software; you can redistribute it and/or
10    modify it under the terms of the GNU Library General Public
11    License as published by the Free Software Foundation; either
12    version 2 of the License, or (at your option) any later version.
13    
14    This library 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 GNU
17    Library General Public License for more details.
18    
19    You should have received a copy of the GNU Library General Public
20    License along with this library; if not, write to the
21    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22    Boston, MA  02111-1307, USA.   
23 */
24
25 #define ID_EMPTY        0x00
26 #define ID_USERID       0x01
27 #define ID_GROUPID      0x02
28 #define ID_OTHER        0x04
29
30 #define ID_TYPEMASK     0x0f
31
32 #define ID_NOMAP        0x10
33 #define ID_CACHE        0x20
34
35 typedef union unid_t {
36         uid_t uid;
37         gid_t gid;
38 } unid_t;
39
40 /* Filled out by IDMAP backends */
41 struct idmap_methods {
42
43         /* Called when backend is first loaded */
44         NTSTATUS (*init)(const char *init_str);
45
46         NTSTATUS (*get_sid_from_id)(DOM_SID *sid, unid_t id, int id_type);
47         NTSTATUS (*get_id_from_sid)(unid_t *id, int *id_type, const DOM_SID *sid);
48         NTSTATUS (*set_mapping)(DOM_SID *sid, unid_t id, int id_type);
49
50         /* Called when backend is unloaded */
51         NTSTATUS (*close)(void);
52
53         /* Called to dump backend status */
54         void (*status)(void);
55 };
56