関数 | |
void | copy_id20_to_sam_passwd (struct samu *to, SAM_USER_INFO_20 *from) |
void | copy_id21_to_sam_passwd (struct samu *to, SAM_USER_INFO_21 *from) |
void | copy_id23_to_sam_passwd (struct samu *to, SAM_USER_INFO_23 *from) |
void | copy_id25_to_sam_passwd (struct samu *to, SAM_USER_INFO_25 *from) |
void copy_id20_to_sam_passwd | ( | struct samu * | to, | |
SAM_USER_INFO_20 * | from | |||
) |
srv_samr_util.c の 42 行で定義されています。
参照先 base64_encode_data_blob()・data_blob_::data・data_blob_::free・from・data_blob_::length・PDB_CHANGED・pdb_get_munged_dial()・pdb_set_munged_dial()・to.
参照元 set_user_info_20().
00043 { 00044 const char *old_string; 00045 char *new_string; 00046 DATA_BLOB mung; 00047 00048 if (from == NULL || to == NULL) 00049 return; 00050 00051 if (from->hdr_munged_dial.buffer) { 00052 old_string = pdb_get_munged_dial(to); 00053 mung.length = from->hdr_munged_dial.uni_str_len; 00054 mung.data = (uint8 *) from->uni_munged_dial.buffer; 00055 mung.free = NULL; 00056 new_string = (mung.length == 0) ? 00057 NULL : base64_encode_data_blob(mung); 00058 DEBUG(10,("INFO_20 UNI_MUNGED_DIAL: %s -> %s\n",old_string, new_string)); 00059 if (STRING_CHANGED_NC(old_string,new_string)) 00060 pdb_set_munged_dial(to , new_string, PDB_CHANGED); 00061 00062 SAFE_FREE(new_string); 00063 } 00064 }
void copy_id21_to_sam_passwd | ( | struct samu * | to, | |
SAM_USER_INFO_21 * | from | |||
) |
srv_samr_util.c の 70 行で定義されています。
参照先 base64_encode_data_blob()・data_blob_::data・data_blob_::free・from・data_blob_::length・nt_time_to_unix()・PDB_CHANGED・pdb_get_acct_ctrl()・pdb_get_acct_desc()・pdb_get_bad_password_count()・pdb_get_comment()・pdb_get_dir_drive()・pdb_get_fullname()・pdb_get_group_rid()・pdb_get_homedir()・pdb_get_hours()・pdb_get_hours_len()・pdb_get_kickoff_time()・pdb_get_logoff_time()・pdb_get_logon_count()・pdb_get_logon_divs()・pdb_get_logon_script()・pdb_get_logon_time()・pdb_get_munged_dial()・pdb_get_pass_last_set_time()・pdb_get_profile_path()・pdb_get_user_rid()・pdb_get_username()・pdb_get_workstations()・pdb_set_acct_ctrl()・pdb_set_acct_desc()・pdb_set_bad_password_count()・pdb_set_bad_password_time()・pdb_set_comment()・pdb_set_dir_drive()・pdb_set_fullname()・pdb_set_group_sid_from_rid()・pdb_set_homedir()・pdb_set_hours()・pdb_set_hours_len()・pdb_set_kickoff_time()・pdb_set_logoff_time()・pdb_set_logon_count()・pdb_set_logon_divs()・pdb_set_logon_script()・pdb_set_logon_time()・pdb_set_munged_dial()・pdb_set_pass_last_set_time()・pdb_set_profile_path()・pdb_set_username()・pdb_set_workstations()・pdb_sethexhours()・strequal()・to・unistr2_static().
参照元 set_user_info_21().
00071 { 00072 time_t unix_time, stored_time; 00073 const char *old_string, *new_string; 00074 DATA_BLOB mung; 00075 00076 if (from == NULL || to == NULL) 00077 return; 00078 00079 if (from->fields_present & ACCT_LAST_LOGON) { 00080 unix_time=nt_time_to_unix(from->logon_time); 00081 stored_time = pdb_get_logon_time(to); 00082 DEBUG(10,("INFO_21 LOGON_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 00083 if (stored_time != unix_time) 00084 pdb_set_logon_time(to, unix_time, PDB_CHANGED); 00085 } 00086 00087 if (from->fields_present & ACCT_LAST_LOGOFF) { 00088 unix_time=nt_time_to_unix(from->logoff_time); 00089 stored_time = pdb_get_logoff_time(to); 00090 DEBUG(10,("INFO_21 LOGOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 00091 if (stored_time != unix_time) 00092 pdb_set_logoff_time(to, unix_time, PDB_CHANGED); 00093 } 00094 00095 if (from->fields_present & ACCT_EXPIRY) { 00096 unix_time=nt_time_to_unix(from->kickoff_time); 00097 stored_time = pdb_get_kickoff_time(to); 00098 DEBUG(10,("INFO_21 KICKOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 00099 if (stored_time != unix_time) 00100 pdb_set_kickoff_time(to, unix_time , PDB_CHANGED); 00101 } 00102 00103 if (from->fields_present & ACCT_LAST_PWD_CHANGE) { 00104 unix_time=nt_time_to_unix(from->pass_last_set_time); 00105 stored_time = pdb_get_pass_last_set_time(to); 00106 DEBUG(10,("INFO_21 PASS_LAST_SET: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 00107 if (stored_time != unix_time) 00108 pdb_set_pass_last_set_time(to, unix_time, PDB_CHANGED); 00109 } 00110 00111 if ((from->fields_present & ACCT_USERNAME) && 00112 (from->hdr_user_name.buffer)) { 00113 old_string = pdb_get_username(to); 00114 new_string = unistr2_static(&from->uni_user_name); 00115 DEBUG(10,("INFO_21 UNI_USER_NAME: %s -> %s\n", old_string, new_string)); 00116 if (STRING_CHANGED) 00117 pdb_set_username(to , new_string, PDB_CHANGED); 00118 } 00119 00120 if ((from->fields_present & ACCT_FULL_NAME) && 00121 (from->hdr_full_name.buffer)) { 00122 old_string = pdb_get_fullname(to); 00123 new_string = unistr2_static(&from->uni_full_name); 00124 DEBUG(10,("INFO_21 UNI_FULL_NAME: %s -> %s\n",old_string, new_string)); 00125 if (STRING_CHANGED) 00126 pdb_set_fullname(to , new_string, PDB_CHANGED); 00127 } 00128 00129 if ((from->fields_present & ACCT_HOME_DIR) && 00130 (from->hdr_home_dir.buffer)) { 00131 old_string = pdb_get_homedir(to); 00132 new_string = unistr2_static(&from->uni_home_dir); 00133 DEBUG(10,("INFO_21 UNI_HOME_DIR: %s -> %s\n",old_string,new_string)); 00134 if (STRING_CHANGED) 00135 pdb_set_homedir(to , new_string, PDB_CHANGED); 00136 } 00137 00138 if ((from->fields_present & ACCT_HOME_DRIVE) && 00139 (from->hdr_dir_drive.buffer)) { 00140 old_string = pdb_get_dir_drive(to); 00141 new_string = unistr2_static(&from->uni_dir_drive); 00142 DEBUG(10,("INFO_21 UNI_DIR_DRIVE: %s -> %s\n",old_string,new_string)); 00143 if (STRING_CHANGED) 00144 pdb_set_dir_drive(to , new_string, PDB_CHANGED); 00145 } 00146 00147 if ((from->fields_present & ACCT_LOGON_SCRIPT) && 00148 (from->hdr_logon_script.buffer)) { 00149 old_string = pdb_get_logon_script(to); 00150 new_string = unistr2_static(&from->uni_logon_script); 00151 DEBUG(10,("INFO_21 UNI_LOGON_SCRIPT: %s -> %s\n",old_string,new_string)); 00152 if (STRING_CHANGED) 00153 pdb_set_logon_script(to , new_string, PDB_CHANGED); 00154 } 00155 00156 if ((from->fields_present & ACCT_PROFILE) && 00157 (from->hdr_profile_path.buffer)) { 00158 old_string = pdb_get_profile_path(to); 00159 new_string = unistr2_static(&from->uni_profile_path); 00160 DEBUG(10,("INFO_21 UNI_PROFILE_PATH: %s -> %s\n",old_string, new_string)); 00161 if (STRING_CHANGED) 00162 pdb_set_profile_path(to , new_string, PDB_CHANGED); 00163 } 00164 00165 if ((from->fields_present & ACCT_DESCRIPTION) && 00166 (from->hdr_acct_desc.buffer)) { 00167 old_string = pdb_get_acct_desc(to); 00168 new_string = unistr2_static(&from->uni_acct_desc); 00169 DEBUG(10,("INFO_21 UNI_ACCT_DESC: %s -> %s\n",old_string,new_string)); 00170 if (STRING_CHANGED) 00171 pdb_set_acct_desc(to , new_string, PDB_CHANGED); 00172 } 00173 00174 if ((from->fields_present & ACCT_WORKSTATIONS) && 00175 (from->hdr_workstations.buffer)) { 00176 old_string = pdb_get_workstations(to); 00177 new_string = unistr2_static(&from->uni_workstations); 00178 DEBUG(10,("INFO_21 UNI_WORKSTATIONS: %s -> %s\n",old_string, new_string)); 00179 if (STRING_CHANGED) 00180 pdb_set_workstations(to , new_string, PDB_CHANGED); 00181 } 00182 00183 if ((from->fields_present & ACCT_COMMENT) && 00184 (from->hdr_comment.buffer)) { 00185 old_string = pdb_get_comment(to); 00186 new_string = unistr2_static(&from->uni_comment); 00187 DEBUG(10,("INFO_21 UNI_COMMENT: %s -> %s\n",old_string, new_string)); 00188 if (STRING_CHANGED) 00189 pdb_set_comment(to, new_string, PDB_CHANGED); 00190 } 00191 00192 if ((from->fields_present & ACCT_CALLBACK) && 00193 (from->hdr_munged_dial.buffer)) { 00194 char *newstr; 00195 old_string = pdb_get_munged_dial(to); 00196 mung.length = from->hdr_munged_dial.uni_str_len; 00197 mung.data = (uint8 *) from->uni_munged_dial.buffer; 00198 mung.free = NULL; 00199 newstr = (mung.length == 0) ? 00200 NULL : base64_encode_data_blob(mung); 00201 DEBUG(10,("INFO_21 UNI_MUNGED_DIAL: %s -> %s\n",old_string, newstr)); 00202 if (STRING_CHANGED_NC(old_string,newstr)) 00203 pdb_set_munged_dial(to , newstr, PDB_CHANGED); 00204 00205 SAFE_FREE(newstr); 00206 } 00207 00208 if (from->fields_present & ACCT_RID) { 00209 if (from->user_rid == 0) { 00210 DEBUG(10, ("INFO_21: Asked to set User RID to 0 !? Skipping change!\n")); 00211 } else if (from->user_rid != pdb_get_user_rid(to)) { 00212 DEBUG(10,("INFO_21 USER_RID: %u -> %u NOT UPDATED!\n",pdb_get_user_rid(to),from->user_rid)); 00213 } 00214 } 00215 00216 if (from->fields_present & ACCT_PRIMARY_GID) { 00217 if (from->group_rid == 0) { 00218 DEBUG(10, ("INFO_21: Asked to set Group RID to 0 !? Skipping change!\n")); 00219 } else if (from->group_rid != pdb_get_group_rid(to)) { 00220 DEBUG(10,("INFO_21 GROUP_RID: %u -> %u\n",pdb_get_group_rid(to),from->group_rid)); 00221 pdb_set_group_sid_from_rid(to, from->group_rid, PDB_CHANGED); 00222 } 00223 } 00224 00225 if (from->fields_present & ACCT_FLAGS) { 00226 DEBUG(10,("INFO_21 ACCT_CTRL: %08X -> %08X\n",pdb_get_acct_ctrl(to),from->acb_info)); 00227 if (from->acb_info != pdb_get_acct_ctrl(to)) { 00228 if (!(from->acb_info & ACB_AUTOLOCK) && (pdb_get_acct_ctrl(to) & ACB_AUTOLOCK)) { 00229 /* We're unlocking a previously locked user. Reset bad password counts. 00230 Patch from Jianliang Lu. <Jianliang.Lu@getronics.com> */ 00231 pdb_set_bad_password_count(to, 0, PDB_CHANGED); 00232 pdb_set_bad_password_time(to, 0, PDB_CHANGED); 00233 } 00234 pdb_set_acct_ctrl(to, from->acb_info, PDB_CHANGED); 00235 } 00236 } 00237 00238 if (from->fields_present & ACCT_LOGON_HOURS) { 00239 pstring oldstr, newstr; 00240 DEBUG(15,("INFO_21 LOGON_DIVS: %08X -> %08X\n",pdb_get_logon_divs(to),from->logon_divs)); 00241 if (from->logon_divs != pdb_get_logon_divs(to)) { 00242 pdb_set_logon_divs(to, from->logon_divs, PDB_CHANGED); 00243 } 00244 00245 DEBUG(15,("INFO_21 LOGON_HRS.LEN: %08X -> %08X\n",pdb_get_hours_len(to),from->logon_hrs.len)); 00246 if (from->logon_hrs.len != pdb_get_hours_len(to)) { 00247 pdb_set_hours_len(to, from->logon_hrs.len, PDB_CHANGED); 00248 } 00249 00250 DEBUG(15,("INFO_21 LOGON_HRS.HOURS: %s -> %s\n",pdb_get_hours(to),from->logon_hrs.hours)); 00251 pdb_sethexhours(oldstr, pdb_get_hours(to)); 00252 pdb_sethexhours(newstr, from->logon_hrs.hours); 00253 if (!strequal(oldstr, newstr)) { 00254 pdb_set_hours(to, from->logon_hrs.hours, PDB_CHANGED); 00255 } 00256 } 00257 00258 if (from->fields_present & ACCT_BAD_PWD_COUNT) { 00259 DEBUG(10,("INFO_21 BAD_PASSWORD_COUNT: %08X -> %08X\n",pdb_get_bad_password_count(to),from->bad_password_count)); 00260 if (from->bad_password_count != pdb_get_bad_password_count(to)) { 00261 pdb_set_bad_password_count(to, from->bad_password_count, PDB_CHANGED); 00262 } 00263 } 00264 00265 if (from->fields_present & ACCT_NUM_LOGONS) { 00266 DEBUG(10,("INFO_21 LOGON_COUNT: %08X -> %08X\n",pdb_get_logon_count(to),from->logon_count)); 00267 if (from->logon_count != pdb_get_logon_count(to)) { 00268 pdb_set_logon_count(to, from->logon_count, PDB_CHANGED); 00269 } 00270 } 00271 00272 /* If the must change flag is set, the last set time goes to zero. 00273 the must change and can change fields also do, but they are 00274 calculated from policy, not set from the wire */ 00275 00276 if (from->fields_present & ACCT_EXPIRED_FLAG) { 00277 DEBUG(10,("INFO_21 PASS_MUST_CHANGE_AT_NEXT_LOGON: %02X\n",from->passmustchange)); 00278 if (from->passmustchange == PASS_MUST_CHANGE_AT_NEXT_LOGON) { 00279 pdb_set_pass_last_set_time(to, 0, PDB_CHANGED); 00280 } else { 00281 /* A subtlety here: some windows commands will 00282 clear the expired flag even though it's not 00283 set, and we don't want to reset the time 00284 in these caess. "net user /dom <user> /active:y" 00285 for example, to clear an autolocked acct. 00286 We must check to see if it's expired first. jmcd */ 00287 stored_time = pdb_get_pass_last_set_time(to); 00288 if (stored_time == 0) 00289 pdb_set_pass_last_set_time(to, time(NULL),PDB_CHANGED); 00290 } 00291 } 00292 00293 DEBUG(10,("INFO_21 PADDING_2: %02X\n",from->padding2)); 00294 }
void copy_id23_to_sam_passwd | ( | struct samu * | to, | |
SAM_USER_INFO_23 * | from | |||
) |
srv_samr_util.c の 301 行で定義されています。
参照先 base64_encode_data_blob()・data_blob_::data・data_blob_::free・from・data_blob_::length・nt_time_to_unix()・PDB_CHANGED・pdb_get_acct_ctrl()・pdb_get_acct_desc()・pdb_get_bad_password_count()・pdb_get_comment()・pdb_get_dir_drive()・pdb_get_fullname()・pdb_get_group_rid()・pdb_get_homedir()・pdb_get_hours()・pdb_get_hours_len()・pdb_get_kickoff_time()・pdb_get_logoff_time()・pdb_get_logon_count()・pdb_get_logon_divs()・pdb_get_logon_script()・pdb_get_logon_time()・pdb_get_munged_dial()・pdb_get_pass_last_set_time()・pdb_get_profile_path()・pdb_get_user_rid()・pdb_get_username()・pdb_get_workstations()・pdb_set_acct_ctrl()・pdb_set_acct_desc()・pdb_set_bad_password_count()・pdb_set_comment()・pdb_set_dir_drive()・pdb_set_fullname()・pdb_set_group_sid_from_rid()・pdb_set_homedir()・pdb_set_hours()・pdb_set_hours_len()・pdb_set_kickoff_time()・pdb_set_logoff_time()・pdb_set_logon_count()・pdb_set_logon_divs()・pdb_set_logon_script()・pdb_set_logon_time()・pdb_set_munged_dial()・pdb_set_pass_last_set_time()・pdb_set_profile_path()・pdb_set_username()・pdb_set_workstations()・to・unistr2_static().
参照元 set_user_info_23().
00302 { 00303 time_t unix_time, stored_time; 00304 const char *old_string, *new_string; 00305 DATA_BLOB mung; 00306 00307 if (from == NULL || to == NULL) 00308 return; 00309 00310 if (from->fields_present & ACCT_LAST_LOGON) { 00311 unix_time=nt_time_to_unix(from->logon_time); 00312 stored_time = pdb_get_logon_time(to); 00313 DEBUG(10,("INFO_23 LOGON_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 00314 if (stored_time != unix_time) 00315 pdb_set_logon_time(to, unix_time, PDB_CHANGED); 00316 } 00317 00318 if (from->fields_present & ACCT_LAST_LOGOFF) { 00319 unix_time=nt_time_to_unix(from->logoff_time); 00320 stored_time = pdb_get_logoff_time(to); 00321 DEBUG(10,("INFO_23 LOGOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 00322 if (stored_time != unix_time) 00323 pdb_set_logoff_time(to, unix_time, PDB_CHANGED); 00324 } 00325 00326 if (from->fields_present & ACCT_EXPIRY) { 00327 unix_time=nt_time_to_unix(from->kickoff_time); 00328 stored_time = pdb_get_kickoff_time(to); 00329 DEBUG(10,("INFO_23 KICKOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 00330 if (stored_time != unix_time) 00331 pdb_set_kickoff_time(to, unix_time , PDB_CHANGED); 00332 } 00333 00334 if (from->fields_present & ACCT_LAST_PWD_CHANGE) { 00335 unix_time=nt_time_to_unix(from->pass_last_set_time); 00336 stored_time = pdb_get_pass_last_set_time(to); 00337 DEBUG(10,("INFO_23 PASS_LAST_SET: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 00338 if (stored_time != unix_time) 00339 pdb_set_pass_last_set_time(to, unix_time, PDB_CHANGED); 00340 } 00341 00342 /* Backend should check this for sanity */ 00343 if ((from->fields_present & ACCT_USERNAME) && 00344 (from->hdr_user_name.buffer)) { 00345 old_string = pdb_get_username(to); 00346 new_string = unistr2_static(&from->uni_user_name); 00347 DEBUG(10,("INFO_23 UNI_USER_NAME: %s -> %s\n", old_string, new_string)); 00348 if (STRING_CHANGED) 00349 pdb_set_username(to , new_string, PDB_CHANGED); 00350 } 00351 00352 if ((from->fields_present & ACCT_FULL_NAME) && 00353 (from->hdr_full_name.buffer)) { 00354 old_string = pdb_get_fullname(to); 00355 new_string = unistr2_static(&from->uni_full_name); 00356 DEBUG(10,("INFO_23 UNI_FULL_NAME: %s -> %s\n",old_string, new_string)); 00357 if (STRING_CHANGED) 00358 pdb_set_fullname(to , new_string, PDB_CHANGED); 00359 } 00360 00361 if ((from->fields_present & ACCT_HOME_DIR) && 00362 (from->hdr_home_dir.buffer)) { 00363 old_string = pdb_get_homedir(to); 00364 new_string = unistr2_static(&from->uni_home_dir); 00365 DEBUG(10,("INFO_23 UNI_HOME_DIR: %s -> %s\n",old_string,new_string)); 00366 if (STRING_CHANGED) 00367 pdb_set_homedir(to , new_string, PDB_CHANGED); 00368 } 00369 00370 if ((from->fields_present & ACCT_HOME_DRIVE) && 00371 (from->hdr_dir_drive.buffer)) { 00372 old_string = pdb_get_dir_drive(to); 00373 new_string = unistr2_static(&from->uni_dir_drive); 00374 DEBUG(10,("INFO_23 UNI_DIR_DRIVE: %s -> %s\n",old_string,new_string)); 00375 if (STRING_CHANGED) 00376 pdb_set_dir_drive(to , new_string, PDB_CHANGED); 00377 } 00378 00379 if ((from->fields_present & ACCT_LOGON_SCRIPT) && 00380 (from->hdr_logon_script.buffer)) { 00381 old_string = pdb_get_logon_script(to); 00382 new_string = unistr2_static(&from->uni_logon_script); 00383 DEBUG(10,("INFO_23 UNI_LOGON_SCRIPT: %s -> %s\n",old_string,new_string)); 00384 if (STRING_CHANGED) 00385 pdb_set_logon_script(to , new_string, PDB_CHANGED); 00386 } 00387 00388 if ((from->fields_present & ACCT_PROFILE) && 00389 (from->hdr_profile_path.buffer)) { 00390 old_string = pdb_get_profile_path(to); 00391 new_string = unistr2_static(&from->uni_profile_path); 00392 DEBUG(10,("INFO_23 UNI_PROFILE_PATH: %s -> %s\n",old_string, new_string)); 00393 if (STRING_CHANGED) 00394 pdb_set_profile_path(to , new_string, PDB_CHANGED); 00395 } 00396 00397 if ((from->fields_present & ACCT_DESCRIPTION) && 00398 (from->hdr_acct_desc.buffer)) { 00399 old_string = pdb_get_acct_desc(to); 00400 new_string = unistr2_static(&from->uni_acct_desc); 00401 DEBUG(10,("INFO_23 UNI_ACCT_DESC: %s -> %s\n",old_string,new_string)); 00402 if (STRING_CHANGED) 00403 pdb_set_acct_desc(to , new_string, PDB_CHANGED); 00404 } 00405 00406 if ((from->fields_present & ACCT_WORKSTATIONS) && 00407 (from->hdr_workstations.buffer)) { 00408 old_string = pdb_get_workstations(to); 00409 new_string = unistr2_static(&from->uni_workstations); 00410 DEBUG(10,("INFO_23 UNI_WORKSTATIONS: %s -> %s\n",old_string, new_string)); 00411 if (STRING_CHANGED) 00412 pdb_set_workstations(to , new_string, PDB_CHANGED); 00413 } 00414 00415 if ((from->fields_present & ACCT_COMMENT) && 00416 (from->hdr_comment.buffer)) { 00417 old_string = pdb_get_comment(to); 00418 new_string = unistr2_static(&from->uni_comment); 00419 DEBUG(10,("INFO_23 UNI_UNKNOWN_STR: %s -> %s\n",old_string, new_string)); 00420 if (STRING_CHANGED) 00421 pdb_set_comment(to , new_string, PDB_CHANGED); 00422 } 00423 00424 if ((from->fields_present & ACCT_CALLBACK) && 00425 (from->hdr_munged_dial.buffer)) { 00426 char *newstr; 00427 old_string = pdb_get_munged_dial(to); 00428 mung.length = from->hdr_munged_dial.uni_str_len; 00429 mung.data = (uint8 *) from->uni_munged_dial.buffer; 00430 mung.free = NULL; 00431 newstr = (mung.length == 0) ? 00432 NULL : base64_encode_data_blob(mung); 00433 DEBUG(10,("INFO_23 UNI_MUNGED_DIAL: %s -> %s\n",old_string, newstr)); 00434 if (STRING_CHANGED_NC(old_string, newstr)) 00435 pdb_set_munged_dial(to , newstr, PDB_CHANGED); 00436 00437 SAFE_FREE(newstr); 00438 } 00439 00440 if (from->fields_present & ACCT_RID) { 00441 if (from->user_rid == 0) { 00442 DEBUG(10, ("INFO_23: Asked to set User RID to 0 !? Skipping change!\n")); 00443 } else if (from->user_rid != pdb_get_user_rid(to)) { 00444 DEBUG(10,("INFO_23 USER_RID: %u -> %u NOT UPDATED!\n",pdb_get_user_rid(to),from->user_rid)); 00445 } 00446 } 00447 00448 if (from->fields_present & ACCT_PRIMARY_GID) { 00449 if (from->group_rid == 0) { 00450 DEBUG(10, ("INFO_23: Asked to set Group RID to 0 !? Skipping change!\n")); 00451 } else if (from->group_rid != pdb_get_group_rid(to)) { 00452 DEBUG(10,("INFO_23 GROUP_RID: %u -> %u\n",pdb_get_group_rid(to),from->group_rid)); 00453 pdb_set_group_sid_from_rid(to, from->group_rid, PDB_CHANGED); 00454 } 00455 } 00456 00457 if (from->fields_present & ACCT_FLAGS) { 00458 DEBUG(10,("INFO_23 ACCT_CTRL: %08X -> %08X\n",pdb_get_acct_ctrl(to),from->acb_info)); 00459 if (from->acb_info != pdb_get_acct_ctrl(to)) { 00460 pdb_set_acct_ctrl(to, from->acb_info, PDB_CHANGED); 00461 } 00462 } 00463 00464 if (from->fields_present & ACCT_LOGON_HOURS) { 00465 DEBUG(15,("INFO_23 LOGON_DIVS: %08X -> %08X\n",pdb_get_logon_divs(to),from->logon_divs)); 00466 if (from->logon_divs != pdb_get_logon_divs(to)) { 00467 pdb_set_logon_divs(to, from->logon_divs, PDB_CHANGED); 00468 } 00469 00470 DEBUG(15,("INFO_23 LOGON_HRS.LEN: %08X -> %08X\n",pdb_get_hours_len(to),from->logon_hrs.len)); 00471 if (from->logon_hrs.len != pdb_get_hours_len(to)) { 00472 pdb_set_hours_len(to, from->logon_hrs.len, PDB_CHANGED); 00473 } 00474 00475 DEBUG(15,("INFO_23 LOGON_HRS.HOURS: %s -> %s\n",pdb_get_hours(to),from->logon_hrs.hours)); 00476 /* Fix me: only update if it changes --metze */ 00477 pdb_set_hours(to, from->logon_hrs.hours, PDB_CHANGED); 00478 } 00479 00480 if (from->fields_present & ACCT_BAD_PWD_COUNT) { 00481 DEBUG(10,("INFO_23 BAD_PASSWORD_COUNT: %08X -> %08X\n",pdb_get_bad_password_count(to),from->bad_password_count)); 00482 if (from->bad_password_count != pdb_get_bad_password_count(to)) { 00483 pdb_set_bad_password_count(to, from->bad_password_count, PDB_CHANGED); 00484 } 00485 } 00486 00487 if (from->fields_present & ACCT_NUM_LOGONS) { 00488 DEBUG(10,("INFO_23 LOGON_COUNT: %08X -> %08X\n",pdb_get_logon_count(to),from->logon_count)); 00489 if (from->logon_count != pdb_get_logon_count(to)) { 00490 pdb_set_logon_count(to, from->logon_count, PDB_CHANGED); 00491 } 00492 } 00493 00494 /* If the must change flag is set, the last set time goes to zero. 00495 the must change and can change fields also do, but they are 00496 calculated from policy, not set from the wire */ 00497 00498 if (from->fields_present & ACCT_EXPIRED_FLAG) { 00499 DEBUG(10,("INFO_23 PASS_MUST_CHANGE_AT_NEXT_LOGON: %02X\n",from->passmustchange)); 00500 if (from->passmustchange == PASS_MUST_CHANGE_AT_NEXT_LOGON) { 00501 pdb_set_pass_last_set_time(to, 0, PDB_CHANGED); 00502 } else { 00503 /* A subtlety here: some windows commands will 00504 clear the expired flag even though it's not 00505 set, and we don't want to reset the time 00506 in these caess. "net user /dom <user> /active:y" 00507 for example, to clear an autolocked acct. 00508 We must check to see if it's expired first. jmcd */ 00509 stored_time = pdb_get_pass_last_set_time(to); 00510 if (stored_time == 0) 00511 pdb_set_pass_last_set_time(to, time(NULL),PDB_CHANGED); 00512 } 00513 } 00514 00515 DEBUG(10,("INFO_23 PADDING_2: %02X\n",from->padding2)); 00516 }
void copy_id25_to_sam_passwd | ( | struct samu * | to, | |
SAM_USER_INFO_25 * | from | |||
) |
srv_samr_util.c の 522 行で定義されています。
参照先 base64_encode_data_blob()・data_blob_::data・data_blob_::free・from・data_blob_::length・nt_time_to_unix()・PDB_CHANGED・pdb_get_acct_ctrl()・pdb_get_acct_desc()・pdb_get_bad_password_count()・pdb_get_comment()・pdb_get_dir_drive()・pdb_get_fullname()・pdb_get_group_rid()・pdb_get_homedir()・pdb_get_hours()・pdb_get_hours_len()・pdb_get_kickoff_time()・pdb_get_logoff_time()・pdb_get_logon_count()・pdb_get_logon_divs()・pdb_get_logon_script()・pdb_get_logon_time()・pdb_get_munged_dial()・pdb_get_pass_last_set_time()・pdb_get_profile_path()・pdb_get_user_rid()・pdb_get_username()・pdb_get_workstations()・pdb_set_acct_ctrl()・pdb_set_acct_desc()・pdb_set_bad_password_count()・pdb_set_bad_password_time()・pdb_set_comment()・pdb_set_dir_drive()・pdb_set_fullname()・pdb_set_group_sid_from_rid()・pdb_set_homedir()・pdb_set_hours()・pdb_set_hours_len()・pdb_set_kickoff_time()・pdb_set_logoff_time()・pdb_set_logon_count()・pdb_set_logon_divs()・pdb_set_logon_script()・pdb_set_logon_time()・pdb_set_munged_dial()・pdb_set_pass_last_set_time()・pdb_set_profile_path()・pdb_set_username()・pdb_set_workstations()・to・unistr2_static().
参照元 set_user_info_25().
00523 { 00524 time_t unix_time, stored_time; 00525 const char *old_string, *new_string; 00526 DATA_BLOB mung; 00527 00528 if (from == NULL || to == NULL) 00529 return; 00530 00531 if (from->fields_present & ACCT_LAST_LOGON) { 00532 unix_time=nt_time_to_unix(from->logon_time); 00533 stored_time = pdb_get_logon_time(to); 00534 DEBUG(10,("INFO_25 LOGON_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 00535 if (stored_time != unix_time) 00536 pdb_set_logon_time(to, unix_time, PDB_CHANGED); 00537 } 00538 00539 if (from->fields_present & ACCT_LAST_LOGOFF) { 00540 unix_time=nt_time_to_unix(from->logoff_time); 00541 stored_time = pdb_get_logoff_time(to); 00542 DEBUG(10,("INFO_25 LOGOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 00543 if (stored_time != unix_time) 00544 pdb_set_logoff_time(to, unix_time, PDB_CHANGED); 00545 } 00546 00547 if (from->fields_present & ACCT_EXPIRY) { 00548 unix_time=nt_time_to_unix(from->kickoff_time); 00549 stored_time = pdb_get_kickoff_time(to); 00550 DEBUG(10,("INFO_25 KICKOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 00551 if (stored_time != unix_time) 00552 pdb_set_kickoff_time(to, unix_time , PDB_CHANGED); 00553 } 00554 00555 if (from->fields_present & ACCT_LAST_PWD_CHANGE) { 00556 unix_time=nt_time_to_unix(from->pass_last_set_time); 00557 stored_time = pdb_get_pass_last_set_time(to); 00558 DEBUG(10,("INFO_25 PASS_LAST_SET: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); 00559 if (stored_time != unix_time) 00560 pdb_set_pass_last_set_time(to, unix_time, PDB_CHANGED); 00561 } 00562 00563 if ((from->fields_present & ACCT_USERNAME) && 00564 (from->hdr_user_name.buffer)) { 00565 old_string = pdb_get_username(to); 00566 new_string = unistr2_static(&from->uni_user_name); 00567 DEBUG(10,("INFO_25 UNI_USER_NAME: %s -> %s\n", old_string, new_string)); 00568 if (STRING_CHANGED) 00569 pdb_set_username(to , new_string, PDB_CHANGED); 00570 } 00571 00572 if ((from->fields_present & ACCT_FULL_NAME) && 00573 (from->hdr_full_name.buffer)) { 00574 old_string = pdb_get_fullname(to); 00575 new_string = unistr2_static(&from->uni_full_name); 00576 DEBUG(10,("INFO_25 UNI_FULL_NAME: %s -> %s\n",old_string, new_string)); 00577 if (STRING_CHANGED) 00578 pdb_set_fullname(to , new_string, PDB_CHANGED); 00579 } 00580 00581 if ((from->fields_present & ACCT_HOME_DIR) && 00582 (from->hdr_home_dir.buffer)) { 00583 old_string = pdb_get_homedir(to); 00584 new_string = unistr2_static(&from->uni_home_dir); 00585 DEBUG(10,("INFO_25 UNI_HOME_DIR: %s -> %s\n",old_string,new_string)); 00586 if (STRING_CHANGED) 00587 pdb_set_homedir(to , new_string, PDB_CHANGED); 00588 } 00589 00590 if ((from->fields_present & ACCT_HOME_DRIVE) && 00591 (from->hdr_dir_drive.buffer)) { 00592 old_string = pdb_get_dir_drive(to); 00593 new_string = unistr2_static(&from->uni_dir_drive); 00594 DEBUG(10,("INFO_25 UNI_DIR_DRIVE: %s -> %s\n",old_string,new_string)); 00595 if (STRING_CHANGED) 00596 pdb_set_dir_drive(to , new_string, PDB_CHANGED); 00597 } 00598 00599 if ((from->fields_present & ACCT_LOGON_SCRIPT) && 00600 (from->hdr_logon_script.buffer)) { 00601 old_string = pdb_get_logon_script(to); 00602 new_string = unistr2_static(&from->uni_logon_script); 00603 DEBUG(10,("INFO_25 UNI_LOGON_SCRIPT: %s -> %s\n",old_string,new_string)); 00604 if (STRING_CHANGED) 00605 pdb_set_logon_script(to , new_string, PDB_CHANGED); 00606 } 00607 00608 if ((from->fields_present & ACCT_PROFILE) && 00609 (from->hdr_profile_path.buffer)) { 00610 old_string = pdb_get_profile_path(to); 00611 new_string = unistr2_static(&from->uni_profile_path); 00612 DEBUG(10,("INFO_25 UNI_PROFILE_PATH: %s -> %s\n",old_string, new_string)); 00613 if (STRING_CHANGED) 00614 pdb_set_profile_path(to , new_string, PDB_CHANGED); 00615 } 00616 00617 if ((from->fields_present & ACCT_DESCRIPTION) && 00618 (from->hdr_acct_desc.buffer)) { 00619 old_string = pdb_get_acct_desc(to); 00620 new_string = unistr2_static(&from->uni_acct_desc); 00621 DEBUG(10,("INFO_25 UNI_ACCT_DESC: %s -> %s\n",old_string,new_string)); 00622 if (STRING_CHANGED) 00623 pdb_set_acct_desc(to , new_string, PDB_CHANGED); 00624 } 00625 00626 if ((from->fields_present & ACCT_WORKSTATIONS) && 00627 (from->hdr_workstations.buffer)) { 00628 old_string = pdb_get_workstations(to); 00629 new_string = unistr2_static(&from->uni_workstations); 00630 DEBUG(10,("INFO_25 UNI_WORKSTATIONS: %s -> %s\n",old_string, new_string)); 00631 if (STRING_CHANGED) 00632 pdb_set_workstations(to , new_string, PDB_CHANGED); 00633 } 00634 00635 if ((from->fields_present & ACCT_COMMENT) && 00636 (from->hdr_comment.buffer)) { 00637 old_string = pdb_get_comment(to); 00638 new_string = unistr2_static(&from->uni_comment); 00639 DEBUG(10,("INFO_25 UNI_UNKNOWN_STR: %s -> %s\n",old_string, new_string)); 00640 if (STRING_CHANGED) 00641 pdb_set_comment(to , new_string, PDB_CHANGED); 00642 } 00643 00644 if ((from->fields_present & ACCT_CALLBACK) && 00645 (from->hdr_munged_dial.buffer)) { 00646 char *newstr; 00647 old_string = pdb_get_munged_dial(to); 00648 mung.length = from->hdr_munged_dial.uni_str_len; 00649 mung.data = (uint8 *) from->uni_munged_dial.buffer; 00650 mung.free = NULL; 00651 newstr = (mung.length == 0) ? 00652 NULL : base64_encode_data_blob(mung); 00653 DEBUG(10,("INFO_25 UNI_MUNGED_DIAL: %s -> %s\n",old_string, newstr)); 00654 if (STRING_CHANGED_NC(old_string,newstr)) 00655 pdb_set_munged_dial(to , newstr, PDB_CHANGED); 00656 00657 SAFE_FREE(newstr); 00658 } 00659 00660 if (from->fields_present & ACCT_RID) { 00661 if (from->user_rid == 0) { 00662 DEBUG(10, ("INFO_25: Asked to set User RID to 0 !? Skipping change!\n")); 00663 } else if (from->user_rid != pdb_get_user_rid(to)) { 00664 DEBUG(10,("INFO_25 USER_RID: %u -> %u NOT UPDATED!\n",pdb_get_user_rid(to),from->user_rid)); 00665 } 00666 } 00667 00668 if (from->fields_present & ACCT_PRIMARY_GID) { 00669 if (from->group_rid == 0) { 00670 DEBUG(10, ("INFO_25: Asked to set Group RID to 0 !? Skipping change!\n")); 00671 } else if (from->group_rid != pdb_get_group_rid(to)) { 00672 DEBUG(10,("INFO_25 GROUP_RID: %u -> %u\n",pdb_get_group_rid(to),from->group_rid)); 00673 pdb_set_group_sid_from_rid(to, from->group_rid, PDB_CHANGED); 00674 } 00675 } 00676 00677 if (from->fields_present & ACCT_FLAGS) { 00678 DEBUG(10,("INFO_25 ACCT_CTRL: %08X -> %08X\n",pdb_get_acct_ctrl(to),from->acb_info)); 00679 if (from->acb_info != pdb_get_acct_ctrl(to)) { 00680 if (!(from->acb_info & ACB_AUTOLOCK) && (pdb_get_acct_ctrl(to) & ACB_AUTOLOCK)) { 00681 /* We're unlocking a previously locked user. Reset bad password counts. 00682 Patch from Jianliang Lu. <Jianliang.Lu@getronics.com> */ 00683 pdb_set_bad_password_count(to, 0, PDB_CHANGED); 00684 pdb_set_bad_password_time(to, 0, PDB_CHANGED); 00685 } 00686 pdb_set_acct_ctrl(to, from->acb_info, PDB_CHANGED); 00687 } 00688 } 00689 00690 if (from->fields_present & ACCT_LOGON_HOURS) { 00691 DEBUG(15,("INFO_25 LOGON_DIVS: %08X -> %08X\n",pdb_get_logon_divs(to),from->logon_divs)); 00692 if (from->logon_divs != pdb_get_logon_divs(to)) { 00693 pdb_set_logon_divs(to, from->logon_divs, PDB_CHANGED); 00694 } 00695 00696 DEBUG(15,("INFO_25 LOGON_HRS.LEN: %08X -> %08X\n",pdb_get_hours_len(to),from->logon_hrs.len)); 00697 if (from->logon_hrs.len != pdb_get_hours_len(to)) { 00698 pdb_set_hours_len(to, from->logon_hrs.len, PDB_CHANGED); 00699 } 00700 00701 DEBUG(15,("INFO_25 LOGON_HRS.HOURS: %s -> %s\n",pdb_get_hours(to),from->logon_hrs.hours)); 00702 /* Fix me: only update if it changes --metze */ 00703 pdb_set_hours(to, from->logon_hrs.hours, PDB_CHANGED); 00704 } 00705 00706 if (from->fields_present & ACCT_BAD_PWD_COUNT) { 00707 DEBUG(10,("INFO_25 BAD_PASSWORD_COUNT: %08X -> %08X\n",pdb_get_bad_password_count(to),from->bad_password_count)); 00708 if (from->bad_password_count != pdb_get_bad_password_count(to)) { 00709 pdb_set_bad_password_count(to, from->bad_password_count, PDB_CHANGED); 00710 } 00711 } 00712 00713 if (from->fields_present & ACCT_NUM_LOGONS) { 00714 DEBUG(10,("INFO_25 LOGON_COUNT: %08X -> %08X\n",pdb_get_logon_count(to),from->logon_count)); 00715 if (from->logon_count != pdb_get_logon_count(to)) { 00716 pdb_set_logon_count(to, from->logon_count, PDB_CHANGED); 00717 } 00718 } 00719 00720 /* If the must change flag is set, the last set time goes to zero. 00721 the must change and can change fields also do, but they are 00722 calculated from policy, not set from the wire */ 00723 00724 if (from->fields_present & ACCT_EXPIRED_FLAG) { 00725 DEBUG(10,("INFO_25 PASS_MUST_CHANGE_AT_NEXT_LOGON: %02X\n",from->passmustchange)); 00726 if (from->passmustchange == PASS_MUST_CHANGE_AT_NEXT_LOGON) { 00727 pdb_set_pass_last_set_time(to, 0, PDB_CHANGED); 00728 } else { 00729 /* A subtlety here: some windows commands will 00730 clear the expired flag even though it's not 00731 set, and we don't want to reset the time 00732 in these caess. "net user /dom <user> /active:y" 00733 for example, to clear an autolocked acct. 00734 We must check to see if it's expired first. jmcd */ 00735 stored_time = pdb_get_pass_last_set_time(to); 00736 if (stored_time == 0) 00737 pdb_set_pass_last_set_time(to, time(NULL),PDB_CHANGED); 00738 } 00739 } 00740 }