diff options
Diffstat (limited to 'source3/rpc_parse/parse_samr.c')
-rw-r--r-- | source3/rpc_parse/parse_samr.c | 197 |
1 files changed, 114 insertions, 83 deletions
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ab07e375f5..b71c209845 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2452,37 +2452,64 @@ void samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, i prs_uint32("status", ps, depth, &(r_u->status)); } - -#if 0 -/* SAMR_Q_CHGPASSWD_USER */ -typedef struct q_samr_chgpasswd_user_info +/******************************************************************* +makes a SAMR_Q_UNKNOWN_12 structure. +********************************************************************/ +void make_samr_q_unknown_12(SAMR_Q_UNKNOWN_12 *q_u, + POLICY_HND *pol, uint32 rid, + uint32 num_gids, uint32 *gid) { - uint32 ptr_0; + int i; + if (q_u == NULL) return; + + DEBUG(5,("make_samr_r_unknwon_12\n")); + + memcpy(&(q_u->pol), pol, sizeof(*pol)); + + q_u->num_gids1 = num_gids; + q_u->rid = rid; + q_u->ptr = 0; + q_u->num_gids2 = num_gids; - UNIHDR hdr_server; /* server name unicode header */ - UNISTR2 uni_server; /* server name unicode string */ + for (i = 0; i < num_gids; i++) + { + q_u->gid[i] = gid[i]; + } +} - UNIHDR hdr_user_name; /* username unicode string header */ - UNISTR2 uni_user_name; /* username unicode string */ - SAMR_ENC_PASSWD nt_newpass; - SAMR_ENC_HASH nt_oldhash; - uint32 unknown_1; /* seems to always contain 0001 */ - SAMR_ENC_PASSWD lm_newpass; - SAMR_ENC_HASH lm_oldhash; +/******************************************************************* +makes a SAMR_Q_UNKNOWN_21 structure. +********************************************************************/ +void make_samr_q_unknown_21(SAMR_Q_UNKNOWN_21 *q_c, + POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_samr_q_unknown_21\n")); + + memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol)); + q_c->unknown_1 = unk_1; + q_c->unknown_2 = unk_2; +} -} SAMR_Q_CHGPASSWD_USER; -/* SAMR_R_CHGPASSWD_USER */ -typedef struct r_samr_chgpasswd_user_info +/******************************************************************* +makes a SAMR_Q_UNKNOWN_13 structure. +********************************************************************/ +void make_samr_q_unknown_13(SAMR_Q_UNKNOWN_13 *q_c, + POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) { - uint32 result; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */ + if (q_c == NULL || hnd == NULL) return; -} SAMR_R_CHGPASSWD_USER; + DEBUG(5,("make_samr_q_unknown_13\n")); -#endif /* 0 */ + memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol)); + q_c->unknown_1 = unk_1; + q_c->unknown_2 = unk_2; +} /******************************************************************* @@ -2555,6 +2582,17 @@ void samr_io_r_unknown_38(char *desc, SAMR_R_UNKNOWN_38 *r_u, prs_struct *ps, i } /******************************************************************* +make a SAMR_ENC_PASSWD structure. +********************************************************************/ +void make_enc_passwd(SAMR_ENC_PASSWD *pwd, char pass[512]) +{ + if (pwd == NULL) return; + + pwd->ptr = 1; + memcpy(&(pwd->pass), pass, sizeof(pwd->pass)); +} + +/******************************************************************* reads or writes a SAMR_ENC_PASSWD structure. ********************************************************************/ void samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD *pwd, prs_struct *ps, int depth) @@ -2571,6 +2609,17 @@ void samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD *pwd, prs_struct *ps, int de } /******************************************************************* +makes a SAMR_ENC_HASH structure. +********************************************************************/ +void make_enc_hash(SAMR_ENC_HASH *hsh, char hash[16]) +{ + if (hsh == NULL) return; + + hsh->ptr = 1; + memcpy(&(hsh->hash), hash, sizeof(hsh->hash)); +} + +/******************************************************************* reads or writes a SAMR_ENC_HASH structure. ********************************************************************/ void samr_io_enc_hash(char *desc, SAMR_ENC_HASH *hsh, prs_struct *ps, int depth) @@ -2586,95 +2635,77 @@ void samr_io_enc_hash(char *desc, SAMR_ENC_HASH *hsh, prs_struct *ps, int depth) prs_uint8s(False, "hash", ps, depth, hsh->hash, sizeof(hsh->hash)); } -#if 0 -/* SAMR_Q_CHGPASSWD_USER */ -typedef struct q_samr_chgpasswd_user_info +/******************************************************************* +makes a SAMR_R_UNKNOWN_38 structure. +********************************************************************/ +void make_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, + char *dest_host, char *user_name, + char nt_newpass[516], char nt_oldhash[16], + char lm_newpass[516], char lm_oldhash[16]) { - uint32 ptr_0; - - UNIHDR hdr_server; /* server name unicode header */ - UNISTR2 uni_server; /* server name unicode string */ - - UNIHDR hdr_user_name; /* username unicode string header */ - UNISTR2 uni_user_name; /* username unicode string */ - - SAMR_ENC_PASSWD nt_newpass; - SAMR_ENC_HASH nt_oldhash; + int len_dest_host = strlen(dest_host); + int len_user_name = strlen(user_name); - uint32 unknown_1; /* seems to always contain 0001 */ - - SAMR_ENC_PASSWD lm_newpass; - SAMR_ENC_HASH lm_oldhash; + if (q_u == NULL) return; -} SAMR_Q_CHGPASSWD_USER; + DEBUG(5,("make_samr_q_chgpasswd_user\n")); -/* SAMR_R_CHGPASSWD_USER */ -typedef struct r_samr_chgpasswd_user_info -{ - uint32 result; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */ + q_u->ptr_0 = 1; + make_uni_hdr(&(q_u->hdr_dest_host), len_dest_host, len_dest_host, len_dest_host != 0); + make_unistr2(&(q_u->uni_dest_host), dest_host, len_dest_host); + make_uni_hdr(&(q_u->hdr_user_name), len_user_name, len_user_name, len_user_name != 0); + make_unistr2(&(q_u->uni_user_name), user_name, len_user_name); -} SAMR_R_CHGPASSWD_USER; + make_enc_passwd(&(q_u->nt_newpass), nt_newpass); + make_enc_hash (&(q_u->nt_oldhash), nt_oldhash); -#endif /* 0 */ + q_u->unknown = 0x01; + make_enc_passwd(&(q_u->lm_newpass), lm_newpass); + make_enc_hash (&(q_u->lm_oldhash), lm_oldhash); +}; /******************************************************************* -makes a SAMR_Q_UNKNOWN_12 structure. +reads or writes a structure. ********************************************************************/ -void make_samr_q_unknown_12(SAMR_Q_UNKNOWN_12 *q_u, - POLICY_HND *pol, uint32 rid, - uint32 num_gids, uint32 *gid) +void samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER *q_u, prs_struct *ps, int depth) { - int i; if (q_u == NULL) return; - DEBUG(5,("make_samr_r_unknwon_12\n")); - - memcpy(&(q_u->pol), pol, sizeof(*pol)); - - q_u->num_gids1 = num_gids; - q_u->rid = rid; - q_u->ptr = 0; - q_u->num_gids2 = num_gids; - - for (i = 0; i < num_gids; i++) - { - q_u->gid[i] = gid[i]; - } -} + prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user"); + depth++; + prs_align(ps); + prs_uint32("ptr_0", ps, depth, &(q_u->ptr_0)); + smb_io_unihdr ("", &(q_u->hdr_dest_host), ps, depth); + smb_io_unistr2("", &(q_u->uni_dest_host), q_u->hdr_dest_host.buffer, ps, depth); + smb_io_unihdr ("", &(q_u->hdr_user_name), ps, depth); + smb_io_unistr2("", &(q_u->uni_user_name), q_u->hdr_user_name.buffer, ps, depth); -/******************************************************************* -makes a SAMR_Q_UNKNOWN_21 structure. -********************************************************************/ -void make_samr_q_unknown_21(SAMR_Q_UNKNOWN_21 *q_c, - POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) -{ - if (q_c == NULL || hnd == NULL) return; + samr_io_enc_passwd("nt_newpass", &(q_u->nt_newpass), ps, depth); + samr_io_enc_hash ("nt_oldhash", &(q_u->nt_oldhash), ps, depth); - DEBUG(5,("make_samr_q_unknown_21\n")); + prs_uint32("unknown", ps, depth, &(q_u->unknown)); - memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol)); - q_c->unknown_1 = unk_1; - q_c->unknown_2 = unk_2; + samr_io_enc_passwd("lm_newpass", &(q_u->lm_newpass), ps, depth); + samr_io_enc_hash ("lm_oldhash", &(q_u->lm_oldhash), ps, depth); } - /******************************************************************* -makes a SAMR_Q_UNKNOWN_13 structure. +reads or writes a structure. ********************************************************************/ -void make_samr_q_unknown_13(SAMR_Q_UNKNOWN_13 *q_c, - POLICY_HND *hnd, uint16 unk_1, uint16 unk_2) +void samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER *r_u, prs_struct *ps, int depth) { - if (q_c == NULL || hnd == NULL) return; + if (r_u == NULL) return; - DEBUG(5,("make_samr_q_unknown_13\n")); + prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user"); + depth++; - memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol)); - q_c->unknown_1 = unk_1; - q_c->unknown_2 = unk_2; + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); } |