2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Guenther Deschner 2008.
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 3 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, see <http://www.gnu.org/licenses/>.
22 /*******************************************************************
24 ********************************************************************/
26 static void init_lsa_String(struct lsa_String *name, const char *s)
31 /*******************************************************************
33 ********************************************************************/
35 void init_samr_DomInfo1(struct samr_DomInfo1 *r,
36 uint16_t min_password_length,
37 uint16_t password_history_length,
38 uint32_t password_properties,
39 int64_t max_password_age,
40 int64_t min_password_age)
42 r->min_password_length = min_password_length;
43 r->password_history_length = password_history_length;
44 r->password_properties = password_properties;
45 r->max_password_age = max_password_age;
46 r->min_password_age = min_password_age;
49 /*******************************************************************
51 ********************************************************************/
53 void init_samr_DomInfo2(struct samr_DomInfo2 *r,
54 NTTIME force_logoff_time,
56 const char *domain_name,
58 uint64_t sequence_num,
66 r->force_logoff_time = force_logoff_time;
67 init_lsa_String(&r->comment, comment);
68 init_lsa_String(&r->domain_name, domain_name);
69 init_lsa_String(&r->primary, primary);
70 r->sequence_num = sequence_num;
71 r->unknown2 = unknown2;
73 r->unknown3 = unknown3;
74 r->num_users = num_users;
75 r->num_groups = num_groups;
76 r->num_aliases = num_aliases;
79 /*******************************************************************
81 ********************************************************************/
83 void init_samr_DomInfo3(struct samr_DomInfo3 *r,
84 NTTIME force_logoff_time)
86 r->force_logoff_time = force_logoff_time;
89 /*******************************************************************
91 ********************************************************************/
93 void init_samr_DomInfo4(struct samr_DomInfo4 *r,
96 init_lsa_String(&r->comment, comment);
99 /*******************************************************************
101 ********************************************************************/
103 void init_samr_DomInfo5(struct samr_DomInfo5 *r,
104 const char *domain_name)
106 init_lsa_String(&r->domain_name, domain_name);
109 /*******************************************************************
111 ********************************************************************/
113 void init_samr_DomInfo6(struct samr_DomInfo6 *r,
116 init_lsa_String(&r->primary, primary);
119 /*******************************************************************
121 ********************************************************************/
123 void init_samr_DomInfo7(struct samr_DomInfo7 *r,
129 /*******************************************************************
131 ********************************************************************/
133 void init_samr_DomInfo8(struct samr_DomInfo8 *r,
134 uint64_t sequence_num,
135 NTTIME domain_create_time)
137 r->sequence_num = sequence_num;
138 r->domain_create_time = domain_create_time;
141 /*******************************************************************
143 ********************************************************************/
145 void init_samr_DomInfo9(struct samr_DomInfo9 *r,
148 r->unknown = unknown;
151 /*******************************************************************
153 ********************************************************************/
155 void init_samr_DomInfo12(struct samr_DomInfo12 *r,
156 uint64_t lockout_duration,
157 uint64_t lockout_window,
158 uint16_t lockout_threshold)
160 r->lockout_duration = lockout_duration;
161 r->lockout_window = lockout_window;
162 r->lockout_threshold = lockout_threshold;
165 /*******************************************************************
166 inits a samr_GroupInfoAll structure.
167 ********************************************************************/
169 void init_samr_group_info1(struct samr_GroupInfoAll *r,
172 uint32_t num_members,
173 const char *description)
175 DEBUG(5, ("init_samr_group_info1\n"));
177 init_lsa_String(&r->name, name);
178 r->attributes = attributes;
179 r->num_members = num_members;
180 init_lsa_String(&r->description, description);
183 /*******************************************************************
184 inits a lsa_String structure
185 ********************************************************************/
187 void init_samr_group_info2(struct lsa_String *r, const char *group_name)
189 DEBUG(5, ("init_samr_group_info2\n"));
191 init_lsa_String(r, group_name);
194 /*******************************************************************
195 inits a samr_GroupInfoAttributes structure.
196 ********************************************************************/
198 void init_samr_group_info3(struct samr_GroupInfoAttributes *r,
201 DEBUG(5, ("init_samr_group_info3\n"));
203 r->attributes = attributes;
206 /*******************************************************************
207 inits a lsa_String structure
208 ********************************************************************/
210 void init_samr_group_info4(struct lsa_String *r, const char *description)
212 DEBUG(5, ("init_samr_group_info4\n"));
214 init_lsa_String(r, description);
217 /*******************************************************************
218 inits a samr_GroupInfoAll structure.
219 ********************************************************************/
221 void init_samr_group_info5(struct samr_GroupInfoAll *r,
224 uint32_t num_members,
225 const char *description)
227 DEBUG(5, ("init_samr_group_info5\n"));
229 init_lsa_String(&r->name, name);
230 r->attributes = attributes;
231 r->num_members = num_members;
232 init_lsa_String(&r->description, description);
235 /*******************************************************************
236 inits a samr_AliasInfoAll structure.
237 ********************************************************************/
239 void init_samr_alias_info1(struct samr_AliasInfoAll *r,
241 uint32_t num_members,
242 const char *description)
244 DEBUG(5, ("init_samr_alias_info1\n"));
246 init_lsa_String(&r->name, name);
247 r->num_members = num_members;
248 init_lsa_String(&r->description, description);
251 /*******************************************************************
252 inits a lsa_String structure.
253 ********************************************************************/
255 void init_samr_alias_info3(struct lsa_String *r,
256 const char *description)
258 DEBUG(5, ("init_samr_alias_info3\n"));
260 init_lsa_String(r, description);
263 /*******************************************************************
264 inits a samr_UserInfo7 structure.
265 ********************************************************************/
267 void init_samr_user_info7(struct samr_UserInfo7 *r,
268 const char *account_name)
270 DEBUG(5, ("init_samr_user_info7\n"));
272 init_lsa_String(&r->account_name, account_name);
275 /*******************************************************************
276 inits a samr_UserInfo9 structure.
277 ********************************************************************/
279 void init_samr_user_info9(struct samr_UserInfo9 *r,
280 uint32_t primary_gid)
282 DEBUG(5, ("init_samr_user_info9\n"));
284 r->primary_gid = primary_gid;
287 /*******************************************************************
288 inits a SAM_USER_INFO_16 structure.
289 ********************************************************************/
291 void init_samr_user_info16(struct samr_UserInfo16 *r,
294 DEBUG(5, ("init_samr_user_info16\n"));
296 r->acct_flags = acct_flags;
299 /*******************************************************************
300 inits a samr_UserInfo18 structure.
301 ********************************************************************/
303 void init_samr_user_info18(struct samr_UserInfo18 *r,
304 const uint8 lm_pwd[16],
305 const uint8 nt_pwd[16])
307 DEBUG(5, ("init_samr_user_info18\n"));
310 memcpy(r->lm_pwd.hash, lm_pwd, sizeof(r->lm_pwd.hash)) ? true : false;
312 memcpy(r->nt_pwd.hash, nt_pwd, sizeof(r->nt_pwd.hash)) ? true : false;
315 /*******************************************************************
316 inits a samr_UserInfo20 structure.
317 ********************************************************************/
319 void init_samr_user_info20(struct samr_UserInfo20 *r,
320 const char *munged_dial)
322 init_lsa_String(&r->parameters, munged_dial);
325 /*************************************************************************
326 inits a samr_UserInfo21 structure
327 *************************************************************************/
329 void init_samr_user_info21(struct samr_UserInfo21 *r,
332 NTTIME last_password_change,
334 NTTIME allow_password_change,
335 NTTIME force_password_change,
336 const char *account_name,
337 const char *full_name,
338 const char *home_directory,
339 const char *home_drive,
340 const char *logon_script,
341 const char *profile_path,
342 const char *description,
343 const char *workstations,
345 const char *parameters,
347 uint32_t primary_gid,
349 uint32_t fields_present,
350 struct samr_LogonHours logon_hours,
351 uint16_t bad_password_count,
352 uint16_t logon_count,
353 uint16_t country_code,
355 uint8_t nt_password_set,
356 uint8_t lm_password_set,
357 uint8_t password_expired)
359 r->last_logon = last_logon;
360 r->last_logoff = last_logoff;
361 r->last_password_change = last_password_change;
362 r->acct_expiry = acct_expiry;
363 r->allow_password_change = allow_password_change;
364 r->force_password_change = force_password_change;
365 init_lsa_String(&r->account_name, account_name);
366 init_lsa_String(&r->full_name, full_name);
367 init_lsa_String(&r->home_directory, home_directory);
368 init_lsa_String(&r->home_drive, home_drive);
369 init_lsa_String(&r->logon_script, logon_script);
370 init_lsa_String(&r->profile_path, profile_path);
371 init_lsa_String(&r->description, description);
372 init_lsa_String(&r->workstations, workstations);
373 init_lsa_String(&r->comment, comment);
374 init_lsa_String(&r->parameters, parameters);
376 r->primary_gid = primary_gid;
377 r->acct_flags = acct_flags;
378 r->fields_present = fields_present;
379 r->logon_hours = logon_hours;
380 r->bad_password_count = bad_password_count;
381 r->logon_count = logon_count;
382 r->country_code = country_code;
383 r->code_page = code_page;
384 r->nt_password_set = nt_password_set;
385 r->lm_password_set = lm_password_set;
386 r->password_expired = password_expired;