Merge fields_present function from HEAD. Now, a field will not be updated
[Samba/gebeck_regimport.git] / source / rpc_server / srv_samr_util.c
blobc30cc3e77b1af480b55eb480e503f10018298150
1 /*
2 Unix SMB/CIFS implementation.
3 SAMR Pipe utility functions.
5 Copyright (C) Luke Kenneth Casson Leighton 1996-1998
6 Copyright (C) Gerald (Jerry) Carter 2000-2001
7 Copyright (C) Andrew Bartlett 2001-2002
8 Copyright (C) Stefan (metze) Metzmacher 2002
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include "includes.h"
27 #undef DBGC_CLASS
28 #define DBGC_CLASS DBGC_RPC_SRV
30 #define STRING_CHANGED (old_string && !new_string) ||\
31 (!old_string && new_string) ||\
32 (old_string && new_string && (strcmp(old_string, new_string) != 0))
34 #define STRING_CHANGED_NC(s1,s2) ((s1) && !(s2)) ||\
35 (!(s1) && (s2)) ||\
36 ((s1) && (s2) && (strcmp((s1), (s2)) != 0))
38 /*************************************************************
39 Copies a SAM_USER_INFO_20 to a SAM_ACCOUNT
40 **************************************************************/
42 void copy_id20_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_20 *from)
44 const char *old_string;
45 char *new_string;
46 DATA_BLOB mung;
48 if (from == NULL || to == NULL)
49 return;
51 if (from->hdr_munged_dial.buffer) {
52 old_string = pdb_get_munged_dial(to);
53 mung.length = from->hdr_munged_dial.uni_str_len;
54 mung.data = (uint8 *) from->uni_munged_dial.buffer;
55 new_string = base64_encode_data_blob(mung);
56 DEBUG(10,("INFO_20 UNI_MUNGED_DIAL: %s -> %s\n",old_string, new_string));
57 if (STRING_CHANGED_NC(old_string,new_string))
58 pdb_set_munged_dial(to , new_string, PDB_CHANGED);
60 SAFE_FREE(new_string);
64 /*************************************************************
65 Copies a SAM_USER_INFO_21 to a SAM_ACCOUNT
66 **************************************************************/
68 void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
70 time_t unix_time, stored_time;
71 const char *old_string, *new_string;
72 DATA_BLOB mung;
74 if (from == NULL || to == NULL)
75 return;
77 if (from->fields_present & ACCT_LAST_LOGON) {
78 unix_time=nt_time_to_unix(&from->logon_time);
79 stored_time = pdb_get_logon_time(to);
80 DEBUG(10,("INFO_21 LOGON_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
81 if (stored_time != unix_time)
82 pdb_set_logon_time(to, unix_time, PDB_CHANGED);
85 if (from->fields_present & ACCT_LAST_LOGOFF) {
86 unix_time=nt_time_to_unix(&from->logoff_time);
87 stored_time = pdb_get_logoff_time(to);
88 DEBUG(10,("INFO_21 LOGOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
89 if (stored_time != unix_time)
90 pdb_set_logoff_time(to, unix_time, PDB_CHANGED);
93 if (from->fields_present & ACCT_EXPIRY) {
94 unix_time=nt_time_to_unix(&from->kickoff_time);
95 stored_time = pdb_get_kickoff_time(to);
96 DEBUG(10,("INFO_21 KICKOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
97 if (stored_time != unix_time)
98 pdb_set_kickoff_time(to, unix_time , PDB_CHANGED);
101 if (from->fields_present & ACCT_ALLOW_PWD_CHANGE) {
102 unix_time=nt_time_to_unix(&from->pass_can_change_time);
103 stored_time = pdb_get_pass_can_change_time(to);
104 DEBUG(10,("INFO_21 PASS_CAN_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
105 if (stored_time != unix_time)
106 pdb_set_pass_can_change_time(to, unix_time, PDB_CHANGED);
109 if (from->fields_present & ACCT_LAST_PWD_CHANGE) {
110 unix_time=nt_time_to_unix(&from->pass_last_set_time);
111 stored_time = pdb_get_pass_last_set_time(to);
112 DEBUG(10,("INFO_21 PASS_LAST_SET: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
113 if (stored_time != unix_time)
114 pdb_set_pass_last_set_time(to, unix_time, PDB_CHANGED);
117 if (from->fields_present & ACCT_FORCE_PWD_CHANGE) {
118 unix_time=nt_time_to_unix(&from->pass_must_change_time);
119 stored_time=pdb_get_pass_must_change_time(to);
120 DEBUG(10,("INFO_21 PASS_MUST_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
121 if (stored_time != unix_time)
122 pdb_set_pass_must_change_time(to, unix_time, PDB_CHANGED);
125 if ((from->fields_present & ACCT_USERNAME) &&
126 (from->hdr_user_name.buffer)) {
127 old_string = pdb_get_username(to);
128 new_string = unistr2_static(&from->uni_user_name);
129 DEBUG(10,("INFO_21 UNI_USER_NAME: %s -> %s\n", old_string, new_string));
130 if (STRING_CHANGED)
131 pdb_set_username(to , new_string, PDB_CHANGED);
134 if ((from->fields_present & ACCT_FULL_NAME) &&
135 (from->hdr_full_name.buffer)) {
136 old_string = pdb_get_fullname(to);
137 new_string = unistr2_static(&from->uni_full_name);
138 DEBUG(10,("INFO_21 UNI_FULL_NAME: %s -> %s\n",old_string, new_string));
139 if (STRING_CHANGED)
140 pdb_set_fullname(to , new_string, PDB_CHANGED);
143 if ((from->fields_present & ACCT_HOME_DIR) &&
144 (from->hdr_home_dir.buffer)) {
145 old_string = pdb_get_homedir(to);
146 new_string = unistr2_static(&from->uni_home_dir);
147 DEBUG(10,("INFO_21 UNI_HOME_DIR: %s -> %s\n",old_string,new_string));
148 if (STRING_CHANGED)
149 pdb_set_homedir(to , new_string, PDB_CHANGED);
152 if ((from->fields_present & ACCT_HOME_DRIVE) &&
153 (from->hdr_dir_drive.buffer)) {
154 old_string = pdb_get_dir_drive(to);
155 new_string = unistr2_static(&from->uni_dir_drive);
156 DEBUG(10,("INFO_21 UNI_DIR_DRIVE: %s -> %s\n",old_string,new_string));
157 if (STRING_CHANGED)
158 pdb_set_dir_drive(to , new_string, PDB_CHANGED);
161 if ((from->fields_present & ACCT_LOGON_SCRIPT) &&
162 (from->hdr_logon_script.buffer)) {
163 old_string = pdb_get_logon_script(to);
164 new_string = unistr2_static(&from->uni_logon_script);
165 DEBUG(10,("INFO_21 UNI_LOGON_SCRIPT: %s -> %s\n",old_string,new_string));
166 if (STRING_CHANGED)
167 pdb_set_logon_script(to , new_string, PDB_CHANGED);
170 if ((from->fields_present & ACCT_PROFILE) &&
171 (from->hdr_profile_path.buffer)) {
172 old_string = pdb_get_profile_path(to);
173 new_string = unistr2_static(&from->uni_profile_path);
174 DEBUG(10,("INFO_21 UNI_PROFILE_PATH: %s -> %s\n",old_string, new_string));
175 if (STRING_CHANGED)
176 pdb_set_profile_path(to , new_string, PDB_CHANGED);
179 if ((from->fields_present & ACCT_DESCRIPTION) &&
180 (from->hdr_acct_desc.buffer)) {
181 old_string = pdb_get_acct_desc(to);
182 new_string = unistr2_static(&from->uni_acct_desc);
183 DEBUG(10,("INFO_21 UNI_ACCT_DESC: %s -> %s\n",old_string,new_string));
184 if (STRING_CHANGED)
185 pdb_set_acct_desc(to , new_string, PDB_CHANGED);
188 if ((from->fields_present & ACCT_WORKSTATIONS) &&
189 (from->hdr_workstations.buffer)) {
190 old_string = pdb_get_workstations(to);
191 new_string = unistr2_static(&from->uni_workstations);
192 DEBUG(10,("INFO_21 UNI_WORKSTATIONS: %s -> %s\n",old_string, new_string));
193 if (STRING_CHANGED)
194 pdb_set_workstations(to , new_string, PDB_CHANGED);
197 /* is this right? */
198 if ((from->fields_present & ACCT_ADMIN_DESC) &&
199 (from->hdr_unknown_str.buffer)) {
200 old_string = pdb_get_unknown_str(to);
201 new_string = unistr2_static(&from->uni_unknown_str);
202 DEBUG(10,("INFO_21 UNI_UNKNOWN_STR: %s -> %s\n",old_string, new_string));
203 if (STRING_CHANGED)
204 pdb_set_unknown_str(to , new_string, PDB_CHANGED);
207 if ((from->fields_present & ACCT_CALLBACK) &&
208 (from->hdr_munged_dial.buffer)) {
209 char *newstr;
210 old_string = pdb_get_munged_dial(to);
211 mung.length = from->hdr_munged_dial.uni_str_len;
212 mung.data = (uint8 *) from->uni_munged_dial.buffer;
213 newstr = base64_encode_data_blob(mung);
214 DEBUG(10,("INFO_21 UNI_MUNGED_DIAL: %s -> %s\n",old_string, newstr));
215 if (STRING_CHANGED_NC(old_string,newstr))
216 pdb_set_munged_dial(to , newstr, PDB_CHANGED);
218 SAFE_FREE(newstr);
221 if (from->fields_present & ACCT_RID) {
222 if (from->user_rid == 0) {
223 DEBUG(10, ("INFO_21: Asked to set User RID to 0 !? Skipping change!\n"));
224 } else if (from->user_rid != pdb_get_user_rid(to)) {
225 DEBUG(10,("INFO_21 USER_RID: %u -> %u NOT UPDATED!\n",pdb_get_user_rid(to),from->user_rid));
229 if (from->fields_present & ACCT_PRIMARY_GID) {
230 if (from->group_rid == 0) {
231 DEBUG(10, ("INFO_21: Asked to set Group RID to 0 !? Skipping change!\n"));
232 } else if (from->group_rid != pdb_get_group_rid(to)) {
233 DEBUG(10,("INFO_21 GROUP_RID: %u -> %u\n",pdb_get_group_rid(to),from->group_rid));
234 pdb_set_group_sid_from_rid(to, from->group_rid, PDB_CHANGED);
238 if (from->fields_present & ACCT_FLAGS) {
239 DEBUG(10,("INFO_21 ACCT_CTRL: %08X -> %08X\n",pdb_get_acct_ctrl(to),from->acb_info));
240 if (from->acb_info != pdb_get_acct_ctrl(to)) {
241 pdb_set_acct_ctrl(to, from->acb_info, PDB_CHANGED);
245 if (from->fields_present & ACCT_LOGON_HOURS) {
246 DEBUG(15,("INFO_21 LOGON_DIVS: %08X -> %08X\n",pdb_get_logon_divs(to),from->logon_divs));
247 if (from->logon_divs != pdb_get_logon_divs(to)) {
248 pdb_set_logon_divs(to, from->logon_divs, PDB_CHANGED);
251 DEBUG(15,("INFO_21 LOGON_HRS.LEN: %08X -> %08X\n",pdb_get_hours_len(to),from->logon_hrs.len));
252 if (from->logon_hrs.len != pdb_get_hours_len(to)) {
253 pdb_set_hours_len(to, from->logon_hrs.len, PDB_CHANGED);
256 DEBUG(15,("INFO_21 LOGON_HRS.HOURS: %s -> %s\n",pdb_get_hours(to),from->logon_hrs.hours));
257 /* Fix me: only update if it changes --metze */
258 pdb_set_hours(to, from->logon_hrs.hours, PDB_CHANGED);
261 if (from->fields_present & ACCT_BAD_PWD_COUNT) {
262 DEBUG(10,("INFO_21 BAD_PASSWORD_COUNT: %08X -> %08X\n",pdb_get_bad_password_count(to),from->bad_password_count));
263 if (from->bad_password_count != pdb_get_bad_password_count(to)) {
264 pdb_set_bad_password_count(to, from->bad_password_count, PDB_CHANGED);
268 if (from->fields_present & ACCT_NUM_LOGONS) {
269 DEBUG(10,("INFO_21 LOGON_COUNT: %08X -> %08X\n",pdb_get_logon_count(to),from->logon_count));
270 if (from->logon_count != pdb_get_logon_count(to)) {
271 pdb_set_logon_count(to, from->logon_count, PDB_CHANGED);
275 /* if (from->fields_present & ACCT_??) { */
276 DEBUG(10,("INFO_21 UNKNOWN_6: %08X -> %08X\n",pdb_get_unknown_6(to),from->unknown_6));
277 if (from->unknown_6 != pdb_get_unknown_6(to)) {
278 pdb_set_unknown_6(to, from->unknown_6, PDB_CHANGED);
280 /* } */
282 DEBUG(10,("INFO_21 PADDING1 %02X %02X %02X %02X %02X %02X\n",
283 from->padding1[0],
284 from->padding1[1],
285 from->padding1[2],
286 from->padding1[3],
287 from->padding1[4],
288 from->padding1[5]));
290 DEBUG(10,("INFO_21 PASS_MUST_CHANGE_AT_NEXT_LOGON: %02X\n",from->passmustchange));
291 if (from->passmustchange==PASS_MUST_CHANGE_AT_NEXT_LOGON) {
292 pdb_set_pass_must_change_time(to,0, PDB_CHANGED);
295 DEBUG(10,("INFO_21 PADDING_2: %02X\n",from->padding2));
297 DEBUG(10,("INFO_21 PADDING_4: %08X\n",from->padding4));
301 /*************************************************************
302 Copies a SAM_USER_INFO_23 to a SAM_ACCOUNT
303 **************************************************************/
305 void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
307 time_t unix_time, stored_time;
308 const char *old_string, *new_string;
309 DATA_BLOB mung;
311 if (from == NULL || to == NULL)
312 return;
314 if (from->fields_present & ACCT_LAST_LOGON) {
315 unix_time=nt_time_to_unix(&from->logon_time);
316 stored_time = pdb_get_logon_time(to);
317 DEBUG(10,("INFO_23 LOGON_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
318 if (stored_time != unix_time)
319 pdb_set_logon_time(to, unix_time, PDB_CHANGED);
322 if (from->fields_present & ACCT_LAST_LOGOFF) {
323 unix_time=nt_time_to_unix(&from->logoff_time);
324 stored_time = pdb_get_logoff_time(to);
325 DEBUG(10,("INFO_23 LOGOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
326 if (stored_time != unix_time)
327 pdb_set_logoff_time(to, unix_time, PDB_CHANGED);
330 if (from->fields_present & ACCT_EXPIRY) {
331 unix_time=nt_time_to_unix(&from->kickoff_time);
332 stored_time = pdb_get_kickoff_time(to);
333 DEBUG(10,("INFO_23 KICKOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
334 if (stored_time != unix_time)
335 pdb_set_kickoff_time(to, unix_time , PDB_CHANGED);
338 if (from->fields_present & ACCT_ALLOW_PWD_CHANGE) {
339 unix_time=nt_time_to_unix(&from->pass_can_change_time);
340 stored_time = pdb_get_pass_can_change_time(to);
341 DEBUG(10,("INFO_23 PASS_CAN_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
342 if (stored_time != unix_time)
343 pdb_set_pass_can_change_time(to, unix_time, PDB_CHANGED);
346 if (from->fields_present & ACCT_LAST_PWD_CHANGE) {
347 unix_time=nt_time_to_unix(&from->pass_last_set_time);
348 stored_time = pdb_get_pass_last_set_time(to);
349 DEBUG(10,("INFO_23 PASS_LAST_SET: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
350 if (stored_time != unix_time)
351 pdb_set_pass_last_set_time(to, unix_time, PDB_CHANGED);
354 if (from->fields_present & ACCT_FORCE_PWD_CHANGE) {
355 unix_time=nt_time_to_unix(&from->pass_must_change_time);
356 stored_time=pdb_get_pass_must_change_time(to);
357 DEBUG(10,("INFO_23 PASS_MUST_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
358 if (stored_time != unix_time)
359 pdb_set_pass_must_change_time(to, unix_time, PDB_CHANGED);
362 /* Backend should check this for sanity */
363 if ((from->fields_present & ACCT_USERNAME) &&
364 (from->hdr_user_name.buffer)) {
365 old_string = pdb_get_username(to);
366 new_string = unistr2_static(&from->uni_user_name);
367 DEBUG(10,("INFO_23 UNI_USER_NAME: %s -> %s\n", old_string, new_string));
368 if (STRING_CHANGED)
369 pdb_set_username(to , new_string, PDB_CHANGED);
372 if ((from->fields_present & ACCT_FULL_NAME) &&
373 (from->hdr_full_name.buffer)) {
374 old_string = pdb_get_fullname(to);
375 new_string = unistr2_static(&from->uni_full_name);
376 DEBUG(10,("INFO_23 UNI_FULL_NAME: %s -> %s\n",old_string, new_string));
377 if (STRING_CHANGED)
378 pdb_set_fullname(to , new_string, PDB_CHANGED);
381 if ((from->fields_present & ACCT_HOME_DIR) &&
382 (from->hdr_home_dir.buffer)) {
383 old_string = pdb_get_homedir(to);
384 new_string = unistr2_static(&from->uni_home_dir);
385 DEBUG(10,("INFO_23 UNI_HOME_DIR: %s -> %s\n",old_string,new_string));
386 if (STRING_CHANGED)
387 pdb_set_homedir(to , new_string, PDB_CHANGED);
390 if ((from->fields_present & ACCT_HOME_DRIVE) &&
391 (from->hdr_dir_drive.buffer)) {
392 old_string = pdb_get_dir_drive(to);
393 new_string = unistr2_static(&from->uni_dir_drive);
394 DEBUG(10,("INFO_23 UNI_DIR_DRIVE: %s -> %s\n",old_string,new_string));
395 if (STRING_CHANGED)
396 pdb_set_dir_drive(to , new_string, PDB_CHANGED);
399 if ((from->fields_present & ACCT_LOGON_SCRIPT) &&
400 (from->hdr_logon_script.buffer)) {
401 old_string = pdb_get_logon_script(to);
402 new_string = unistr2_static(&from->uni_logon_script);
403 DEBUG(10,("INFO_23 UNI_LOGON_SCRIPT: %s -> %s\n",old_string,new_string));
404 if (STRING_CHANGED)
405 pdb_set_logon_script(to , new_string, PDB_CHANGED);
408 if ((from->fields_present & ACCT_PROFILE) &&
409 (from->hdr_profile_path.buffer)) {
410 old_string = pdb_get_profile_path(to);
411 new_string = unistr2_static(&from->uni_profile_path);
412 DEBUG(10,("INFO_23 UNI_PROFILE_PATH: %s -> %s\n",old_string, new_string));
413 if (STRING_CHANGED)
414 pdb_set_profile_path(to , new_string, PDB_CHANGED);
417 if ((from->fields_present & ACCT_DESCRIPTION) &&
418 (from->hdr_acct_desc.buffer)) {
419 old_string = pdb_get_acct_desc(to);
420 new_string = unistr2_static(&from->uni_acct_desc);
421 DEBUG(10,("INFO_23 UNI_ACCT_DESC: %s -> %s\n",old_string,new_string));
422 if (STRING_CHANGED)
423 pdb_set_acct_desc(to , new_string, PDB_CHANGED);
426 if ((from->fields_present & ACCT_WORKSTATIONS) &&
427 (from->hdr_workstations.buffer)) {
428 old_string = pdb_get_workstations(to);
429 new_string = unistr2_static(&from->uni_workstations);
430 DEBUG(10,("INFO_23 UNI_WORKSTATIONS: %s -> %s\n",old_string, new_string));
431 if (STRING_CHANGED)
432 pdb_set_workstations(to , new_string, PDB_CHANGED);
435 /* is this right? */
436 if ((from->fields_present & ACCT_ADMIN_DESC) &&
437 (from->hdr_unknown_str.buffer)) {
438 old_string = pdb_get_unknown_str(to);
439 new_string = unistr2_static(&from->uni_unknown_str);
440 DEBUG(10,("INFO_23 UNI_UNKNOWN_STR: %s -> %s\n",old_string, new_string));
441 if (STRING_CHANGED)
442 pdb_set_unknown_str(to , new_string, PDB_CHANGED);
445 if ((from->fields_present & ACCT_CALLBACK) &&
446 (from->hdr_munged_dial.buffer)) {
447 char *newstr;
448 old_string = pdb_get_munged_dial(to);
449 mung.length = from->hdr_munged_dial.uni_str_len;
450 mung.data = (uint8 *) from->uni_munged_dial.buffer;
451 newstr = base64_encode_data_blob(mung);
452 DEBUG(10,("INFO_23 UNI_MUNGED_DIAL: %s -> %s\n",old_string, newstr));
453 if (STRING_CHANGED_NC(old_string, newstr))
454 pdb_set_munged_dial(to , newstr, PDB_CHANGED);
456 SAFE_FREE(newstr);
459 if (from->fields_present & ACCT_RID) {
460 if (from->user_rid == 0) {
461 DEBUG(10, ("INFO_23: Asked to set User RID to 0 !? Skipping change!\n"));
462 } else if (from->user_rid != pdb_get_user_rid(to)) {
463 DEBUG(10,("INFO_23 USER_RID: %u -> %u NOT UPDATED!\n",pdb_get_user_rid(to),from->user_rid));
467 if (from->fields_present & ACCT_PRIMARY_GID) {
468 if (from->group_rid == 0) {
469 DEBUG(10, ("INFO_23: Asked to set Group RID to 0 !? Skipping change!\n"));
470 } else if (from->group_rid != pdb_get_group_rid(to)) {
471 DEBUG(10,("INFO_23 GROUP_RID: %u -> %u\n",pdb_get_group_rid(to),from->group_rid));
472 pdb_set_group_sid_from_rid(to, from->group_rid, PDB_CHANGED);
476 if (from->fields_present & ACCT_FLAGS) {
477 DEBUG(10,("INFO_23 ACCT_CTRL: %08X -> %08X\n",pdb_get_acct_ctrl(to),from->acb_info));
478 if (from->acb_info != pdb_get_acct_ctrl(to)) {
479 pdb_set_acct_ctrl(to, from->acb_info, PDB_CHANGED);
483 if (from->fields_present & ACCT_LOGON_HOURS) {
484 DEBUG(15,("INFO_23 LOGON_DIVS: %08X -> %08X\n",pdb_get_logon_divs(to),from->logon_divs));
485 if (from->logon_divs != pdb_get_logon_divs(to)) {
486 pdb_set_logon_divs(to, from->logon_divs, PDB_CHANGED);
489 DEBUG(15,("INFO_23 LOGON_HRS.LEN: %08X -> %08X\n",pdb_get_hours_len(to),from->logon_hrs.len));
490 if (from->logon_hrs.len != pdb_get_hours_len(to)) {
491 pdb_set_hours_len(to, from->logon_hrs.len, PDB_CHANGED);
494 DEBUG(15,("INFO_23 LOGON_HRS.HOURS: %s -> %s\n",pdb_get_hours(to),from->logon_hrs.hours));
495 /* Fix me: only update if it changes --metze */
496 pdb_set_hours(to, from->logon_hrs.hours, PDB_CHANGED);
499 if (from->fields_present & ACCT_BAD_PWD_COUNT) {
500 DEBUG(10,("INFO_23 BAD_PASSWORD_COUNT: %08X -> %08X\n",pdb_get_bad_password_count(to),from->bad_password_count));
501 if (from->bad_password_count != pdb_get_bad_password_count(to)) {
502 pdb_set_bad_password_count(to, from->bad_password_count, PDB_CHANGED);
506 if (from->fields_present & ACCT_NUM_LOGONS) {
507 DEBUG(10,("INFO_23 LOGON_COUNT: %08X -> %08X\n",pdb_get_logon_count(to),from->logon_count));
508 if (from->logon_count != pdb_get_logon_count(to)) {
509 pdb_set_logon_count(to, from->logon_count, PDB_CHANGED);
513 /* if (from->fields_present & ACCT_??) { */
514 DEBUG(10,("INFO_23 UNKOWN_6: %08X -> %08X\n",pdb_get_unknown_6(to),from->unknown_6));
515 if (from->unknown_6 != pdb_get_unknown_6(to)) {
516 pdb_set_unknown_6(to, from->unknown_6, PDB_CHANGED);
518 /* } */
520 DEBUG(10,("INFO_23 PADDING1 %02X %02X %02X %02X %02X %02X\n",
521 from->padding1[0],
522 from->padding1[1],
523 from->padding1[2],
524 from->padding1[3],
525 from->padding1[4],
526 from->padding1[5]));
528 DEBUG(10,("INFO_23 PASS_MUST_CHANGE_AT_NEXT_LOGON: %02X\n",from->passmustchange));
529 if (from->passmustchange==PASS_MUST_CHANGE_AT_NEXT_LOGON) {
530 pdb_set_pass_must_change_time(to,0, PDB_CHANGED);
533 DEBUG(10,("INFO_23 PADDING_2: %02X\n",from->padding2));
535 DEBUG(10,("INFO_23 PADDING_4: %08X\n",from->padding4));