More sync between passdb on 3.0 and HEAD.
[bbaumbach/samba-autobuild/.git] / source / rpc_server / srv_samr_util.c
1 /* 
2    Unix SMB/CIFS implementation.
3    SAMR Pipe utility functions.
4    
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
9       
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.
14    
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.
19    
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.
23 */
24
25 #include "includes.h"
26
27 #undef DBGC_CLASS
28 #define DBGC_CLASS DBGC_RPC_SRV
29
30 #define STRING_CHANGED (old_string && !new_string) ||\
31                     (!old_string && new_string) ||\
32                 (old_string && new_string && (strcmp(old_string, new_string) != 0))
33
34 #define STRING_CHANGED_NC(s1,s2) ((s1) && !(s2)) ||\
35                     (!(s1) && (s2)) ||\
36                 ((s1) && (s2) && (strcmp((s1), (s2)) != 0))
37
38 /*************************************************************
39  Copies a SAM_USER_INFO_20 to a SAM_ACCOUNT
40 **************************************************************/
41
42 void copy_id20_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_20 *from)
43 {
44         const char *old_string;
45         char *new_string;
46         DATA_BLOB mung;
47
48         if (from == NULL || to == NULL) 
49                 return;
50         
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);
59
60                 SAFE_FREE(new_string);
61         }
62 }
63
64 /*************************************************************
65  Copies a SAM_USER_INFO_21 to a SAM_ACCOUNT
66 **************************************************************/
67
68 void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
69 {
70         time_t unix_time, stored_time;
71         const char *old_string, *new_string;
72         DATA_BLOB mung;
73
74         if (from == NULL || to == NULL) 
75                 return;
76         if (!nt_time_is_zero(&from->logon_time)) {
77                 unix_time=nt_time_to_unix(&from->logon_time);
78                 stored_time = pdb_get_logon_time(to);
79                 DEBUG(10,("INFO_21 LOGON_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
80                 if (stored_time != unix_time) 
81                         pdb_set_logon_time(to, unix_time, PDB_CHANGED);
82         }       
83         if (!nt_time_is_zero(&from->logoff_time)) {
84                 unix_time=nt_time_to_unix(&from->logoff_time);
85                 stored_time = pdb_get_logoff_time(to);
86                 DEBUG(10,("INFO_21 LOGOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
87                 if (stored_time != unix_time) 
88                         pdb_set_logoff_time(to, unix_time, PDB_CHANGED);
89         }
90         
91         if (!nt_time_is_zero(&from->kickoff_time)) {
92                 unix_time=nt_time_to_unix(&from->kickoff_time);
93                 stored_time = pdb_get_kickoff_time(to);
94                 DEBUG(10,("INFO_21 KICKOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
95                 if (stored_time != unix_time) 
96                         pdb_set_kickoff_time(to, unix_time , PDB_CHANGED);
97         }       
98
99         if (!nt_time_is_zero(&from->pass_can_change_time)) {
100                 unix_time=nt_time_to_unix(&from->pass_can_change_time);
101                 stored_time = pdb_get_pass_can_change_time(to);
102                 DEBUG(10,("INFO_21 PASS_CAN_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
103                 if (stored_time != unix_time) 
104                         pdb_set_pass_can_change_time(to, unix_time, PDB_CHANGED);
105         }
106         if (!nt_time_is_zero(&from->pass_last_set_time)) {
107                 unix_time=nt_time_to_unix(&from->pass_last_set_time);
108                 stored_time = pdb_get_pass_last_set_time(to);
109                 DEBUG(10,("INFO_21 PASS_LAST_SET: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
110                 if (stored_time != unix_time) 
111                         pdb_set_pass_last_set_time(to, unix_time, PDB_CHANGED);
112         }
113
114         if (!nt_time_is_zero(&from->pass_must_change_time)) {
115                 unix_time=nt_time_to_unix(&from->pass_must_change_time);
116                 stored_time=pdb_get_pass_must_change_time(to);
117                 DEBUG(10,("INFO_21 PASS_MUST_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
118                 if (stored_time != unix_time) 
119                         pdb_set_pass_must_change_time(to, unix_time, PDB_CHANGED);
120         }
121
122         /* Backend should check this for sainity */
123         if (from->hdr_user_name.buffer) {
124                 old_string = pdb_get_username(to);
125                 new_string = unistr2_static(&from->uni_user_name);
126                 DEBUG(10,("INFO_21 UNI_USER_NAME: %s -> %s\n", old_string, new_string));
127                 if (STRING_CHANGED)
128                     pdb_set_username(to      , new_string, PDB_CHANGED);
129         }
130
131         if (from->hdr_full_name.buffer) {
132                 old_string = pdb_get_fullname(to);
133                 new_string = unistr2_static(&from->uni_full_name);
134                 DEBUG(10,("INFO_21 UNI_FULL_NAME: %s -> %s\n",old_string, new_string));
135                 if (STRING_CHANGED)
136                         pdb_set_fullname(to      , new_string, PDB_CHANGED);
137         }
138         
139         if (from->hdr_home_dir.buffer) {
140                 old_string = pdb_get_homedir(to);
141                 new_string = unistr2_static(&from->uni_home_dir);
142                 DEBUG(10,("INFO_21 UNI_HOME_DIR: %s -> %s\n",old_string,new_string));
143                 if (STRING_CHANGED)
144                         pdb_set_homedir(to       , new_string, PDB_CHANGED);
145         }
146
147         if (from->hdr_dir_drive.buffer) {
148                 old_string = pdb_get_dir_drive(to);
149                 new_string = unistr2_static(&from->uni_dir_drive);
150                 DEBUG(10,("INFO_21 UNI_DIR_DRIVE: %s -> %s\n",old_string,new_string));
151                 if (STRING_CHANGED)
152                         pdb_set_dir_drive(to     , new_string, PDB_CHANGED);
153         }
154
155         if (from->hdr_logon_script.buffer) {
156                 old_string = pdb_get_logon_script(to);
157                 new_string = unistr2_static(&from->uni_logon_script);
158                 DEBUG(10,("INFO_21 UNI_LOGON_SCRIPT: %s -> %s\n",old_string,new_string));
159                 if (STRING_CHANGED)
160                         pdb_set_logon_script(to  , new_string, PDB_CHANGED);
161         }
162
163         if (from->hdr_profile_path.buffer) {
164                 old_string = pdb_get_profile_path(to);
165                 new_string = unistr2_static(&from->uni_profile_path);
166                 DEBUG(10,("INFO_21 UNI_PROFILE_PATH: %s -> %s\n",old_string, new_string));
167                 if (STRING_CHANGED)
168                         pdb_set_profile_path(to  , new_string, PDB_CHANGED);
169         }
170         
171         if (from->hdr_acct_desc.buffer) {
172                 old_string = pdb_get_acct_desc(to);
173                 new_string = unistr2_static(&from->uni_acct_desc);
174                 DEBUG(10,("INFO_21 UNI_ACCT_DESC: %s -> %s\n",old_string,new_string));
175                 if (STRING_CHANGED)
176                         pdb_set_acct_desc(to     , new_string, PDB_CHANGED);
177         }
178         
179         if (from->hdr_workstations.buffer) {
180                 old_string = pdb_get_workstations(to);
181                 new_string = unistr2_static(&from->uni_workstations);
182                 DEBUG(10,("INFO_21 UNI_WORKSTATIONS: %s -> %s\n",old_string, new_string));
183                 if (STRING_CHANGED)
184                         pdb_set_workstations(to  , new_string, PDB_CHANGED);
185         }
186
187         if (from->hdr_unknown_str.buffer) {
188                 old_string = pdb_get_unknown_str(to);
189                 new_string = unistr2_static(&from->uni_unknown_str);
190                 DEBUG(10,("INFO_21 UNI_UNKNOWN_STR: %s -> %s\n",old_string, new_string));
191                 if (STRING_CHANGED)
192                         pdb_set_unknown_str(to   , new_string, PDB_CHANGED);
193         }
194         
195         if (from->hdr_munged_dial.buffer) {
196                 char *newstr;
197                 old_string = pdb_get_munged_dial(to);
198                 mung.length = from->hdr_munged_dial.uni_str_len;
199                 mung.data = (uint8 *) from->uni_munged_dial.buffer;
200                 newstr = base64_encode_data_blob(mung);
201                 DEBUG(10,("INFO_21 UNI_MUNGED_DIAL: %s -> %s\n",old_string, newstr));
202                 if (STRING_CHANGED_NC(old_string,newstr))
203                         pdb_set_munged_dial(to   , newstr, PDB_CHANGED);
204
205                 SAFE_FREE(newstr);
206         }
207         
208         if (from->user_rid == 0) {
209                 DEBUG(10, ("INFO_21: Asked to set User RID to 0 !? Skipping change!\n"));
210         } else if (from->user_rid != pdb_get_user_rid(to)) {
211                 DEBUG(10,("INFO_21 USER_RID: %u -> %u NOT UPDATED!\n",pdb_get_user_rid(to),from->user_rid));
212                 /* we really allow this ??? metze */
213                 /* pdb_set_user_sid_from_rid(to, from->user_rid, PDB_CHANGED);*/
214         }
215         
216         if (from->group_rid == 0) {
217                 DEBUG(10, ("INFO_21: Asked to set Group RID to 0 !? Skipping change!\n"));
218         } else if (from->group_rid != pdb_get_group_rid(to)) {
219                 DEBUG(10,("INFO_21 GROUP_RID: %u -> %u\n",pdb_get_group_rid(to),from->group_rid));
220                 pdb_set_group_sid_from_rid(to, from->group_rid, PDB_CHANGED);
221         }
222         
223         DEBUG(10,("INFO_21 ACCT_CTRL: %08X -> %08X\n",pdb_get_acct_ctrl(to),from->acb_info));
224         if (from->acb_info != pdb_get_acct_ctrl(to)) {
225                 pdb_set_acct_ctrl(to, from->acb_info, PDB_CHANGED);
226         }
227
228         DEBUG(10,("INFO_21 FIELDS_PRESENT: %08X -> %08X\n",pdb_get_fields_present(to),from->fields_present));
229         if (from->fields_present != pdb_get_fields_present(to)) {
230                 pdb_set_fields_present(to, from->fields_present, PDB_CHANGED);
231         }
232
233         DEBUG(15,("INFO_21 LOGON_DIVS: %08X -> %08X\n",pdb_get_logon_divs(to),from->logon_divs));
234         if (from->logon_divs != pdb_get_logon_divs(to)) {
235                 pdb_set_logon_divs(to, from->logon_divs, PDB_CHANGED);
236         }
237
238         DEBUG(15,("INFO_21 LOGON_HRS.LEN: %08X -> %08X\n",pdb_get_hours_len(to),from->logon_hrs.len));
239         if (from->logon_hrs.len != pdb_get_hours_len(to)) {
240                 pdb_set_hours_len(to, from->logon_hrs.len, PDB_CHANGED);
241         }
242
243         DEBUG(15,("INFO_21 LOGON_HRS.HOURS: %s -> %s\n",pdb_get_hours(to),from->logon_hrs.hours));
244 /* Fix me: only update if it changes --metze */
245         pdb_set_hours(to, from->logon_hrs.hours, PDB_CHANGED);
246
247         DEBUG(10,("INFO_21 BAD_PASSWORD_COUNT: %08X -> %08X\n",pdb_get_bad_password_count(to),from->bad_password_count));
248         if (from->bad_password_count != pdb_get_bad_password_count(to)) {
249                 pdb_set_bad_password_count(to, from->bad_password_count, PDB_CHANGED);
250         }
251
252         DEBUG(10,("INFO_21 LOGON_COUNT: %08X -> %08X\n",pdb_get_logon_count(to),from->logon_count));
253         if (from->logon_count != pdb_get_logon_count(to)) {
254                 pdb_set_logon_count(to, from->logon_count, PDB_CHANGED);
255         }
256
257         DEBUG(10,("INFO_21 UNKNOWN_6: %08X -> %08X\n",pdb_get_unknown_6(to),from->unknown_6));
258         if (from->unknown_6 != pdb_get_unknown_6(to)) {
259                 pdb_set_unknown_6(to, from->unknown_6, PDB_CHANGED);
260         }
261
262         DEBUG(10,("INFO_21 PADDING1 %02X %02X %02X %02X %02X %02X\n",
263                   from->padding1[0],
264                   from->padding1[1],
265                   from->padding1[2],
266                   from->padding1[3],
267                   from->padding1[4],
268                   from->padding1[5]));
269
270         DEBUG(10,("INFO_21 PASS_MUST_CHANGE_AT_NEXT_LOGON: %02X\n",from->passmustchange));
271         if (from->passmustchange==PASS_MUST_CHANGE_AT_NEXT_LOGON) {
272                 pdb_set_pass_must_change_time(to,0, PDB_CHANGED);               
273         }
274
275         DEBUG(10,("INFO_21 PADDING_2: %02X\n",from->padding2));
276
277         DEBUG(10,("INFO_21 PADDING_4: %08X\n",from->padding4));
278 }
279
280
281 /*************************************************************
282  Copies a SAM_USER_INFO_23 to a SAM_ACCOUNT
283 **************************************************************/
284
285 void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
286 {
287         time_t unix_time, stored_time;
288         const char *old_string, *new_string;
289         DATA_BLOB mung;
290
291         if (from == NULL || to == NULL) 
292                 return;
293         if (!nt_time_is_zero(&from->logon_time)) {
294                 unix_time=nt_time_to_unix(&from->logon_time);
295                 stored_time = pdb_get_logon_time(to);
296                 DEBUG(10,("INFO_23 LOGON_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
297                 if (stored_time != unix_time) 
298                         pdb_set_logon_time(to, unix_time, PDB_CHANGED);
299         }       
300         if (!nt_time_is_zero(&from->logoff_time)) {
301                 unix_time=nt_time_to_unix(&from->logoff_time);
302                 stored_time = pdb_get_logoff_time(to);
303                 DEBUG(10,("INFO_23 LOGOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
304                 if (stored_time != unix_time) 
305                         pdb_set_logoff_time(to, unix_time, PDB_CHANGED);
306         }
307         
308         if (!nt_time_is_zero(&from->kickoff_time)) {
309                 unix_time=nt_time_to_unix(&from->kickoff_time);
310                 stored_time = pdb_get_kickoff_time(to);
311                 DEBUG(10,("INFO_23 KICKOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
312                 if (stored_time != unix_time) 
313                         pdb_set_kickoff_time(to, unix_time , PDB_CHANGED);
314         }       
315
316         if (!nt_time_is_zero(&from->pass_can_change_time)) {
317                 unix_time=nt_time_to_unix(&from->pass_can_change_time);
318                 stored_time = pdb_get_pass_can_change_time(to);
319                 DEBUG(10,("INFO_23 PASS_CAN_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
320                 if (stored_time != unix_time) 
321                         pdb_set_pass_can_change_time(to, unix_time, PDB_CHANGED);
322         }
323         if (!nt_time_is_zero(&from->pass_last_set_time)) {
324                 unix_time=nt_time_to_unix(&from->pass_last_set_time);
325                 stored_time = pdb_get_pass_last_set_time(to);
326                 DEBUG(10,("INFO_23 PASS_LAST_SET: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
327                 if (stored_time != unix_time) 
328                         pdb_set_pass_last_set_time(to, unix_time, PDB_CHANGED);
329         }
330
331         if (!nt_time_is_zero(&from->pass_must_change_time)) {
332                 unix_time=nt_time_to_unix(&from->pass_must_change_time);
333                 stored_time=pdb_get_pass_must_change_time(to);
334                 DEBUG(10,("INFO_23 PASS_MUST_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
335                 if (stored_time != unix_time) 
336                         pdb_set_pass_must_change_time(to, unix_time, PDB_CHANGED);
337         }
338
339         /* Backend should check this for sainity */
340         if (from->hdr_user_name.buffer) {
341                 old_string = pdb_get_username(to);
342                 new_string = unistr2_static(&from->uni_user_name);
343                 DEBUG(10,("INFO_23 UNI_USER_NAME: %s -> %s\n", old_string, new_string));
344                 if (STRING_CHANGED)
345                     pdb_set_username(to      , new_string, PDB_CHANGED);
346         }
347
348         if (from->hdr_full_name.buffer) {
349                 old_string = pdb_get_fullname(to);
350                 new_string = unistr2_static(&from->uni_full_name);
351                 DEBUG(10,("INFO_23 UNI_FULL_NAME: %s -> %s\n",old_string, new_string));
352                 if (STRING_CHANGED)
353                         pdb_set_fullname(to      , new_string, PDB_CHANGED);
354         }
355         
356         if (from->hdr_home_dir.buffer) {
357                 old_string = pdb_get_homedir(to);
358                 new_string = unistr2_static(&from->uni_home_dir);
359                 DEBUG(10,("INFO_23 UNI_HOME_DIR: %s -> %s\n",old_string,new_string));
360                 if (STRING_CHANGED)
361                         pdb_set_homedir(to       , new_string, PDB_CHANGED);
362         }
363
364         if (from->hdr_dir_drive.buffer) {
365                 old_string = pdb_get_dir_drive(to);
366                 new_string = unistr2_static(&from->uni_dir_drive);
367                 DEBUG(10,("INFO_23 UNI_DIR_DRIVE: %s -> %s\n",old_string,new_string));
368                 if (STRING_CHANGED)
369                         pdb_set_dir_drive(to     , new_string, PDB_CHANGED);
370         }
371
372         if (from->hdr_logon_script.buffer) {
373                 old_string = pdb_get_logon_script(to);
374                 new_string = unistr2_static(&from->uni_logon_script);
375                 DEBUG(10,("INFO_23 UNI_LOGON_SCRIPT: %s -> %s\n",old_string,new_string));
376                 if (STRING_CHANGED)
377                         pdb_set_logon_script(to  , new_string, PDB_CHANGED);
378         }
379
380         if (from->hdr_profile_path.buffer) {
381                 old_string = pdb_get_profile_path(to);
382                 new_string = unistr2_static(&from->uni_profile_path);
383                 DEBUG(10,("INFO_23 UNI_PROFILE_PATH: %s -> %s\n",old_string, new_string));
384                 if (STRING_CHANGED)
385                         pdb_set_profile_path(to  , new_string, PDB_CHANGED);
386         }
387         
388         if (from->hdr_acct_desc.buffer) {
389                 old_string = pdb_get_acct_desc(to);
390                 new_string = unistr2_static(&from->uni_acct_desc);
391                 DEBUG(10,("INFO_23 UNI_ACCT_DESC: %s -> %s\n",old_string,new_string));
392                 if (STRING_CHANGED)
393                         pdb_set_acct_desc(to     , new_string, PDB_CHANGED);
394         }
395         
396         if (from->hdr_workstations.buffer) {
397                 old_string = pdb_get_workstations(to);
398                 new_string = unistr2_static(&from->uni_workstations);
399                 DEBUG(10,("INFO_23 UNI_WORKSTATIONS: %s -> %s\n",old_string, new_string));
400                 if (STRING_CHANGED)
401                         pdb_set_workstations(to  , new_string, PDB_CHANGED);
402         }
403
404         if (from->hdr_unknown_str.buffer) {
405                 old_string = pdb_get_unknown_str(to);
406                 new_string = unistr2_static(&from->uni_unknown_str);
407                 DEBUG(10,("INFO_23 UNI_UNKNOWN_STR: %s -> %s\n",old_string, new_string));
408                 if (STRING_CHANGED)
409                         pdb_set_unknown_str(to   , new_string, PDB_CHANGED);
410         }
411         
412         if (from->hdr_munged_dial.buffer) {
413                 char *newstr;
414                 old_string = pdb_get_munged_dial(to);
415                 mung.length = from->hdr_munged_dial.uni_str_len;
416                 mung.data = (uint8 *) from->uni_munged_dial.buffer;
417                 newstr = base64_encode_data_blob(mung);
418                 DEBUG(10,("INFO_23 UNI_MUNGED_DIAL: %s -> %s\n",old_string, newstr));
419                 if (STRING_CHANGED_NC(old_string, newstr))
420                         pdb_set_munged_dial(to   , newstr, PDB_CHANGED);
421
422                 SAFE_FREE(newstr);
423         }
424         
425         if (from->user_rid == 0) {
426                 DEBUG(10, ("INFO_23: Asked to set User RID to 0 !? Skipping change!\n"));
427         } else if (from->user_rid != pdb_get_user_rid(to)) {
428                 DEBUG(10,("INFO_23 USER_RID: %u -> %u NOT UPDATED!\n",pdb_get_user_rid(to),from->user_rid));
429                 /* we really allow this ??? metze */
430                 /* pdb_set_user_sid_from_rid(to, from->user_rid, PDB_CHANGED);*/
431         }
432         if (from->group_rid == 0) {
433                 DEBUG(10, ("INFO_23: Asked to set Group RID to 0 !? Skipping change!\n"));
434         } else if (from->group_rid != pdb_get_group_rid(to)) {
435                 DEBUG(10,("INFO_23 GROUP_RID: %u -> %u\n",pdb_get_group_rid(to),from->group_rid));
436                 pdb_set_group_sid_from_rid(to, from->group_rid, PDB_CHANGED);
437         }
438         
439         DEBUG(10,("INFO_23 ACCT_CTRL: %08X -> %08X\n",pdb_get_acct_ctrl(to),from->acb_info));
440         if (from->acb_info != pdb_get_acct_ctrl(to)) {
441                 pdb_set_acct_ctrl(to, from->acb_info, PDB_CHANGED);
442         }
443
444         DEBUG(10,("INFO_23 FIELDS_PRESENT: %08X -> %08X\n",pdb_get_fields_present(to),from->fields_present));
445         if (from->fields_present != pdb_get_fields_present(to)) {
446                 pdb_set_fields_present(to, from->fields_present, PDB_CHANGED);
447         }
448
449         DEBUG(15,("INFO_23 LOGON_DIVS: %08X -> %08X\n",pdb_get_logon_divs(to),from->logon_divs));
450         if (from->logon_divs != pdb_get_logon_divs(to)) {
451                 pdb_set_logon_divs(to, from->logon_divs, PDB_CHANGED);
452         }
453
454         DEBUG(15,("INFO_23 LOGON_HRS.LEN: %08X -> %08X\n",pdb_get_hours_len(to),from->logon_hrs.len));
455         if (from->logon_hrs.len != pdb_get_hours_len(to)) {
456                 pdb_set_hours_len(to, from->logon_hrs.len, PDB_CHANGED);
457         }
458
459         DEBUG(15,("INFO_23 LOGON_HRS.HOURS: %s -> %s\n",pdb_get_hours(to),from->logon_hrs.hours));
460 /* Fix me: only update if it changes --metze */
461         pdb_set_hours(to, from->logon_hrs.hours, PDB_CHANGED);
462
463         DEBUG(10,("INFO_23 BAD_PASSWORD_COUNT: %08X -> %08X\n",pdb_get_bad_password_count(to),from->bad_password_count));
464         if (from->bad_password_count != pdb_get_bad_password_count(to)) {
465                 pdb_set_bad_password_count(to, from->bad_password_count, PDB_CHANGED);
466         }
467
468         DEBUG(10,("INFO_23 LOGON_COUNT: %08X -> %08X\n",pdb_get_logon_count(to),from->logon_count));
469         if (from->logon_count != pdb_get_logon_count(to)) {
470                 pdb_set_logon_count(to, from->logon_count, PDB_CHANGED);
471         }
472
473         DEBUG(10,("INFO_23 UNKOWN_6: %08X -> %08X\n",pdb_get_unknown_6(to),from->unknown_6));
474         if (from->unknown_6 != pdb_get_unknown_6(to)) {
475                 pdb_set_unknown_6(to, from->unknown_6, PDB_CHANGED);
476         }
477
478         DEBUG(10,("INFO_23 PADDING1 %02X %02X %02X %02X %02X %02X\n",
479                   from->padding1[0],
480                   from->padding1[1],
481                   from->padding1[2],
482                   from->padding1[3],
483                   from->padding1[4],
484                   from->padding1[5]));
485
486         DEBUG(10,("INFO_23 PASS_MUST_CHANGE_AT_NEXT_LOGON: %02X\n",from->passmustchange));
487         if (from->passmustchange==PASS_MUST_CHANGE_AT_NEXT_LOGON) {
488                 pdb_set_pass_must_change_time(to,0, PDB_CHANGED);               
489         }
490
491         DEBUG(10,("INFO_23 PADDING_2: %02X\n",from->padding2));
492
493         DEBUG(10,("INFO_23 PADDING_4: %08X\n",from->padding4));
494 }