diff options
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r-- | source3/rpc_parse/parse_net.c | 94 | ||||
-rw-r--r-- | source3/rpc_parse/parse_samr.c | 121 |
2 files changed, 108 insertions, 107 deletions
diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 0d8f33f9cb..904f3f3612 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1005,64 +1005,62 @@ static BOOL smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int d Init *************************************************************************/ -void init_net_user_info3(NET_USER_INFO_3 *usr, - - NTTIME *logon_time, - NTTIME *logoff_time, - NTTIME *kickoff_time, - NTTIME *pass_last_set_time, - NTTIME *pass_can_change_time, - NTTIME *pass_must_change_time, - - char *user_name, - char *full_name, - char *logon_script, - char *profile_path, - char *home_dir, - char *dir_drive, - - uint16 logon_count, - uint16 bad_pw_count, - - uint32 user_id, - uint32 group_id, - uint32 num_groups, - DOM_GID *gids, - uint32 user_flgs, - - char *sess_key, - - char *logon_srv, - char *logon_dom, - - DOM_SID *dom_sid, - char *other_sids) +void init_net_user_info3(NET_USER_INFO_3 *usr, SAM_ACCOUNT *sampw, + uint16 logon_count, uint16 bad_pw_count, + uint32 num_groups, DOM_GID *gids, + uint32 user_flgs, char *sess_key, + char *logon_srv, char *logon_dom, + DOM_SID *dom_sid, char *other_sids) { /* only cope with one "other" sid, right now. */ /* need to count the number of space-delimited sids */ int i; int num_other_sids = 0; - - int len_user_name = strlen(user_name ); - int len_full_name = strlen(full_name ); - int len_logon_script = strlen(logon_script); - int len_profile_path = strlen(profile_path); - int len_home_dir = strlen(home_dir ); - int len_dir_drive = strlen(dir_drive ); + + NTTIME logon_time, logoff_time, kickoff_time, + pass_last_set_time, pass_can_change_time, + pass_must_change_time; + + int len_user_name, len_full_name, len_home_dir, + len_dir_drive, len_logon_script, len_profile_path; + + char* user_name = pdb_get_username(sampw); + char* full_name = pdb_get_fullname(sampw); + char* home_dir = pdb_get_homedir(sampw); + char* dir_drive = pdb_get_dirdrive(sampw); + char* logon_script = pdb_get_logon_script(sampw); + char* profile_path = pdb_get_profile_path(sampw); int len_logon_srv = strlen(logon_srv); int len_logon_dom = strlen(logon_dom); - memset(usr, '\0', sizeof(*usr)); + len_user_name = user_name != NULL ? strlen(user_name )+1 : 0; + len_full_name = full_name != NULL ? strlen(full_name )+1 : 0; + len_home_dir = home_dir != NULL ? strlen(home_dir )+1 : 0; + len_dir_drive = dir_drive != NULL ? strlen(dir_drive )+1 : 0; + len_logon_script = logon_script != NULL ? strlen(logon_script)+1 : 0; + len_profile_path = profile_path != NULL ? strlen(profile_path)+1 : 0; + + + ZERO_STRUCTP(usr); usr->ptr_user_info = 1; /* yes, we're bothering to put USER_INFO data here */ - usr->logon_time = *logon_time; - usr->logoff_time = *logoff_time; - usr->kickoff_time = *kickoff_time; - usr->pass_last_set_time = *pass_last_set_time; - usr->pass_can_change_time = *pass_can_change_time; - usr->pass_must_change_time = *pass_must_change_time; + + /* Create NTTIME structs */ + unix_to_nt_time (&logon_time, pdb_get_logon_time(sampw)); + unix_to_nt_time (&logoff_time, pdb_get_logoff_time(sampw)); + unix_to_nt_time (&kickoff_time, pdb_get_kickoff_time(sampw)); + unix_to_nt_time (&pass_last_set_time, pdb_get_pass_last_set_time(sampw)); + unix_to_nt_time (&pass_can_change_time, pdb_get_pass_can_change_time(sampw)); + unix_to_nt_time (&pass_must_change_time,pdb_get_pass_must_change_time(sampw)); + + usr->logon_time = logon_time; + usr->logoff_time = logoff_time; + usr->kickoff_time = kickoff_time; + usr->pass_last_set_time = pass_last_set_time; + usr->pass_can_change_time = pass_can_change_time; + usr->pass_must_change_time = pass_must_change_time; init_uni_hdr(&usr->hdr_user_name, len_user_name); init_uni_hdr(&usr->hdr_full_name, len_full_name); @@ -1074,8 +1072,8 @@ void init_net_user_info3(NET_USER_INFO_3 *usr, usr->logon_count = logon_count; usr->bad_pw_count = bad_pw_count; - usr->user_id = user_id; - usr->group_id = group_id; + usr->user_id = pdb_get_user_rid(sampw); + usr->group_id = pdb_get_group_rid(sampw); usr->num_groups = num_groups; usr->buffer_groups = 1; /* indicates fill in groups, below, even if there are none */ usr->user_flgs = user_flgs; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 6ce20fbefc..2208d76090 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2293,7 +2293,6 @@ BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *p /******************************************************************* Inits a SAMR_R_LOOKUP_NAMES structure. ********************************************************************/ - void init_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u, uint32 num_rids, uint32 *rid, enum SID_NAME_USE *type, uint32 status) { @@ -2958,55 +2957,56 @@ BOOL sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int unknown_3 = 0x00ff ffff unknown_5 = 0x0002 0000 unknown_6 = 0x0000 04ec - *************************************************************************/ -void init_sam_user_info21(SAM_USER_INFO_21 *usr, - NTTIME *logon_time, - NTTIME *logoff_time, - NTTIME *kickoff_time, - NTTIME *pass_last_set_time, - NTTIME *pass_can_change_time, - NTTIME *pass_must_change_time, - - char *user_name, - char *full_name, - char *home_dir, - char *dir_drive, - char *logon_script, - char *profile_path, - char *description, - char *workstations, - char *unknown_str, - char *munged_dial, - - uint32 user_rid, - uint32 group_rid, - uint16 acb_info, - - uint32 unknown_3, - uint16 logon_divs, - LOGON_HRS *hrs, - uint32 unknown_5, - uint32 unknown_6) -{ - int len_user_name = user_name != NULL ? strlen(user_name )+1 : 0; - int len_full_name = full_name != NULL ? strlen(full_name )+1 : 0; - int len_home_dir = home_dir != NULL ? strlen(home_dir )+1 : 0; - int len_dir_drive = dir_drive != NULL ? strlen(dir_drive )+1 : 0; - int len_logon_script = logon_script != NULL ? strlen(logon_script)+1 : 0; - int len_profile_path = profile_path != NULL ? strlen(profile_path)+1 : 0; - int len_description = description != NULL ? strlen(description )+1 : 0; - int len_workstations = workstations != NULL ? strlen(workstations)+1 : 0; - int len_unknown_str = unknown_str != NULL ? strlen(unknown_str )+1 : 0; - int len_munged_dial = munged_dial != NULL ? strlen(munged_dial )+1 : 0; - - usr->logon_time = *logon_time; - usr->logoff_time = *logoff_time; - usr->kickoff_time = *kickoff_time; - usr->pass_last_set_time = *pass_last_set_time; - usr->pass_can_change_time = *pass_can_change_time; - usr->pass_must_change_time = *pass_must_change_time; +void init_sam_user_info21(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw) +{ + NTTIME logon_time, logoff_time, kickoff_time, + pass_last_set_time, pass_can_change_time, + pass_must_change_time; + + int len_user_name, len_full_name, len_home_dir, + len_dir_drive, len_logon_script, len_profile_path, + len_description, len_workstations, len_unknown_str, + len_munged_dial; + + char* user_name = pdb_get_username(pw); + char* full_name = pdb_get_fullname(pw); + char* home_dir = pdb_get_homedir(pw); + char* dir_drive = pdb_get_dirdrive(pw); + char* logon_script = pdb_get_logon_script(pw); + char* profile_path = pdb_get_profile_path(pw); + char* description = pdb_get_acct_desc(pw); + char* workstations = pdb_get_workstations(pw); + char* munged_dial = pdb_get_munged_dial(pw); + + len_user_name = user_name != NULL ? strlen(user_name )+1 : 0; + len_full_name = full_name != NULL ? strlen(full_name )+1 : 0; + len_home_dir = home_dir != NULL ? strlen(home_dir )+1 : 0; + len_dir_drive = dir_drive != NULL ? strlen(dir_drive )+1 : 0; + len_logon_script = logon_script != NULL ? strlen(logon_script)+1 : 0; + len_profile_path = profile_path != NULL ? strlen(profile_path)+1 : 0; + len_description = description != NULL ? strlen(description )+1 : 0; + len_workstations = workstations != NULL ? strlen(workstations)+1 : 0; + len_unknown_str = 0; + len_munged_dial = munged_dial != NULL ? strlen(munged_dial )+1 : 0; + + + /* Create NTTIME structs */ + unix_to_nt_time (&logon_time, pdb_get_logon_time(pw)); + unix_to_nt_time (&logoff_time, pdb_get_logoff_time(pw)); + unix_to_nt_time (&kickoff_time, pdb_get_kickoff_time(pw)); + unix_to_nt_time (&pass_last_set_time, pdb_get_pass_last_set_time(pw)); + unix_to_nt_time (&pass_can_change_time, pdb_get_pass_can_change_time(pw)); + unix_to_nt_time (&pass_must_change_time,pdb_get_pass_must_change_time(pw)); + + /* structure assignment */ + usr->logon_time = logon_time; + usr->logoff_time = logoff_time; + usr->kickoff_time = kickoff_time; + usr->pass_last_set_time = pass_last_set_time; + usr->pass_can_change_time = pass_can_change_time; + usr->pass_must_change_time = pass_must_change_time; init_uni_hdr(&usr->hdr_user_name, len_user_name); init_uni_hdr(&usr->hdr_full_name, len_full_name); @@ -3022,14 +3022,14 @@ void init_sam_user_info21(SAM_USER_INFO_21 *usr, memset((char *)usr->nt_pwd, '\0', sizeof(usr->nt_pwd)); memset((char *)usr->lm_pwd, '\0', sizeof(usr->lm_pwd)); - usr->user_rid = user_rid; - usr->group_rid = group_rid; - usr->acb_info = acb_info; - usr->unknown_3 = unknown_3; /* 0x00ff ffff */ + usr->user_rid = pdb_get_user_rid(pw); + usr->group_rid = pdb_get_group_rid(pw); + usr->acb_info = pdb_get_acct_ctrl(pw); + usr->unknown_3 = pdb_get_unknown3(pw); - usr->logon_divs = logon_divs; /* should be 168 (hours/week) */ - usr->ptr_logon_hrs = hrs ? 1 : 0; - usr->unknown_5 = unknown_5; /* 0x0002 0000 */ + usr->logon_divs = pdb_get_logon_divs(pw); + usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0; + usr->unknown_5 = pdb_get_unknown5(pw); /* 0x0002 0000 */ memset((char *)usr->padding1, '\0', sizeof(usr->padding1)); @@ -3041,14 +3041,17 @@ void init_sam_user_info21(SAM_USER_INFO_21 *usr, init_unistr2(&usr->uni_profile_path, profile_path, len_profile_path); init_unistr2(&usr->uni_acct_desc, description, len_description); init_unistr2(&usr->uni_workstations, workstations, len_workstations); - init_unistr2(&usr->uni_unknown_str, unknown_str, len_unknown_str); + init_unistr2(&usr->uni_unknown_str, NULL, len_unknown_str); init_unistr2(&usr->uni_munged_dial, munged_dial, len_munged_dial); - usr->unknown_6 = unknown_6; /* 0x0000 04ec */ + usr->unknown_6 = pdb_get_unknown6(pw); usr->padding4 = 0; - if (hrs) - memcpy(&(usr->logon_hrs), hrs, sizeof(usr->logon_hrs)); + if (pdb_get_hours(pw)) + { + usr->logon_hrs.len = pdb_get_hours_len(pw); + memcpy(&(usr->logon_hrs.hours), pdb_get_hours(pw), MAX_HOURS_LEN); + } else memset(&(usr->logon_hrs), 0xff, sizeof(usr->logon_hrs)); } |