mirror of
https://github.com/samba-team/samba.git
synced 2025-08-04 08:22:08 +03:00
The final SAM_USER_INFO massacre.
I compared those very thoroughly with the idl ones but couldn't find any bits
that were missing (except for the very obscure (and totally unused)
SAM_USER_INFO_17 structure which I think was totally wrong).
Guenther
(This used to be commit e7192818f7
)
This commit is contained in:
@ -145,306 +145,9 @@ SamrTestPrivateFunctionsUser
|
||||
#define SAMR_CHGPASSWD_USER3 0x3F
|
||||
#define SAMR_CONNECT5 0x40
|
||||
|
||||
typedef struct logon_hours_info
|
||||
{
|
||||
uint32 max_len; /* normally 1260 bytes */
|
||||
uint32 offset;
|
||||
uint32 len; /* normally 21 bytes */
|
||||
uint8 hours[32];
|
||||
|
||||
} LOGON_HRS;
|
||||
|
||||
/* SAM_USER_INFO_23 */
|
||||
typedef struct sam_user_info_23
|
||||
{
|
||||
/* TIMES MAY NOT IN RIGHT ORDER!!!! */
|
||||
NTTIME logon_time; /* logon time */
|
||||
NTTIME logoff_time; /* logoff time */
|
||||
NTTIME kickoff_time; /* kickoff time */
|
||||
NTTIME pass_last_set_time; /* password last set time */
|
||||
NTTIME pass_can_change_time; /* password can change time */
|
||||
NTTIME pass_must_change_time; /* password must change time */
|
||||
|
||||
UNIHDR hdr_user_name; /* NULL - user name unicode string header */
|
||||
UNIHDR hdr_full_name; /* user's full name unicode string header */
|
||||
UNIHDR hdr_home_dir; /* home directory unicode string header */
|
||||
UNIHDR hdr_dir_drive; /* home drive unicode string header */
|
||||
UNIHDR hdr_logon_script; /* logon script unicode string header */
|
||||
UNIHDR hdr_profile_path; /* profile path unicode string header */
|
||||
UNIHDR hdr_acct_desc ; /* user description */
|
||||
UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */
|
||||
UNIHDR hdr_comment;
|
||||
UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
|
||||
|
||||
uint8 lm_pwd[16]; /* lm user passwords */
|
||||
uint8 nt_pwd[16]; /* nt user passwords */
|
||||
|
||||
uint32 user_rid; /* Primary User ID */
|
||||
uint32 group_rid; /* Primary Group ID */
|
||||
|
||||
uint32 acb_info; /* account info (ACB_xxxx bit-mask) */
|
||||
|
||||
uint32 fields_present; /* 0x09f8 27fa */
|
||||
|
||||
uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */
|
||||
/* uint8 pad[2] */
|
||||
uint32 ptr_logon_hrs; /* pointer to logon hours */
|
||||
|
||||
/* Was unknown_5. */
|
||||
uint16 bad_password_count;
|
||||
uint16 logon_count;
|
||||
|
||||
uint8 padding1[6];
|
||||
|
||||
uint8 passmustchange; /* 0x00 must change = 0x01 */
|
||||
|
||||
uint8 padding2;
|
||||
|
||||
uint8 pass[516];
|
||||
|
||||
UNISTR2 uni_user_name; /* NULL - username unicode string */
|
||||
UNISTR2 uni_full_name; /* user's full name unicode string */
|
||||
UNISTR2 uni_home_dir; /* home directory unicode string */
|
||||
UNISTR2 uni_dir_drive; /* home directory drive unicode string */
|
||||
UNISTR2 uni_logon_script; /* logon script unicode string */
|
||||
UNISTR2 uni_profile_path; /* profile path unicode string */
|
||||
UNISTR2 uni_acct_desc ; /* user description unicode string */
|
||||
UNISTR2 uni_workstations; /* login from workstations unicode string */
|
||||
UNISTR2 uni_comment;
|
||||
UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel no */
|
||||
|
||||
LOGON_HRS logon_hrs;
|
||||
|
||||
} SAM_USER_INFO_23;
|
||||
|
||||
/* SAM_USER_INFO_24 */
|
||||
typedef struct sam_user_info_24
|
||||
{
|
||||
uint8 pass[516];
|
||||
uint8 pw_len;
|
||||
} SAM_USER_INFO_24;
|
||||
|
||||
/*
|
||||
* NB. This structure is *definately* incorrect. It's my best guess
|
||||
* currently for W2K SP2. The password field is encrypted in a different
|
||||
* way than normal... And there are definately other problems. JRA.
|
||||
*/
|
||||
|
||||
/* SAM_USER_INFO_25 */
|
||||
typedef struct sam_user_info_25
|
||||
{
|
||||
/* TIMES MAY NOT IN RIGHT ORDER!!!! */
|
||||
NTTIME logon_time; /* logon time */
|
||||
NTTIME logoff_time; /* logoff time */
|
||||
NTTIME kickoff_time; /* kickoff time */
|
||||
NTTIME pass_last_set_time; /* password last set time */
|
||||
NTTIME pass_can_change_time; /* password can change time */
|
||||
NTTIME pass_must_change_time; /* password must change time */
|
||||
|
||||
UNIHDR hdr_user_name; /* NULL - user name unicode string header */
|
||||
UNIHDR hdr_full_name; /* user's full name unicode string header */
|
||||
UNIHDR hdr_home_dir; /* home directory unicode string header */
|
||||
UNIHDR hdr_dir_drive; /* home drive unicode string header */
|
||||
UNIHDR hdr_logon_script; /* logon script unicode string header */
|
||||
UNIHDR hdr_profile_path; /* profile path unicode string header */
|
||||
UNIHDR hdr_acct_desc ; /* user description */
|
||||
UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */
|
||||
UNIHDR hdr_comment;
|
||||
UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
|
||||
|
||||
uint8 lm_pwd[16]; /* lm user passwords */
|
||||
uint8 nt_pwd[16]; /* nt user passwords */
|
||||
|
||||
uint32 user_rid; /* Primary User ID */
|
||||
uint32 group_rid; /* Primary Group ID */
|
||||
|
||||
uint32 acb_info; /* account info (ACB_xxxx bit-mask) */
|
||||
uint32 fields_present;
|
||||
|
||||
uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */
|
||||
/* uint8 pad[2] */
|
||||
uint32 ptr_logon_hrs; /* pointer to logon hours */
|
||||
|
||||
/* Was unknown_5. */
|
||||
uint16 bad_password_count;
|
||||
uint16 logon_count;
|
||||
|
||||
uint8 padding1[6];
|
||||
|
||||
uint8 passmustchange; /* 0x00 must change = 0x01 */
|
||||
|
||||
uint8 padding2;
|
||||
|
||||
uint8 pass[532];
|
||||
|
||||
UNISTR2 uni_user_name; /* NULL - username unicode string */
|
||||
UNISTR2 uni_full_name; /* user's full name unicode string */
|
||||
UNISTR2 uni_home_dir; /* home directory unicode string */
|
||||
UNISTR2 uni_dir_drive; /* home directory drive unicode string */
|
||||
UNISTR2 uni_logon_script; /* logon script unicode string */
|
||||
UNISTR2 uni_profile_path; /* profile path unicode string */
|
||||
UNISTR2 uni_acct_desc ; /* user description unicode string */
|
||||
UNISTR2 uni_workstations; /* login from workstations unicode string */
|
||||
UNISTR2 uni_comment;
|
||||
UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel no */
|
||||
LOGON_HRS logon_hrs;
|
||||
} SAM_USER_INFO_25;
|
||||
|
||||
/* SAM_USER_INFO_26 */
|
||||
typedef struct sam_user_info_26
|
||||
{
|
||||
uint8 pass[532];
|
||||
uint8 pw_len;
|
||||
} SAM_USER_INFO_26;
|
||||
|
||||
|
||||
/* SAM_USER_INFO_21 */
|
||||
typedef struct sam_user_info_21
|
||||
{
|
||||
NTTIME logon_time; /* logon time */
|
||||
NTTIME logoff_time; /* logoff time */
|
||||
NTTIME kickoff_time; /* kickoff time */
|
||||
NTTIME pass_last_set_time; /* password last set time */
|
||||
NTTIME pass_can_change_time; /* password can change time */
|
||||
NTTIME pass_must_change_time; /* password must change time */
|
||||
|
||||
UNIHDR hdr_user_name; /* username unicode string header */
|
||||
UNIHDR hdr_full_name; /* user's full name unicode string header */
|
||||
UNIHDR hdr_home_dir; /* home directory unicode string header */
|
||||
UNIHDR hdr_dir_drive; /* home drive unicode string header */
|
||||
UNIHDR hdr_logon_script; /* logon script unicode string header */
|
||||
UNIHDR hdr_profile_path; /* profile path unicode string header */
|
||||
UNIHDR hdr_acct_desc ; /* user description */
|
||||
UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */
|
||||
UNIHDR hdr_comment;
|
||||
UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
|
||||
|
||||
uint8 lm_pwd[16]; /* lm user passwords */
|
||||
uint8 nt_pwd[16]; /* nt user passwords */
|
||||
|
||||
uint32 user_rid; /* Primary User ID */
|
||||
uint32 group_rid; /* Primary Group ID */
|
||||
|
||||
uint32 acb_info; /* account info (ACB_xxxx bit-mask) */
|
||||
|
||||
/* Was unknown_3 */
|
||||
uint32 fields_present; /* 0x00ff ffff */
|
||||
|
||||
uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */
|
||||
/* uint8 pad[2] */
|
||||
uint32 ptr_logon_hrs; /* unknown pointer */
|
||||
|
||||
/* Was unknown_5. */
|
||||
uint16 bad_password_count;
|
||||
uint16 logon_count;
|
||||
|
||||
uint8 padding1[6];
|
||||
|
||||
uint8 passmustchange; /* 0x00 must change = 0x01 */
|
||||
|
||||
uint8 padding2;
|
||||
|
||||
UNISTR2 uni_user_name; /* username unicode string */
|
||||
UNISTR2 uni_full_name; /* user's full name unicode string */
|
||||
UNISTR2 uni_home_dir; /* home directory unicode string */
|
||||
UNISTR2 uni_dir_drive; /* home directory drive unicode string */
|
||||
UNISTR2 uni_logon_script; /* logon script unicode string */
|
||||
UNISTR2 uni_profile_path; /* profile path unicode string */
|
||||
UNISTR2 uni_acct_desc ; /* user description unicode string */
|
||||
UNISTR2 uni_workstations; /* login from workstations unicode string */
|
||||
UNISTR2 uni_comment;
|
||||
UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel number */
|
||||
|
||||
LOGON_HRS logon_hrs;
|
||||
|
||||
} SAM_USER_INFO_21;
|
||||
|
||||
#define PASS_MUST_CHANGE_AT_NEXT_LOGON 0x01
|
||||
#define PASS_DONT_CHANGE_AT_NEXT_LOGON 0x00
|
||||
|
||||
/* SAM_USER_INFO_20 */
|
||||
typedef struct sam_user_info_20
|
||||
{
|
||||
UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
|
||||
|
||||
UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel number */
|
||||
|
||||
} SAM_USER_INFO_20;
|
||||
|
||||
/* SAM_USER_INFO_18 */
|
||||
typedef struct sam_user_info_18
|
||||
{
|
||||
uint8 lm_pwd[16]; /* lm user passwords */
|
||||
uint8 nt_pwd[16]; /* nt user passwords */
|
||||
|
||||
uint8 lm_pwd_active;
|
||||
uint8 nt_pwd_active;
|
||||
|
||||
} SAM_USER_INFO_18;
|
||||
|
||||
/* SAM_USER_INFO_17 */
|
||||
typedef struct sam_user_info_17
|
||||
{
|
||||
uint8 padding_0[16]; /* 0 - padding 16 bytes */
|
||||
NTTIME expiry; /* expiry time or something? */
|
||||
uint8 padding_1[24]; /* 0 - padding 24 bytes */
|
||||
|
||||
UNIHDR hdr_mach_acct; /* unicode header for machine account */
|
||||
uint32 padding_2; /* 0 - padding 4 bytes */
|
||||
|
||||
uint32 ptr_1; /* pointer */
|
||||
uint8 padding_3[32]; /* 0 - padding 32 bytes */
|
||||
uint32 padding_4; /* 0 - padding 4 bytes */
|
||||
|
||||
uint32 ptr_2; /* pointer */
|
||||
uint32 padding_5; /* 0 - padding 4 bytes */
|
||||
|
||||
uint32 ptr_3; /* pointer */
|
||||
uint8 padding_6[32]; /* 0 - padding 32 bytes */
|
||||
|
||||
uint32 rid_user; /* user RID */
|
||||
uint32 rid_group; /* group RID */
|
||||
|
||||
uint16 acct_ctrl; /* 0080 - ACB_XXXX */
|
||||
uint16 unknown_3; /* 16 bit padding */
|
||||
|
||||
uint16 unknown_4; /* 0x003f - 16 bit unknown */
|
||||
uint16 unknown_5; /* 0x003c - 16 bit unknown */
|
||||
|
||||
uint8 padding_7[16]; /* 0 - padding 16 bytes */
|
||||
uint32 padding_8; /* 0 - padding 4 bytes */
|
||||
|
||||
UNISTR2 uni_mach_acct; /* unicode string for machine account */
|
||||
|
||||
uint8 padding_9[48]; /* 0 - padding 48 bytes */
|
||||
|
||||
} SAM_USER_INFO_17;
|
||||
|
||||
|
||||
/* SAM_USER_INFO_16 */
|
||||
typedef struct sam_user_info_16
|
||||
{
|
||||
uint32 acb_info;
|
||||
|
||||
} SAM_USER_INFO_16;
|
||||
|
||||
|
||||
/* SAM_USER_INFO_7 */
|
||||
typedef struct sam_user_info_7
|
||||
{
|
||||
UNIHDR hdr_name; /* unicode header for name */
|
||||
UNISTR2 uni_name; /* unicode string for name */
|
||||
|
||||
} SAM_USER_INFO_7;
|
||||
|
||||
|
||||
/* SAM_USER_INFO_9 */
|
||||
typedef struct sam_user_info_9
|
||||
{
|
||||
uint32 rid_group; /* Primary Group RID */
|
||||
} SAM_USER_INFO_9;
|
||||
|
||||
|
||||
#define MAX_SAM_ENTRIES_W2K 0x400
|
||||
#define MAX_SAM_ENTRIES_W95 50
|
||||
/* The following should be the greater of the preceeding two. */
|
||||
@ -524,52 +227,6 @@ typedef struct r_samr_enum_dom_aliases_info
|
||||
|
||||
} SAMR_R_ENUM_DOM_ALIASES;
|
||||
|
||||
|
||||
/********************************************************/
|
||||
/********************************************************/
|
||||
|
||||
/* SAM_USERINFO_CTR - sam user info */
|
||||
typedef struct sam_userinfo_ctr_info
|
||||
{
|
||||
uint16 switch_value;
|
||||
|
||||
union
|
||||
{
|
||||
SAM_USER_INFO_7 *id7;
|
||||
SAM_USER_INFO_9 *id9;
|
||||
SAM_USER_INFO_16 *id16;
|
||||
SAM_USER_INFO_17 *id17;
|
||||
SAM_USER_INFO_18 *id18;
|
||||
SAM_USER_INFO_20 *id20;
|
||||
SAM_USER_INFO_21 *id21;
|
||||
SAM_USER_INFO_23 *id23;
|
||||
SAM_USER_INFO_24 *id24;
|
||||
SAM_USER_INFO_25 *id25;
|
||||
SAM_USER_INFO_26 *id26;
|
||||
void* id; /* to make typecasting easy */
|
||||
|
||||
} info;
|
||||
|
||||
} SAM_USERINFO_CTR;
|
||||
|
||||
|
||||
/* SAMR_Q_SET_USERINFO - set sam info */
|
||||
typedef struct q_samr_set_user_info
|
||||
{
|
||||
POLICY_HND pol; /* policy handle associated with user */
|
||||
uint16 switch_value;
|
||||
SAM_USERINFO_CTR *ctr;
|
||||
|
||||
} SAMR_Q_SET_USERINFO;
|
||||
|
||||
/* SAMR_R_SET_USERINFO - set sam info */
|
||||
typedef struct r_samr_set_user_info
|
||||
{
|
||||
NTSTATUS status; /* return status */
|
||||
|
||||
} SAMR_R_SET_USERINFO;
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
SAMR_Q_LOOKUP_RIDS - do a conversion from RID groups to something.
|
||||
|
||||
|
@ -462,54 +462,3 @@ NTSTATUS rpccli_samr_lookup_rids(struct rpc_pipe_client *cli,
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Set userinfo */
|
||||
|
||||
NTSTATUS rpccli_samr_set_userinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
|
||||
const POLICY_HND *user_pol, uint16 switch_value,
|
||||
DATA_BLOB *sess_key, SAM_USERINFO_CTR *ctr)
|
||||
{
|
||||
prs_struct qbuf, rbuf;
|
||||
SAMR_Q_SET_USERINFO q;
|
||||
SAMR_R_SET_USERINFO r;
|
||||
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
|
||||
|
||||
DEBUG(10,("cli_samr_set_userinfo\n"));
|
||||
|
||||
ZERO_STRUCT(q);
|
||||
ZERO_STRUCT(r);
|
||||
|
||||
if (!sess_key->length) {
|
||||
DEBUG(1, ("No user session key\n"));
|
||||
return NT_STATUS_NO_USER_SESSION_KEY;
|
||||
}
|
||||
|
||||
/* Initialise parse structures */
|
||||
|
||||
prs_init(&qbuf, RPC_MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
|
||||
prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
|
||||
|
||||
/* Marshall data and send request */
|
||||
|
||||
q.ctr = ctr;
|
||||
|
||||
init_samr_q_set_userinfo(&q, user_pol, sess_key, switch_value,
|
||||
ctr->info.id);
|
||||
|
||||
CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_SET_USERINFO,
|
||||
q, r,
|
||||
qbuf, rbuf,
|
||||
samr_io_q_set_userinfo,
|
||||
samr_io_r_set_userinfo,
|
||||
NT_STATUS_UNSUCCESSFUL);
|
||||
|
||||
/* Return output parameters */
|
||||
|
||||
if (!NT_STATUS_IS_OK(result = r.status)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
return result;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user