diff options
author | Günther Deschner <gd@samba.org> | 2008-02-11 22:47:49 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-02-11 22:50:07 +0100 |
commit | 326477e522b99eaa2b6bd636582d4fece6906d62 (patch) | |
tree | 588d99d5f155507bcafc28c8b4f6dde62f18601a | |
parent | 6bb6af65abfced64576d990b5f734d61130b3d77 (diff) | |
download | samba-326477e522b99eaa2b6bd636582d4fece6906d62.tar.gz samba-326477e522b99eaa2b6bd636582d4fece6906d62.tar.bz2 samba-326477e522b99eaa2b6bd636582d4fece6906d62.zip |
Allow to set correct info level log prefix in duplicates of copy_id21_to_sam_passwd.
Guenther
(This used to be commit 118e166c003a931884c662423e1e280a5be3eb48)
-rw-r--r-- | source3/rpc_server/srv_samr_nt.c | 2 | ||||
-rw-r--r-- | source3/rpc_server/srv_samr_util.c | 76 |
2 files changed, 45 insertions, 33 deletions
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index cb5bfe5440..6efea1a754 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -3309,7 +3309,7 @@ static NTSTATUS set_user_info_21(TALLOC_CTX *mem_ctx, pdb_set_username(pwd, id21->account_name.string, PDB_SET); } - copy_id21_to_sam_passwd(pwd, id21); + copy_id21_to_sam_passwd("INFO_21", pwd, id21); /* * The funny part about the previous two calls is diff --git a/source3/rpc_server/srv_samr_util.c b/source3/rpc_server/srv_samr_util.c index a6c0e7b448..1d759aac22 100644 --- a/source3/rpc_server/srv_samr_util.c +++ b/source3/rpc_server/srv_samr_util.c @@ -69,20 +69,29 @@ void copy_id20_to_sam_passwd(struct samu *to, Copies a struct samr_UserInfo21 to a struct samu **************************************************************/ -void copy_id21_to_sam_passwd(struct samu *to, +void copy_id21_to_sam_passwd(const char *log_prefix, + struct samu *to, struct samr_UserInfo21 *from) { time_t unix_time, stored_time; const char *old_string, *new_string; DATA_BLOB mung; + const char *l; - if (from == NULL || to == NULL) + if (from == NULL || to == NULL) { return; + } + + if (log_prefix) { + l = log_prefix; + } else { + l = "INFO_21"; + } if (from->fields_present & ACCT_LAST_LOGON) { unix_time=nt_time_to_unix(from->last_logon); stored_time = pdb_get_logon_time(to); - DEBUG(10,("INFO_21 LOGON_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); + DEBUG(10,("%s LOGON_TIME: %lu -> %lu\n", l, (long unsigned int)stored_time, (long unsigned int)unix_time)); if (stored_time != unix_time) pdb_set_logon_time(to, unix_time, PDB_CHANGED); } @@ -90,7 +99,7 @@ void copy_id21_to_sam_passwd(struct samu *to, if (from->fields_present & ACCT_LAST_LOGOFF) { unix_time=nt_time_to_unix(from->last_logoff); stored_time = pdb_get_logoff_time(to); - DEBUG(10,("INFO_21 LOGOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); + DEBUG(10,("%s LOGOFF_TIME: %lu -> %lu\n", l, (long unsigned int)stored_time, (long unsigned int)unix_time)); if (stored_time != unix_time) pdb_set_logoff_time(to, unix_time, PDB_CHANGED); } @@ -98,7 +107,7 @@ void copy_id21_to_sam_passwd(struct samu *to, if (from->fields_present & ACCT_EXPIRY) { unix_time=nt_time_to_unix(from->acct_expiry); stored_time = pdb_get_kickoff_time(to); - DEBUG(10,("INFO_21 KICKOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); + DEBUG(10,("%s KICKOFF_TIME: %lu -> %lu\n", l, (long unsigned int)stored_time, (long unsigned int)unix_time)); if (stored_time != unix_time) pdb_set_kickoff_time(to, unix_time , PDB_CHANGED); } @@ -106,7 +115,7 @@ void copy_id21_to_sam_passwd(struct samu *to, if (from->fields_present & ACCT_LAST_PWD_CHANGE) { unix_time=nt_time_to_unix(from->last_password_change); stored_time = pdb_get_pass_last_set_time(to); - DEBUG(10,("INFO_21 PASS_LAST_SET: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time)); + DEBUG(10,("%s PASS_LAST_SET: %lu -> %lu\n", l, (long unsigned int)stored_time, (long unsigned int)unix_time)); if (stored_time != unix_time) pdb_set_pass_last_set_time(to, unix_time, PDB_CHANGED); } @@ -115,7 +124,7 @@ void copy_id21_to_sam_passwd(struct samu *to, (from->account_name.string)) { old_string = pdb_get_username(to); new_string = from->account_name.string; - DEBUG(10,("INFO_21 UNI_USER_NAME: %s -> %s\n", old_string, new_string)); + DEBUG(10,("%s UNI_USER_NAME: %s -> %s\n", l, old_string, new_string)); if (STRING_CHANGED) pdb_set_username(to , new_string, PDB_CHANGED); } @@ -124,7 +133,7 @@ void copy_id21_to_sam_passwd(struct samu *to, (from->full_name.string)) { old_string = pdb_get_fullname(to); new_string = from->full_name.string; - DEBUG(10,("INFO_21 UNI_FULL_NAME: %s -> %s\n",old_string, new_string)); + DEBUG(10,("%s UNI_FULL_NAME: %s -> %s\n", l, old_string, new_string)); if (STRING_CHANGED) pdb_set_fullname(to , new_string, PDB_CHANGED); } @@ -133,7 +142,7 @@ void copy_id21_to_sam_passwd(struct samu *to, (from->home_directory.string)) { old_string = pdb_get_homedir(to); new_string = from->home_directory.string; - DEBUG(10,("INFO_21 UNI_HOME_DIR: %s -> %s\n",old_string,new_string)); + DEBUG(10,("%s UNI_HOME_DIR: %s -> %s\n", l, old_string, new_string)); if (STRING_CHANGED) pdb_set_homedir(to , new_string, PDB_CHANGED); } @@ -142,7 +151,7 @@ void copy_id21_to_sam_passwd(struct samu *to, (from->home_drive.string)) { old_string = pdb_get_dir_drive(to); new_string = from->home_drive.string; - DEBUG(10,("INFO_21 UNI_DIR_DRIVE: %s -> %s\n",old_string,new_string)); + DEBUG(10,("%s UNI_DIR_DRIVE: %s -> %s\n", l, old_string, new_string)); if (STRING_CHANGED) pdb_set_dir_drive(to , new_string, PDB_CHANGED); } @@ -151,7 +160,7 @@ void copy_id21_to_sam_passwd(struct samu *to, (from->logon_script.string)) { old_string = pdb_get_logon_script(to); new_string = from->logon_script.string; - DEBUG(10,("INFO_21 UNI_LOGON_SCRIPT: %s -> %s\n",old_string,new_string)); + DEBUG(10,("%s UNI_LOGON_SCRIPT: %s -> %s\n", l, old_string, new_string)); if (STRING_CHANGED) pdb_set_logon_script(to , new_string, PDB_CHANGED); } @@ -160,7 +169,7 @@ void copy_id21_to_sam_passwd(struct samu *to, (from->profile_path.string)) { old_string = pdb_get_profile_path(to); new_string = from->profile_path.string; - DEBUG(10,("INFO_21 UNI_PROFILE_PATH: %s -> %s\n",old_string, new_string)); + DEBUG(10,("%s UNI_PROFILE_PATH: %s -> %s\n", l, old_string, new_string)); if (STRING_CHANGED) pdb_set_profile_path(to , new_string, PDB_CHANGED); } @@ -169,7 +178,7 @@ void copy_id21_to_sam_passwd(struct samu *to, (from->description.string)) { old_string = pdb_get_acct_desc(to); new_string = from->description.string; - DEBUG(10,("INFO_21 UNI_ACCT_DESC: %s -> %s\n",old_string,new_string)); + DEBUG(10,("%s UNI_ACCT_DESC: %s -> %s\n", l, old_string, new_string)); if (STRING_CHANGED) pdb_set_acct_desc(to , new_string, PDB_CHANGED); } @@ -178,7 +187,7 @@ void copy_id21_to_sam_passwd(struct samu *to, (from->workstations.string)) { old_string = pdb_get_workstations(to); new_string = from->workstations.string; - DEBUG(10,("INFO_21 UNI_WORKSTATIONS: %s -> %s\n",old_string, new_string)); + DEBUG(10,("%s UNI_WORKSTATIONS: %s -> %s\n", l, old_string, new_string)); if (STRING_CHANGED) pdb_set_workstations(to , new_string, PDB_CHANGED); } @@ -187,7 +196,7 @@ void copy_id21_to_sam_passwd(struct samu *to, (from->comment.string)) { old_string = pdb_get_comment(to); new_string = from->comment.string; - DEBUG(10,("INFO_21 UNI_COMMENT: %s -> %s\n",old_string, new_string)); + DEBUG(10,("%s UNI_COMMENT: %s -> %s\n", l, old_string, new_string)); if (STRING_CHANGED) pdb_set_comment(to, new_string, PDB_CHANGED); } @@ -202,7 +211,7 @@ void copy_id21_to_sam_passwd(struct samu *to, mung.free = NULL; newstr = (mung.length == 0) ? NULL : base64_encode_data_blob(talloc_tos(), mung); - DEBUG(10,("INFO_21 UNI_MUNGED_DIAL: %s -> %s\n",old_string, newstr)); + DEBUG(10,("%s UNI_MUNGED_DIAL: %s -> %s\n", l, old_string, newstr)); if (STRING_CHANGED_NC(old_string,newstr)) pdb_set_munged_dial(to , newstr, PDB_CHANGED); @@ -211,23 +220,23 @@ void copy_id21_to_sam_passwd(struct samu *to, #endif if (from->fields_present & ACCT_RID) { if (from->rid == 0) { - DEBUG(10, ("INFO_21: Asked to set User RID to 0 !? Skipping change!\n")); + DEBUG(10, ("%s: Asked to set User RID to 0 !? Skipping change!\n", l)); } else if (from->rid != pdb_get_user_rid(to)) { - DEBUG(10,("INFO_21 USER_RID: %u -> %u NOT UPDATED!\n",pdb_get_user_rid(to),from->rid)); + DEBUG(10,("%s USER_RID: %u -> %u NOT UPDATED!\n", l, pdb_get_user_rid(to), from->rid)); } } if (from->fields_present & ACCT_PRIMARY_GID) { if (from->primary_gid == 0) { - DEBUG(10, ("INFO_21: Asked to set Group RID to 0 !? Skipping change!\n")); + DEBUG(10, ("%s: Asked to set Group RID to 0 !? Skipping change!\n", l)); } else if (from->primary_gid != pdb_get_group_rid(to)) { - DEBUG(10,("INFO_21 GROUP_RID: %u -> %u\n",pdb_get_group_rid(to),from->primary_gid)); + DEBUG(10,("%s GROUP_RID: %u -> %u\n", l, pdb_get_group_rid(to), from->primary_gid)); pdb_set_group_sid_from_rid(to, from->primary_gid, PDB_CHANGED); } } if (from->fields_present & ACCT_FLAGS) { - DEBUG(10,("INFO_21 ACCT_CTRL: %08X -> %08X\n",pdb_get_acct_ctrl(to),from->acct_flags)); + DEBUG(10,("%s ACCT_CTRL: %08X -> %08X\n", l, pdb_get_acct_ctrl(to), from->acct_flags)); if (from->acct_flags != pdb_get_acct_ctrl(to)) { if (!(from->acct_flags & ACB_AUTOLOCK) && (pdb_get_acct_ctrl(to) & ACB_AUTOLOCK)) { /* We're unlocking a previously locked user. Reset bad password counts. @@ -238,37 +247,39 @@ void copy_id21_to_sam_passwd(struct samu *to, pdb_set_acct_ctrl(to, from->acct_flags, PDB_CHANGED); } } -#if 0 + +// LOGON_HRS +// struct samr_LogonHours logon_hours; if (from->fields_present & ACCT_LOGON_HOURS) { char oldstr[44]; /* hours strings are 42 bytes. */ char newstr[44]; - DEBUG(15,("INFO_21 LOGON_DIVS: %08X -> %08X\n",pdb_get_logon_divs(to),from->logon_divs)); + DEBUG(15,("%s LOGON_DIVS: %08X -> %08X\n", l, pdb_get_logon_divs(to), from->logon_divs)); if (from->logon_divs != pdb_get_logon_divs(to)) { pdb_set_logon_divs(to, from->logon_divs, PDB_CHANGED); } - DEBUG(15,("INFO_21 LOGON_HRS.LEN: %08X -> %08X\n",pdb_get_hours_len(to),from->logon_hrs.len)); + DEBUG(15,("%s LOGON_HRS.LEN: %08X -> %08X\n", l, pdb_get_hours_len(to), from->logon_hrs.len)); if (from->logon_hrs.len != pdb_get_hours_len(to)) { pdb_set_hours_len(to, from->logon_hrs.len, PDB_CHANGED); } - DEBUG(15,("INFO_21 LOGON_HRS.HOURS: %s -> %s\n",pdb_get_hours(to),from->logon_hrs.hours)); + DEBUG(15,("%s LOGON_HRS.HOURS: %s -> %s\n", l, pdb_get_hours(to), from->logon_hrs.hours)); pdb_sethexhours(oldstr, pdb_get_hours(to)); pdb_sethexhours(newstr, from->logon_hrs.hours); if (!strequal(oldstr, newstr)) { pdb_set_hours(to, from->logon_hrs.hours, PDB_CHANGED); } } -#endif + if (from->fields_present & ACCT_BAD_PWD_COUNT) { - DEBUG(10,("INFO_21 BAD_PASSWORD_COUNT: %08X -> %08X\n",pdb_get_bad_password_count(to),from->bad_password_count)); + DEBUG(10,("%s BAD_PASSWORD_COUNT: %08X -> %08X\n", l, pdb_get_bad_password_count(to), from->bad_password_count)); if (from->bad_password_count != pdb_get_bad_password_count(to)) { pdb_set_bad_password_count(to, from->bad_password_count, PDB_CHANGED); } } if (from->fields_present & ACCT_NUM_LOGONS) { - DEBUG(10,("INFO_21 LOGON_COUNT: %08X -> %08X\n", pdb_get_logon_count(to), from->logon_count)); + DEBUG(10,("%s LOGON_COUNT: %08X -> %08X\n", l, pdb_get_logon_count(to), from->logon_count)); if (from->logon_count != pdb_get_logon_count(to)) { pdb_set_logon_count(to, from->logon_count, PDB_CHANGED); } @@ -279,7 +290,7 @@ void copy_id21_to_sam_passwd(struct samu *to, calculated from policy, not set from the wire */ if (from->fields_present & ACCT_EXPIRED_FLAG) { - DEBUG(10,("INFO_21 PASS_MUST_CHANGE_AT_NEXT_LOGON: %02X\n", from->password_expired)); + DEBUG(10,("%s PASS_MUST_CHANGE_AT_NEXT_LOGON: %02X\n", l, from->password_expired)); if (from->password_expired == PASS_MUST_CHANGE_AT_NEXT_LOGON) { pdb_set_pass_last_set_time(to, 0, PDB_CHANGED); } else { @@ -299,7 +310,7 @@ void copy_id23_to_sam_passwd(struct samu *to, if (from == NULL || to == NULL) return; - copy_id21_to_sam_passwd(to, &from->info); + copy_id21_to_sam_passwd("INFO 23", to, &from->info); } /************************************************************* @@ -309,8 +320,9 @@ void copy_id23_to_sam_passwd(struct samu *to, void copy_id25_to_sam_passwd(struct samu *to, struct samr_UserInfo25 *from) { - if (from == NULL || to == NULL) + if (from == NULL || to == NULL) { return; + } - copy_id21_to_sam_passwd(to, &from->info); + copy_id21_to_sam_passwd("INFO_25", to, &from->info); } |