2 Unix SMB/CIFS implementation.
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.
24 #define GUMS_VERSION_MAJOR 0
25 #define GUMS_VERSION_MINOR 1
26 #define GUMS_OBJECT_VERSION 1
27 #define GUMS_INTERFACE_VERSION 1
29 #define GUMS_OBJ_DOMAIN 0x10
30 #define GUMS_OBJ_NORMAL_USER 0x20
31 #define GUMS_OBJ_GROUP 0x30
32 #define GUMS_OBJ_ALIAS 0x31
33 #define GUMS_OBJ_PRIVILEGE 0x40
35 /* define value types */
36 #define GUMS_SET_PRIMARY_GROUP 0x1
37 #define GUMS_SET_SEC_DESC 0x2
39 #define GUMS_SET_NAME 0x10
40 #define GUMS_SET_DESCRIPTION 0x11
41 #define GUMS_SET_FULL_NAME 0x12
43 /* user specific type values */
44 #define GUMS_SET_LOGON_TIME 0x20
45 #define GUMS_SET_LOGOFF_TIME 0x21
46 #define GUMS_SET_KICKOFF_TIME 0x23
47 #define GUMS_SET_PASS_LAST_SET_TIME 0x24
48 #define GUMS_SET_PASS_CAN_CHANGE_TIME 0x25
49 #define GUMS_SET_PASS_MUST_CHANGE_TIME 0x26
52 #define GUMS_SET_HOME_DIRECTORY 0x31
53 #define GUMS_SET_DRIVE 0x32
54 #define GUMS_SET_LOGON_SCRIPT 0x33
55 #define GUMS_SET_PROFILE_PATH 0x34
56 #define GUMS_SET_WORKSTATIONS 0x35
57 #define GUMS_SET_UNKNOWN_STRING 0x36
58 #define GUMS_SET_MUNGED_DIAL 0x37
60 #define GUMS_SET_LM_PASSWORD 0x40
61 #define GUMS_SET_NT_PASSWORD 0x41
62 #define GUMS_SET_PLAINTEXT_PASSWORD 0x42
63 #define GUMS_SET_UNKNOWN_3 0x43
64 #define GUMS_SET_LOGON_DIVS 0x44
65 #define GUMS_SET_HOURS_LEN 0x45
66 #define GUMS_SET_HOURS 0x46
67 #define GUMS_SET_BAD_PASSWORD_COUNT 0x47
68 #define GUMS_SET_LOGON_COUNT 0x48
69 #define GUMS_SET_UNKNOWN_6 0x49
71 #define GUMS_SET_MUST_CHANGE_PASS 0x50
72 #define GUMS_SET_CANNOT_CHANGE_PASS 0x51
73 #define GUMS_SET_PASS_NEVER_EXPIRE 0x52
74 #define GUMS_SET_ACCOUNT_DISABLED 0x53
75 #define GUMS_SET_ACCOUNT_LOCKOUT 0x54
77 /*group specific type values */
78 #define GUMS_ADD_SID_LIST 0x60
79 #define GUMS_DEL_SID_LIST 0x61
80 #define GUMS_SET_SID_LIST 0x62
82 typedef struct gums_user
84 DOM_SID
*group_sid
; /* Primary Group SID */
86 NTTIME logon_time
; /* logon time */
87 NTTIME logoff_time
; /* logoff time */
88 NTTIME kickoff_time
; /* kickoff time */
89 NTTIME pass_last_set_time
; /* password last set time */
90 NTTIME pass_can_change_time
; /* password can change time */
91 NTTIME pass_must_change_time
; /* password must change time */
93 char *full_name
; /* user's full name string */
94 char *home_dir
; /* home directory string */
95 char *dir_drive
; /* home directory drive string */
96 char *logon_script
; /* logon script string */
97 char *profile_path
; /* profile path string */
98 char *workstations
; /* login from workstations string */
99 char *unknown_str
; /* don't know what this is, yet. */
100 char *munged_dial
; /* munged path name and dial-back tel number */
102 DATA_BLOB lm_pw
; /* .data is Null if no password */
103 DATA_BLOB nt_pw
; /* .data is Null if no password */
105 uint16 acct_ctrl
; /* account type & status flags */
106 uint16 logon_divs
; /* 168 - number of hours in a week */
107 uint32 hours_len
; /* normally 21 bytes */
110 uint16 bad_password_count
; /* 0 */
111 uint16 logon_count
; /* 0 */
112 uint32 unknown_3
; /* 0x00ff ffff */
113 uint32 unknown_6
; /* 0x0000 04ec */
117 typedef struct gums_group
119 uint32 count
; /* Number of SIDs */
120 DOM_SID
*members
; /* SID array */
124 typedef struct gums_domain
130 typedef struct gums_privilege
132 LUID_ATTR
*privilege
; /* Privilege Type */
143 GUMS_PRIVILEGE
*priv
;
146 typedef struct gums_object
150 uint32 type
; /* Object Type */
151 uint32 version
; /* Object Version */
152 uint32 seq_num
; /* Object Sequence Number */
154 SEC_DESC
*sec_desc
; /* Security Descriptor */
156 DOM_SID
*sid
; /* Object Sid */
157 char *name
; /* Object Name */
158 char *description
; /* Object Description */
160 union gums_obj_p data
; /* Object Specific data */
164 typedef struct gums_data_set
166 int type
; /* GUMS_SET_xxx */
171 typedef struct gums_commit_set
175 uint32 type
; /* Object type */
176 DOM_SID sid
; /* Object Sid */
177 uint32 count
; /* number of changes */
182 typedef struct gums_priv_commit_set
186 uint32 type
; /* Object type */
187 char *name
; /* Object Sid */
188 uint32 count
; /* number of changes */
191 } GUMS_PRIV_COMMIT_SET
;
194 typedef struct gums_functions
200 void (*free_private_data
)(void **);
202 /* Generic object functions */
204 NTSTATUS (*get_domain_sid
) (DOM_SID
*sid
, const char* name
);
205 NTSTATUS (*set_domain_sid
) (const DOM_SID
*sid
);
207 NTSTATUS (*get_sequence_number
) (void);
209 NTSTATUS (*new_object
) (DOM_SID
*sid
, const char *name
, const int obj_type
);
210 NTSTATUS (*delete_object
) (const DOM_SID
*sid
);
212 NTSTATUS (*get_object_from_sid
) (GUMS_OBJECT
**object
, const DOM_SID
*sid
, const int obj_type
);
213 NTSTATUS (*get_object_from_name
) (GUMS_OBJECT
**object
, const char *name
, const int obj_type
);
214 /* This function is used to get the list of all objects changed since b_time, it is
215 used to support PDC<->BDC synchronization */
216 NTSTATUS (*get_updated_objects
) (GUMS_OBJECT
**objects
, const NTTIME base_time
);
218 NTSTATUS (*enumerate_objects_start
) (void **handle
, const DOM_SID
*sid
, const int obj_type
);
219 NTSTATUS (*enumerate_objects_get_next
) (GUMS_OBJECT
**object
, void *handle
);
220 NTSTATUS (*enumerate_objects_stop
) (void *handle
);
222 /* This function MUST be used ONLY by PDC<->BDC replication code or recovery tools.
223 Never use this function to update an object in the database, use set_object_values() */
224 NTSTATUS (*set_object
) (const GUMS_OBJECT
*object
);
226 /* set object values function */
227 NTSTATUS (*set_object_values
) (DOM_SID
*sid
, uint32 count
, GUMS_DATA_SET
*data_set
);
229 /* Group related functions */
230 NTSTATUS (*add_members_to_group
) (const DOM_SID
*group
, const DOM_SID
**members
);
231 NTSTATUS (*delete_members_from_group
) (const DOM_SID
*group
, const DOM_SID
**members
);
232 NTSTATUS (*enumerate_group_members
) (DOM_SID
**members
, const DOM_SID
*sid
, const int type
);
234 NTSTATUS (*get_sid_groups
) (DOM_SID
**groups
, const DOM_SID
*sid
);
236 NTSTATUS (*lock_sid
) (const DOM_SID
*sid
);
237 NTSTATUS (*unlock_sid
) (const DOM_SID
*sid
);
239 /* privileges related functions */
241 NTSTATUS (*add_members_to_privilege
) (const LUID_ATTR
*priv
, const DOM_SID
**members
);
242 NTSTATUS (*delete_members_from_privilege
) (const LUID_ATTR
*priv
, const DOM_SID
**members
);
243 NTSTATUS (*enumerate_privilege_members
) (DOM_SID
**members
, const LUID_ATTR
*priv
);
244 NTSTATUS (*get_sid_privileges
) (DOM_SID
**privs
, const DOM_SID
*sid
);
246 /* warning!: set_privilege will overwrite a prior existing privilege if such exist */
247 NTSTATUS (*set_privilege
) (GUMS_PRIVILEGE
*priv
);
251 typedef NTSTATUS (*gums_init_function
)(
252 struct gums_functions
*,
255 struct gums_init_function_entry
{
258 gums_init_function init_fn
;
259 struct gums_init_function_entry
*prev
, *next
;