Some progress towards gums and tdbsam2
[Samba.git] / source3 / include / gums.h
blob789acc269f3120181caba184e2fb7811551bef64
1 /*
2 Unix SMB/CIFS implementation.
3 GUMS structures
4 Copyright (C) Simo Sorce 2002
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program 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
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef _GUMS_H
22 #define _GUMS_H
24 #define GUMS_VERSION_MAJOR 0
25 #define GUMS_VERSION_MINOR 1
26 #define GUMS_OBJECT_VERSION 1
28 #define GUMS_OBJ_DOMAIN 1
29 #define GUMS_OBJ_NORMAL_USER 2
30 #define GUMS_OBJ_GROUP 3
31 #define GUMS_OBJ_ALIAS 4
32 #define GUMS_OBJ_WORKSTATION_TRUST 5
33 #define GUMS_OBJ_SERVER_TRUST 6
34 #define GUMS_OBJ_DOMAIN_TRUST 7
36 typedef struct gums_user
38 DOM_SID *group_sid; /* Primary Group SID */
40 NTTIME logon_time; /* logon time */
41 NTTIME logoff_time; /* logoff time */
42 NTTIME kickoff_time; /* kickoff time */
43 NTTIME pass_last_set_time; /* password last set time */
44 NTTIME pass_can_change_time; /* password can change time */
45 NTTIME pass_must_change_time; /* password must change time */
47 char *full_name; /* user's full name string */
48 char *home_dir; /* home directory string */
49 char *dir_drive; /* home directory drive string */
50 char *logon_script; /* logon script string */
51 char *profile_path; /* profile path string */
52 char *workstations; /* login from workstations string */
53 char *unknown_str; /* don't know what this is, yet. */
54 char *munged_dial; /* munged path name and dial-back tel number */
56 DATA_BLOB lm_pw; /* .data is Null if no password */
57 DATA_BLOB nt_pw; /* .data is Null if no password */
59 uint32 unknown_3; /* 0x00ff ffff */
61 uint16 logon_divs; /* 168 - number of hours in a week */
62 uint32 hours_len; /* normally 21 bytes */
63 uint8 *hours;
65 uint32 unknown_5; /* 0x0002 0000 */
66 uint32 unknown_6; /* 0x0000 04ec */
68 } GUMS_USER;
70 typedef struct gums_group
72 uint32 count; /* Number of SIDs */
73 DOM_SID **members; /* SID array */
75 } GUMS_GROUP;
77 typedef struct gums_domain
79 uint32 next_rid;
81 } GUMS_DOMAIN;
83 union gums_obj_p {
84 GUMS_USER *user;
85 GUMS_GROUP *group;
86 GUMS_DOMAIN *domain;
89 typedef struct gums_object
91 TALLOC_CTX *mem_ctx;
93 uint32 type; /* Object Type */
94 uint32 version; /* Object Version */
95 uint32 seq_num; /* Object Sequence Number */
97 SEC_DESC *sec_desc; /* Security Descriptor */
99 DOM_SID *sid; /* Object Sid */
100 char *name; /* Object Name */
101 char *description; /* Object Description */
103 union gums_obj_p data; /* Object Specific data */
105 } GUMS_OBJECT;
107 typedef struct gums_data_set
109 int type; /* GUMS_SET_xxx */
110 void *data;
112 } GUMS_DATA_SET;
114 typedef struct gums_commit_set
116 TALLOC_CTX *mem_ctx;
118 uint32 type; /* Object type */
119 DOM_SID sid; /* Object Sid */
120 uint32 count; /* number of changes */
121 GUMS_DATA_SET **data;
123 } GUMS_COMMIT_SET;
125 typedef struct gums_privilege
127 TALLOC_CTX *mem_ctx;
129 uint32 type; /* Object Type */
130 uint32 version; /* Object Version */
131 uint32 seq_num; /* Object Sequence Number */
133 LUID_ATTR *privilege; /* Privilege Type */
134 char *name; /* Object Name */
135 char *description; /* Object Description */
137 uint32 count;
138 DOM_SID **members;
140 } GUMS_PRIVILEGE;
143 typedef struct gums_functions
145 /* Generic object functions */
147 NTSTATUS (*get_domain_sid) (DOM_SID **sid, const char* name);
148 NTSTATUS (*set_domain_sid) (const DOM_SID *sid);
150 NTSTATUS (*get_sequence_number) (void);
152 NTSTATUS (*new_object) (DOM_SID **sid, const char *name, const int obj_type);
153 NTSTATUS (*delete_object) (const DOM_SID *sid);
155 NTSTATUS (*get_object_from_sid) (GUMS_OBJECT **object, const DOM_SID *sid, const int obj_type);
156 NTSTATUS (*get_object_from_name) (GUMS_OBJECT **object, const char *name, const int onj_type);
157 /* This function is used to get the list of all objects changed since b_time, it is
158 used to support PDC<->BDC synchronization */
159 NTSTATUS (*get_updated_objects) (GUMS_OBJECT **objects, const NTTIME base_time);
161 NTSTATUS (*enumerate_objects_start) (void *handle, const DOM_SID *sid, const int obj_type);
162 NTSTATUS (*enumerate_objects_get_next) (GUMS_OBJECT **object, void *handle);
163 NTSTATUS (*enumerate_objects_stop) (void *handle);
165 /* This function MUST be used ONLY by PDC<->BDC replication code or recovery tools.
166 Never use this function to update an object in the database, use set_object_values() */
167 NTSTATUS (*set_object) (const GUMS_OBJECT *object);
169 /* set object values function */
170 NTSTATUS (*set_object_values) (DOM_SID *sid, uint32 count, GUMS_DATA_SET **data_set);
172 /* Group related functions */
173 NTSTATUS (*add_members_to_group) (const DOM_SID *group, const DOM_SID **members);
174 NTSTATUS (*delete_members_from_group) (const DOM_SID *group, const DOM_SID **members);
175 NTSTATUS (*enumerate_group_members) (DOM_SID **members, const DOM_SID *sid, const int type);
177 NTSTATUS (*get_sid_groups) (DOM_SID **groups, const DOM_SID *sid);
179 NTSTATUS (*lock_sid) (const DOM_SID *sid);
180 NTSTATUS (*unlock_sid) (const DOM_SID *sid);
182 /* privileges related functions */
184 NTSTATUS (*add_members_to_privilege) (const LUID_ATTR *priv, const DOM_SID **members);
185 NTSTATUS (*delete_members_from_privilege) (const LUID_ATTR *priv, const DOM_SID **members);
186 NTSTATUS (*enumerate_privilege_members) (DOM_SID **members, const LUID_ATTR *priv);
187 NTSTATUS (*get_sid_privileges) (DOM_SID **privs, const DOM_SID *sid);
189 /* warning!: set_privilege will overwrite a prior existing privilege if such exist */
190 NTSTATUS (*set_privilege) (GUMS_PRIVILEGE *priv);
192 } GUMS_FUNCTIONS;
194 /* define value types */
195 #define GUMS_SET_PRIMARY_GROUP 0x1
196 #define GUMS_SET_SEC_DESC 0x2
198 #define GUMS_SET_NAME 0x10
199 #define GUMS_SET_DESCRIPTION 0x11
200 #define GUMS_SET_FULL_NAME 0x12
202 /* user specific type values */
203 #define GUMS_SET_LOGON_TIME 0x20
204 #define GUMS_SET_LOGOFF_TIME 0x21
205 #define GUMS_SET_KICKOFF_TIME 0x23
206 #define GUMS_SET_PASS_LAST_SET_TIME 0x24
207 #define GUMS_SET_PASS_CAN_CHANGE_TIME 0x25
208 #define GUMS_SET_PASS_MUST_CHANGE_TIME 0x26
211 #define GUMS_SET_HOME_DIRECTORY 0x31
212 #define GUMS_SET_DRIVE 0x32
213 #define GUMS_SET_LOGON_SCRIPT 0x33
214 #define GUMS_SET_PROFILE_PATH 0x34
215 #define GUMS_SET_WORKSTATIONS 0x35
216 #define GUMS_SET_UNKNOWN_STRING 0x36
217 #define GUMS_SET_MUNGED_DIAL 0x37
219 #define GUMS_SET_LM_PASSWORD 0x40
220 #define GUMS_SET_NT_PASSWORD 0x41
221 #define GUMS_SET_PLAINTEXT_PASSWORD 0x42
222 #define GUMS_SET_UNKNOWN_3 0x43
223 #define GUMS_SET_LOGON_DIVS 0x44
224 #define GUMS_SET_HOURS_LEN 0x45
225 #define GUMS_SET_HOURS 0x46
226 #define GUMS_SET_UNKNOWN_5 0x47
227 #define GUMS_SET_UNKNOWN_6 0x48
229 #define GUMS_SET_MUST_CHANGE_PASS 0x50
230 #define GUMS_SET_CANNOT_CHANGE_PASS 0x51
231 #define GUMS_SET_PASS_NEVER_EXPIRE 0x52
232 #define GUMS_SET_ACCOUNT_DISABLED 0x53
233 #define GUMS_SET_ACCOUNT_LOCKOUT 0x54
235 /*group specific type values */
236 #define GUMS_ADD_SID_LIST 0x60
237 #define GUMS_DEL_SID_LIST 0x61
238 #define GUMS_SET_SID_LIST 0x62
240 #endif /* _GUMS_H */