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 42void 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 = (mung.length == 0) ? 56 NULL : base64_encode_data_blob(mung); 57 DEBUG(10,("INFO_20 UNI_MUNGED_DIAL: %s -> %s\n",old_string, new_string)); 58 if (STRING_CHANGED_NC(old_string,new_string)) 59 pdb_set_munged_dial(to , new_string, PDB_CHANGED); 60 61 SAFE_FREE(new_string); 62 } 63} 64 65/************************************************************* 66 Copies a SAM_USER_INFO_21 to a SAM_ACCOUNT 67**************************************************************/ 68 69void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from) 70{ 71 time_t unix_time, stored_time; 72 const char *old_string, *new_string; 73 DATA_BLOB mung; 74 75 if (from == NULL || to == NULL) 76 return; 77 78 if (from->fields_present & ACCT_LAST_LOGON) { 79 unix_time=nt_time_to_unix(&from->logon_time); 80 stored_time = pdb_get_logon_time(to); 81 DEBUG(10,("INFO_21 LOGON_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 82 if (stored_time != unix_time) 83 pdb_set_logon_time(to, unix_time, PDB_CHANGED); 84 } 85 86 if (from->fields_present & ACCT_LAST_LOGOFF) { 87 unix_time=nt_time_to_unix(&from->logoff_time); 88 stored_time = pdb_get_logoff_time(to); 89 DEBUG(10,("INFO_21 LOGOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 90 if (stored_time != unix_time) 91 pdb_set_logoff_time(to, unix_time, PDB_CHANGED); 92 } 93 94 if (from->fields_present & ACCT_EXPIRY) { 95 unix_time=nt_time_to_unix(&from->kickoff_time); 96 stored_time = pdb_get_kickoff_time(to); 97 DEBUG(10,("INFO_21 KICKOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 98 if (stored_time != unix_time) 99 pdb_set_kickoff_time(to, unix_time , PDB_CHANGED); 100 } 101 102 if (from->fields_present & ACCT_ALLOW_PWD_CHANGE) { 103 unix_time=nt_time_to_unix(&from->pass_can_change_time); 104 stored_time = pdb_get_pass_can_change_time(to); 105 DEBUG(10,("INFO_21 PASS_CAN_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 106 if (stored_time != unix_time) 107 pdb_set_pass_can_change_time(to, unix_time, PDB_CHANGED); 108 } 109 110 if (from->fields_present & ACCT_LAST_PWD_CHANGE) { 111 unix_time=nt_time_to_unix(&from->pass_last_set_time); 112 stored_time = pdb_get_pass_last_set_time(to); 113 DEBUG(10,("INFO_21 PASS_LAST_SET: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 114 if (stored_time != unix_time) 115 pdb_set_pass_last_set_time(to, unix_time, PDB_CHANGED); 116 } 117 118 if (from->fields_present & ACCT_FORCE_PWD_CHANGE) { 119 unix_time=nt_time_to_unix(&from->pass_must_change_time); 120 stored_time=pdb_get_pass_must_change_time(to); 121 DEBUG(10,("INFO_21 PASS_MUST_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 122 if (stored_time != unix_time) 123 pdb_set_pass_must_change_time(to, unix_time, PDB_CHANGED); 124 } 125 126 if ((from->fields_present & ACCT_USERNAME) && 127 (from->hdr_user_name.buffer)) { 128 old_string = pdb_get_username(to); 129 new_string = unistr2_static(&from->uni_user_name); 130 DEBUG(10,("INFO_21 UNI_USER_NAME: %s -> %s\n", old_string, new_string)); 131 if (STRING_CHANGED) 132 pdb_set_username(to , new_string, PDB_CHANGED); 133 } 134 135 if ((from->fields_present & ACCT_FULL_NAME) && 136 (from->hdr_full_name.buffer)) { 137 old_string = pdb_get_fullname(to); 138 new_string = unistr2_static(&from->uni_full_name); 139 DEBUG(10,("INFO_21 UNI_FULL_NAME: %s -> %s\n",old_string, new_string)); 140 if (STRING_CHANGED) 141 pdb_set_fullname(to , new_string, PDB_CHANGED); 142 } 143 144 if ((from->fields_present & ACCT_HOME_DIR) && 145 (from->hdr_home_dir.buffer)) { 146 old_string = pdb_get_homedir(to); 147 new_string = unistr2_static(&from->uni_home_dir); 148 DEBUG(10,("INFO_21 UNI_HOME_DIR: %s -> %s\n",old_string,new_string)); 149 if (STRING_CHANGED) 150 pdb_set_homedir(to , new_string, PDB_CHANGED); 151 } 152 153 if ((from->fields_present & ACCT_HOME_DRIVE) && 154 (from->hdr_dir_drive.buffer)) { 155 old_string = pdb_get_dir_drive(to); 156 new_string = unistr2_static(&from->uni_dir_drive); 157 DEBUG(10,("INFO_21 UNI_DIR_DRIVE: %s -> %s\n",old_string,new_string)); 158 if (STRING_CHANGED) 159 pdb_set_dir_drive(to , new_string, PDB_CHANGED); 160 } 161 162 if ((from->fields_present & ACCT_LOGON_SCRIPT) && 163 (from->hdr_logon_script.buffer)) { 164 old_string = pdb_get_logon_script(to); 165 new_string = unistr2_static(&from->uni_logon_script); 166 DEBUG(10,("INFO_21 UNI_LOGON_SCRIPT: %s -> %s\n",old_string,new_string)); 167 if (STRING_CHANGED) 168 pdb_set_logon_script(to , new_string, PDB_CHANGED); 169 } 170 171 if ((from->fields_present & ACCT_PROFILE) && 172 (from->hdr_profile_path.buffer)) { 173 old_string = pdb_get_profile_path(to); 174 new_string = unistr2_static(&from->uni_profile_path); 175 DEBUG(10,("INFO_21 UNI_PROFILE_PATH: %s -> %s\n",old_string, new_string)); 176 if (STRING_CHANGED) 177 pdb_set_profile_path(to , new_string, PDB_CHANGED); 178 } 179 180 if ((from->fields_present & ACCT_DESCRIPTION) && 181 (from->hdr_acct_desc.buffer)) { 182 old_string = pdb_get_acct_desc(to); 183 new_string = unistr2_static(&from->uni_acct_desc); 184 DEBUG(10,("INFO_21 UNI_ACCT_DESC: %s -> %s\n",old_string,new_string)); 185 if (STRING_CHANGED) 186 pdb_set_acct_desc(to , new_string, PDB_CHANGED); 187 } 188 189 if ((from->fields_present & ACCT_WORKSTATIONS) && 190 (from->hdr_workstations.buffer)) { 191 old_string = pdb_get_workstations(to); 192 new_string = unistr2_static(&from->uni_workstations); 193 DEBUG(10,("INFO_21 UNI_WORKSTATIONS: %s -> %s\n",old_string, new_string)); 194 if (STRING_CHANGED) 195 pdb_set_workstations(to , new_string, PDB_CHANGED); 196 } 197 198 /* is this right? */ 199 if ((from->fields_present & ACCT_ADMIN_DESC) && 200 (from->hdr_unknown_str.buffer)) { 201 old_string = pdb_get_unknown_str(to); 202 new_string = unistr2_static(&from->uni_unknown_str); 203 DEBUG(10,("INFO_21 UNI_UNKNOWN_STR: %s -> %s\n",old_string, new_string)); 204 if (STRING_CHANGED) 205 pdb_set_unknown_str(to , new_string, PDB_CHANGED); 206 } 207 208 if ((from->fields_present & ACCT_CALLBACK) && 209 (from->hdr_munged_dial.buffer)) { 210 char *newstr; 211 old_string = pdb_get_munged_dial(to); 212 mung.length = from->hdr_munged_dial.uni_str_len; 213 mung.data = (uint8 *) from->uni_munged_dial.buffer; 214 newstr = (mung.length == 0) ? 215 NULL : base64_encode_data_blob(mung); 216 DEBUG(10,("INFO_21 UNI_MUNGED_DIAL: %s -> %s\n",old_string, newstr)); 217 if (STRING_CHANGED_NC(old_string,newstr)) 218 pdb_set_munged_dial(to , newstr, PDB_CHANGED); 219 220 SAFE_FREE(newstr); 221 } 222 223 if (from->fields_present & ACCT_RID) { 224 if (from->user_rid == 0) { 225 DEBUG(10, ("INFO_21: Asked to set User RID to 0 !? Skipping change!\n")); 226 } else if (from->user_rid != pdb_get_user_rid(to)) { 227 DEBUG(10,("INFO_21 USER_RID: %u -> %u NOT UPDATED!\n",pdb_get_user_rid(to),from->user_rid)); 228 } 229 } 230 231 if (from->fields_present & ACCT_PRIMARY_GID) { 232 if (from->group_rid == 0) { 233 DEBUG(10, ("INFO_21: Asked to set Group RID to 0 !? Skipping change!\n")); 234 } else if (from->group_rid != pdb_get_group_rid(to)) { 235 DEBUG(10,("INFO_21 GROUP_RID: %u -> %u\n",pdb_get_group_rid(to),from->group_rid)); 236 pdb_set_group_sid_from_rid(to, from->group_rid, PDB_CHANGED); 237 } 238 } 239 240 if (from->fields_present & ACCT_FLAGS) { 241 DEBUG(10,("INFO_21 ACCT_CTRL: %08X -> %08X\n",pdb_get_acct_ctrl(to),from->acb_info)); 242 if (from->acb_info != pdb_get_acct_ctrl(to)) { 243 if (!(from->acb_info & ACB_AUTOLOCK) && (pdb_get_acct_ctrl(to) & ACB_AUTOLOCK)) { 244 /* We're unlocking a previously locked user. Reset bad password counts. 245 Patch from Jianliang Lu. <Jianliang.Lu@getronics.com> */ 246 pdb_set_bad_password_count(to, 0, PDB_CHANGED); 247 pdb_set_bad_password_time(to, 0, PDB_CHANGED); 248 } 249 pdb_set_acct_ctrl(to, from->acb_info, PDB_CHANGED); 250 } 251 } 252 253 if (from->fields_present & ACCT_LOGON_HOURS) { 254 pstring old, new; 255 DEBUG(15,("INFO_21 LOGON_DIVS: %08X -> %08X\n",pdb_get_logon_divs(to),from->logon_divs)); 256 if (from->logon_divs != pdb_get_logon_divs(to)) { 257 pdb_set_logon_divs(to, from->logon_divs, PDB_CHANGED); 258 } 259 260 DEBUG(15,("INFO_21 LOGON_HRS.LEN: %08X -> %08X\n",pdb_get_hours_len(to),from->logon_hrs.len)); 261 if (from->logon_hrs.len != pdb_get_hours_len(to)) { 262 pdb_set_hours_len(to, from->logon_hrs.len, PDB_CHANGED); 263 } 264 265 DEBUG(15,("INFO_21 LOGON_HRS.HOURS: %s -> %s\n",pdb_get_hours(to),from->logon_hrs.hours)); 266 pdb_sethexhours(old, pdb_get_hours(to)); 267 pdb_sethexhours(new, (const char *)from->logon_hrs.hours); 268 if (!strequal(old, new)) { 269 pdb_set_hours(to, from->logon_hrs.hours, PDB_CHANGED); 270 } 271 } 272 273 if (from->fields_present & ACCT_BAD_PWD_COUNT) { 274 DEBUG(10,("INFO_21 BAD_PASSWORD_COUNT: %08X -> %08X\n",pdb_get_bad_password_count(to),from->bad_password_count)); 275 if (from->bad_password_count != pdb_get_bad_password_count(to)) { 276 pdb_set_bad_password_count(to, from->bad_password_count, PDB_CHANGED); 277 } 278 } 279 280 if (from->fields_present & ACCT_NUM_LOGONS) { 281 DEBUG(10,("INFO_21 LOGON_COUNT: %08X -> %08X\n",pdb_get_logon_count(to),from->logon_count)); 282 if (from->logon_count != pdb_get_logon_count(to)) { 283 pdb_set_logon_count(to, from->logon_count, PDB_CHANGED); 284 } 285 } 286 287 DEBUG(10,("INFO_21 PASS_MUST_CHANGE_AT_NEXT_LOGON: %02X\n",from->passmustchange)); 288 if (from->passmustchange==PASS_MUST_CHANGE_AT_NEXT_LOGON) { 289 pdb_set_pass_must_change_time(to,0, PDB_CHANGED); 290 } 291 292 DEBUG(10,("INFO_21 PADDING_2: %02X\n",from->padding2)); 293} 294 295 296/************************************************************* 297 Copies a SAM_USER_INFO_23 to a SAM_ACCOUNT 298**************************************************************/ 299 300void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from) 301{ 302 time_t unix_time, stored_time; 303 const char *old_string, *new_string; 304 DATA_BLOB mung; 305 306 if (from == NULL || to == NULL) 307 return; 308 309 if (from->fields_present & ACCT_LAST_LOGON) { 310 unix_time=nt_time_to_unix(&from->logon_time); 311 stored_time = pdb_get_logon_time(to); 312 DEBUG(10,("INFO_23 LOGON_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 313 if (stored_time != unix_time) 314 pdb_set_logon_time(to, unix_time, PDB_CHANGED); 315 } 316 317 if (from->fields_present & ACCT_LAST_LOGOFF) { 318 unix_time=nt_time_to_unix(&from->logoff_time); 319 stored_time = pdb_get_logoff_time(to); 320 DEBUG(10,("INFO_23 LOGOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 321 if (stored_time != unix_time) 322 pdb_set_logoff_time(to, unix_time, PDB_CHANGED); 323 } 324 325 if (from->fields_present & ACCT_EXPIRY) { 326 unix_time=nt_time_to_unix(&from->kickoff_time); 327 stored_time = pdb_get_kickoff_time(to); 328 DEBUG(10,("INFO_23 KICKOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 329 if (stored_time != unix_time) 330 pdb_set_kickoff_time(to, unix_time , PDB_CHANGED); 331 } 332 333 if (from->fields_present & ACCT_ALLOW_PWD_CHANGE) { 334 unix_time=nt_time_to_unix(&from->pass_can_change_time); 335 stored_time = pdb_get_pass_can_change_time(to); 336 DEBUG(10,("INFO_23 PASS_CAN_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 337 if (stored_time != unix_time) 338 pdb_set_pass_can_change_time(to, unix_time, PDB_CHANGED); 339 } 340 341 if (from->fields_present & ACCT_LAST_PWD_CHANGE) { 342 unix_time=nt_time_to_unix(&from->pass_last_set_time); 343 stored_time = pdb_get_pass_last_set_time(to); 344 DEBUG(10,("INFO_23 PASS_LAST_SET: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 345 if (stored_time != unix_time) 346 pdb_set_pass_last_set_time(to, unix_time, PDB_CHANGED); 347 } 348 349 if (from->fields_present & ACCT_FORCE_PWD_CHANGE) { 350 unix_time=nt_time_to_unix(&from->pass_must_change_time); 351 stored_time=pdb_get_pass_must_change_time(to); 352 DEBUG(10,("INFO_23 PASS_MUST_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 353 if (stored_time != unix_time) 354 pdb_set_pass_must_change_time(to, unix_time, PDB_CHANGED); 355 } 356 357 /* Backend should check this for sanity */ 358 if ((from->fields_present & ACCT_USERNAME) && 359 (from->hdr_user_name.buffer)) { 360 old_string = pdb_get_username(to); 361 new_string = unistr2_static(&from->uni_user_name); 362 DEBUG(10,("INFO_23 UNI_USER_NAME: %s -> %s\n", old_string, new_string)); 363 if (STRING_CHANGED) 364 pdb_set_username(to , new_string, PDB_CHANGED); 365 } 366 367 if ((from->fields_present & ACCT_FULL_NAME) && 368 (from->hdr_full_name.buffer)) { 369 old_string = pdb_get_fullname(to); 370 new_string = unistr2_static(&from->uni_full_name); 371 DEBUG(10,("INFO_23 UNI_FULL_NAME: %s -> %s\n",old_string, new_string)); 372 if (STRING_CHANGED) 373 pdb_set_fullname(to , new_string, PDB_CHANGED); 374 } 375 376 if ((from->fields_present & ACCT_HOME_DIR) && 377 (from->hdr_home_dir.buffer)) { 378 old_string = pdb_get_homedir(to); 379 new_string = unistr2_static(&from->uni_home_dir); 380 DEBUG(10,("INFO_23 UNI_HOME_DIR: %s -> %s\n",old_string,new_string)); 381 if (STRING_CHANGED) 382 pdb_set_homedir(to , new_string, PDB_CHANGED); 383 } 384 385 if ((from->fields_present & ACCT_HOME_DRIVE) && 386 (from->hdr_dir_drive.buffer)) { 387 old_string = pdb_get_dir_drive(to); 388 new_string = unistr2_static(&from->uni_dir_drive); 389 DEBUG(10,("INFO_23 UNI_DIR_DRIVE: %s -> %s\n",old_string,new_string)); 390 if (STRING_CHANGED) 391 pdb_set_dir_drive(to , new_string, PDB_CHANGED); 392 } 393 394 if ((from->fields_present & ACCT_LOGON_SCRIPT) && 395 (from->hdr_logon_script.buffer)) { 396 old_string = pdb_get_logon_script(to); 397 new_string = unistr2_static(&from->uni_logon_script); 398 DEBUG(10,("INFO_23 UNI_LOGON_SCRIPT: %s -> %s\n",old_string,new_string)); 399 if (STRING_CHANGED) 400 pdb_set_logon_script(to , new_string, PDB_CHANGED); 401 } 402 403 if ((from->fields_present & ACCT_PROFILE) && 404 (from->hdr_profile_path.buffer)) { 405 old_string = pdb_get_profile_path(to); 406 new_string = unistr2_static(&from->uni_profile_path); 407 DEBUG(10,("INFO_23 UNI_PROFILE_PATH: %s -> %s\n",old_string, new_string)); 408 if (STRING_CHANGED) 409 pdb_set_profile_path(to , new_string, PDB_CHANGED); 410 } 411 412 if ((from->fields_present & ACCT_DESCRIPTION) && 413 (from->hdr_acct_desc.buffer)) { 414 old_string = pdb_get_acct_desc(to); 415 new_string = unistr2_static(&from->uni_acct_desc); 416 DEBUG(10,("INFO_23 UNI_ACCT_DESC: %s -> %s\n",old_string,new_string)); 417 if (STRING_CHANGED) 418 pdb_set_acct_desc(to , new_string, PDB_CHANGED); 419 } 420 421 if ((from->fields_present & ACCT_WORKSTATIONS) && 422 (from->hdr_workstations.buffer)) { 423 old_string = pdb_get_workstations(to); 424 new_string = unistr2_static(&from->uni_workstations); 425 DEBUG(10,("INFO_23 UNI_WORKSTATIONS: %s -> %s\n",old_string, new_string)); 426 if (STRING_CHANGED) 427 pdb_set_workstations(to , new_string, PDB_CHANGED); 428 } 429 430 /* is this right? */ 431 if ((from->fields_present & ACCT_ADMIN_DESC) && 432 (from->hdr_unknown_str.buffer)) { 433 old_string = pdb_get_unknown_str(to); 434 new_string = unistr2_static(&from->uni_unknown_str); 435 DEBUG(10,("INFO_23 UNI_UNKNOWN_STR: %s -> %s\n",old_string, new_string)); 436 if (STRING_CHANGED) 437 pdb_set_unknown_str(to , new_string, PDB_CHANGED); 438 } 439 440 if ((from->fields_present & ACCT_CALLBACK) && 441 (from->hdr_munged_dial.buffer)) { 442 char *newstr; 443 old_string = pdb_get_munged_dial(to); 444 mung.length = from->hdr_munged_dial.uni_str_len; 445 mung.data = (uint8 *) from->uni_munged_dial.buffer; 446 newstr = (mung.length == 0) ? 447 NULL : base64_encode_data_blob(mung); 448 DEBUG(10,("INFO_23 UNI_MUNGED_DIAL: %s -> %s\n",old_string, newstr)); 449 if (STRING_CHANGED_NC(old_string, newstr)) 450 pdb_set_munged_dial(to , newstr, PDB_CHANGED); 451 452 SAFE_FREE(newstr); 453 } 454 455 if (from->fields_present & ACCT_RID) { 456 if (from->user_rid == 0) { 457 DEBUG(10, ("INFO_23: Asked to set User RID to 0 !? Skipping change!\n")); 458 } else if (from->user_rid != pdb_get_user_rid(to)) { 459 DEBUG(10,("INFO_23 USER_RID: %u -> %u NOT UPDATED!\n",pdb_get_user_rid(to),from->user_rid)); 460 } 461 } 462 463 if (from->fields_present & ACCT_PRIMARY_GID) { 464 if (from->group_rid == 0) { 465 DEBUG(10, ("INFO_23: Asked to set Group RID to 0 !? Skipping change!\n")); 466 } else if (from->group_rid != pdb_get_group_rid(to)) { 467 DEBUG(10,("INFO_23 GROUP_RID: %u -> %u\n",pdb_get_group_rid(to),from->group_rid)); 468 pdb_set_group_sid_from_rid(to, from->group_rid, PDB_CHANGED); 469 } 470 } 471 472 if (from->fields_present & ACCT_FLAGS) { 473 DEBUG(10,("INFO_23 ACCT_CTRL: %08X -> %08X\n",pdb_get_acct_ctrl(to),from->acb_info)); 474 if (from->acb_info != pdb_get_acct_ctrl(to)) { 475 pdb_set_acct_ctrl(to, from->acb_info, PDB_CHANGED); 476 } 477 } 478 479 if (from->fields_present & ACCT_LOGON_HOURS) { 480 DEBUG(15,("INFO_23 LOGON_DIVS: %08X -> %08X\n",pdb_get_logon_divs(to),from->logon_divs)); 481 if (from->logon_divs != pdb_get_logon_divs(to)) { 482 pdb_set_logon_divs(to, from->logon_divs, PDB_CHANGED); 483 } 484 485 DEBUG(15,("INFO_23 LOGON_HRS.LEN: %08X -> %08X\n",pdb_get_hours_len(to),from->logon_hrs.len)); 486 if (from->logon_hrs.len != pdb_get_hours_len(to)) { 487 pdb_set_hours_len(to, from->logon_hrs.len, PDB_CHANGED); 488 } 489 490 DEBUG(15,("INFO_23 LOGON_HRS.HOURS: %s -> %s\n",pdb_get_hours(to),from->logon_hrs.hours)); 491 /* Fix me: only update if it changes --metze */ 492 pdb_set_hours(to, from->logon_hrs.hours, PDB_CHANGED); 493 494 } 495 496 if (from->fields_present & ACCT_BAD_PWD_COUNT) { 497 DEBUG(10,("INFO_23 BAD_PASSWORD_COUNT: %08X -> %08X\n",pdb_get_bad_password_count(to),from->bad_password_count)); 498 if (from->bad_password_count != pdb_get_bad_password_count(to)) { 499 pdb_set_bad_password_count(to, from->bad_password_count, PDB_CHANGED); 500 } 501 } 502 503 if (from->fields_present & ACCT_NUM_LOGONS) { 504 DEBUG(10,("INFO_23 LOGON_COUNT: %08X -> %08X\n",pdb_get_logon_count(to),from->logon_count)); 505 if (from->logon_count != pdb_get_logon_count(to)) { 506 pdb_set_logon_count(to, from->logon_count, PDB_CHANGED); 507 } 508 } 509 510 DEBUG(10,("INFO_23 PASS_MUST_CHANGE_AT_NEXT_LOGON: %02X\n",from->passmustchange)); 511 if (from->passmustchange==PASS_MUST_CHANGE_AT_NEXT_LOGON) { 512 pdb_set_pass_must_change_time(to,0, PDB_CHANGED); 513 } 514 515 DEBUG(10,("INFO_23 PADDING_2: %02X\n",from->padding2)); 516} 517