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
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 */
65 uint32 unknown_5
; /* 0x0002 0000 */
66 uint32 unknown_6
; /* 0x0000 04ec */
70 typedef struct gums_group
72 uint32 count
; /* Number of SIDs */
73 DOM_SID
**members
; /* SID array */
82 typedef struct gums_object
86 uint32 type
; /* Object Type */
87 uint32 version
; /* Object Version */
88 uint32 seq_num
; /* Object Sequence Number */
90 SEC_DESC
*sec_desc
; /* Security Descriptor */
92 DOM_SID
*sid
; /* Object Sid */
93 char *name
; /* Object Name */
94 char *description
; /* Object Description */
96 union gums_obj_p data
; /* Object Specific data */
100 typedef struct gums_data_set
102 int type
; /* GUMS_SET_xxx */
107 typedef struct gums_commit_set
111 uint32 type
; /* Object type */
112 DOM_SID sid
; /* Object Sid */
113 uint32 count
; /* number of changes */
114 GUMS_DATA_SET
**data
;
117 typedef struct gums_privilege
121 uint32 type
; /* Object Type */
122 uint32 version
; /* Object Version */
123 uint32 seq_num
; /* Object Sequence Number */
125 LUID_ATTR
*privilege
; /* Privilege Type */
126 char *name
; /* Object Name */
127 char *description
; /* Object Description */
135 typedef struct gums_functions
137 /* Generic object functions */
139 NTSTATUS (*get_domain_sid
) (DOM_SID
**sid
, const char* name
);
140 NTSTATUS (*set_domain_sid
) (const DOM_SID
*sid
);
142 NTSTATUS (*get_sequence_number
) (void);
144 NTSTATUS (*new_object
) (DOM_SID
**sid
, const char *name
, const int obj_type
);
145 NTSTATUS (*delete_object
) (const DOM_SID
*sid
);
147 NTSTATUS (*get_object_from_sid
) (GUMS_OBJECT
**object
, const DOM_SID
*sid
, const int obj_type
);
148 NTSTATUS (*get_sid_from_name
) (GUMS_OBJECT
**object
, const char *name
);
149 /* This function is used to get the list of all objects changed since b_time, it is
150 used to support PDC<->BDC synchronization */
151 NTSTATUS (*get_updated_objects
) (GUMS_OBJECT
**objects
, const NTTIME base_time
);
153 NTSTATUS (*enumerate_objects_start
) (void *handle
, const DOM_SID
*sid
, const int obj_type
);
154 NTSTATUS (*enumerate_objects_get_next
) (GUMS_OBJECT
**object
, void *handle
);
155 NTSTATUS (*enumerate_objects_stop
) (void *handle
);
157 /* This function MUST be used ONLY by PDC<->BDC replication code or recovery tools.
158 Never use this function to update an object in the database, use set_object_values() */
159 NTSTATUS (*set_object
) (const GUMS_OBJECT
*object
);
161 /* set object values function */
162 NTSTATUS (*set_object_values
) (DOM_SID
*sid
, uint32 count
, GUMS_DATA_SET
*data_set
);
164 /* Group related functions */
165 NTSTATUS (*add_memberss_to_group
) (const DOM_SID
*group
, const DOM_SID
**members
);
166 NTSTATUS (*delete_members_from_group
) (const DOM_SID
*group
, const DOM_SID
**members
);
167 NTSTATUS (*enumerate_group_members
) (DOM_SID
**members
, const DOM_SID
*sid
, const int type
);
169 NTSTATUS (*get_sid_groups
) (DOM_SID
**groups
, const DOM_SID
*sid
);
171 NTSTATUS (*lock_sid
) (const DOM_SID
*sid
);
172 NTSTATUS (*unlock_sid
) (const DOM_SID
*sid
);
174 /* privileges related functions */
176 NTSTATUS (*add_members_to_privilege
) (const LUID_ATTR
*priv
, const DOM_SID
**members
);
177 NTSTATUS (*delete_members_from_privilege
) (const LUID_ATTR
*priv
, const DOM_SID
**members
);
178 NTSTATUS (*enumerate_privilege_members
) (DOM_SID
**members
, const LUID_ATTR
*priv
);
179 NTSTATUS (*get_sid_privileges
) (DOM_SID
**privs
, const DOM_SID
*sid
);
180 /* warning!: set_privilege will overwrite a prior existing privilege if such exist */
181 NTSTATUS (*set_privilege
) (GUMS_PRIVILEGE
*priv
);
185 /* define value types */
187 #define GUMS_SET_PRIMARY_GROUP 1
188 #define GUMS_SET_SEC_DESC 2
190 /* user specific type values */
191 #define GUMS_SET_LOGON_TIME 10 /* keep NTTIME consecutive */
192 #define GUMS_SET_LOGOFF_TIME 11 /* too ease checking */
193 #define GUMS_SET_KICKOFF_TIME 13
194 #define GUMS_SET_PASS_LAST_SET_TIME 14
195 #define GUMS_SET_PASS_CAN_CHANGE_TIME 15
196 #define GUMS_SET_PASS_MUST_CHANGE_TIME 16 /* NTTIME end */
198 #define GUMS_SET_NAME 20 /* keep strings consecutive */
199 #define GUMS_SET_DESCRIPTION 21 /* too ease checking */
200 #define GUMS_SET_FULL_NAME 22
201 #define GUMS_SET_HOME_DIRECTORY 23
202 #define GUMS_SET_DRIVE 24
203 #define GUMS_SET_LOGON_SCRIPT 25
204 #define GUMS_SET_PROFILE_PATH 26
205 #define GUMS_SET_WORKSTATIONS 27
206 #define GUMS_SET_UNKNOWN_STRING 28
207 #define GUMS_SET_MUNGED_DIAL 29 /* strings end */
209 #define GUMS_SET_LM_PASSWORD 40
210 #define GUMS_SET_NT_PASSWORD 41
211 #define GUMS_SET_PLAINTEXT_PASSWORD 42
212 #define GUMS_SET_UNKNOWN_3 43
213 #define GUMS_SET_LOGON_DIVS 44
214 #define GUMS_SET_HOURS_LEN 45
215 #define GUMS_SET_HOURS 46
216 #define GUMS_SET_UNKNOWN_5 47
217 #define GUMS_SET_UNKNOWN_6 48
219 #define GUMS_SET_MUST_CHANGE_PASS 50
220 #define GUMS_SET_CANNOT_CHANGE_PASS 51
221 #define GUMS_SET_PASS_NEVER_EXPIRE 52
222 #define GUMS_SET_ACCOUNT_DISABLED 53
223 #define GUMS_SET_ACCOUNT_LOCKOUT 54
225 /*group specific type values */
226 #define GUMS_ADD_SID_LIST 60
227 #define GUMS_DEL_SID_LIST 61
228 #define GUMS_SET_SID_LIST 62