diff options
-rw-r--r-- | source3/include/rpc_samr.h | 8 | ||||
-rw-r--r-- | source3/rpc_parse/parse_samr.c | 60 | ||||
-rw-r--r-- | source3/rpc_server/srv_samr_util.c | 15 | ||||
-rw-r--r-- | source3/utils/net_rpc.c | 34 |
4 files changed, 44 insertions, 73 deletions
diff --git a/source3/include/rpc_samr.h b/source3/include/rpc_samr.h index e041ee26f0..6559127df1 100644 --- a/source3/include/rpc_samr.h +++ b/source3/include/rpc_samr.h @@ -148,6 +148,8 @@ SamrTestPrivateFunctionsUser typedef struct logon_hours_info { + uint32 max_len; /* normally 1260 bytes */ + uint32 offset; uint32 len; /* normally 21 bytes */ uint8 hours[32]; @@ -212,9 +214,6 @@ typedef struct sam_user_info_23 UNISTR2 uni_unknown_str ; /* don't know what this is, yet. */ UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel no */ - uint32 unknown_6; /* 0x0000 04ec */ - uint32 padding4; - LOGON_HRS logon_hrs; } SAM_USER_INFO_23; @@ -336,9 +335,6 @@ typedef struct sam_user_info_21 UNISTR2 uni_unknown_str ; /* don't know what this is, yet. */ UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel number */ - uint32 unknown_6; /* 0x0000 04ec */ - uint32 padding4; - LOGON_HRS logon_hrs; } SAM_USER_INFO_21; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 27570ae821..14d4bb9fdf 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -5148,6 +5148,12 @@ static BOOL sam_io_logon_hrs(const char *desc, LOGON_HRS * hrs, if(!prs_align(ps)) return False; + if(!prs_uint32("maxlen", ps, depth, &hrs->max_len)) + return False; + + if(!prs_uint32("offset", ps, depth, &hrs->offset)) + return False; + if(!prs_uint32("len ", ps, depth, &hrs->len)) return False; @@ -5471,7 +5477,7 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z LOGON_HRS * hrs, uint16 bad_password_count, uint16 logon_count, - char newpass[516], uint32 unknown_6) + char newpass[516]) { usr->logon_time = *logon_time; /* all zeros */ usr->logoff_time = *logoff_time; /* all zeros */ @@ -5535,9 +5541,6 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z copy_unistr2(&usr->uni_munged_dial, mung_dial); init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); - usr->unknown_6 = unknown_6; /* 0x0000 04ec */ - usr->padding4 = 0; - memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs)); } @@ -5562,7 +5565,7 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z uint32 group_rid, uint32 acb_info, uint32 fields_present, uint16 logon_divs, LOGON_HRS * hrs, uint16 bad_password_count, uint16 logon_count, - char newpass[516], uint32 unknown_6) + char newpass[516]) { DATA_BLOB blob = base64_decode_data_blob(mung_dial); @@ -5630,9 +5633,6 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z data_blob_free(&blob); - usr->unknown_6 = unknown_6; /* 0x0000 04ec */ - usr->padding4 = 0; - memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs)); } @@ -5757,16 +5757,9 @@ static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr, /* ok, this is only guess-work (as usual) */ if (usr->ptr_logon_hrs) { - if(!prs_uint32("unknown_6 ", ps, depth, &usr->unknown_6)) - return False; - if(!prs_uint32("padding4 ", ps, depth, &usr->padding4)) - return False; if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth)) return False; - } else if (UNMARSHALLING(ps)) { - usr->unknown_6 = 0; - usr->padding4 = 0; - } + } return True; } @@ -5876,16 +5869,9 @@ static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_str #if 0 /* JRA - unknown... */ /* ok, this is only guess-work (as usual) */ if (usr->ptr_logon_hrs) { - if(!prs_uint32("unknown_6 ", ps, depth, &usr->unknown_6)) - return False; - if(!prs_uint32("padding4 ", ps, depth, &usr->padding4)) - return False; if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth)) return False; - } else if (UNMARSHALLING(ps)) { - usr->unknown_6 = 0; - usr->padding4 = 0; - } + } #endif return True; @@ -5925,8 +5911,7 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, uint16 logon_divs, LOGON_HRS * hrs, uint16 bad_password_count, - uint16 logon_count, - uint32 unknown_6) + uint16 logon_count) { usr->logon_time = *logon_time; usr->logoff_time = *logoff_time; @@ -5987,9 +5972,6 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, copy_unistr2(&usr->uni_munged_dial, mung_dial); init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); - usr->unknown_6 = unknown_6; /* 0x0000 04ec */ - usr->padding4 = 0; - memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs)); } @@ -6136,14 +6118,17 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID * init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); data_blob_free(&munged_dial_blob); - usr->unknown_6 = pdb_get_unknown_6(pw); - usr->padding4 = 0; - if (pdb_get_hours(pw)) { + usr->logon_hrs.max_len = 1260; + usr->logon_hrs.offset = 0; usr->logon_hrs.len = pdb_get_hours_len(pw); memcpy(&usr->logon_hrs.hours, pdb_get_hours(pw), MAX_HOURS_LEN); - } else + } else { + usr->logon_hrs.max_len = 1260; + usr->logon_hrs.offset = 0; + usr->logon_hrs.len = 0; memset(&usr->logon_hrs, 0xff, sizeof(usr->logon_hrs)); + } return NT_STATUS_OK; } @@ -6256,17 +6241,8 @@ static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, /* ok, this is only guess-work (as usual) */ if (usr->ptr_logon_hrs) { - if(!prs_align(ps)) - return False; - if(!prs_uint32("unknown_6 ", ps, depth, &usr->unknown_6)) - return False; - if(!prs_uint32("padding4 ", ps, depth, &usr->padding4)) - return False; if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth)) return False; - } else if (UNMARSHALLING(ps)) { - usr->unknown_6 = 0; - usr->padding4 = 0; } return True; diff --git a/source3/rpc_server/srv_samr_util.c b/source3/rpc_server/srv_samr_util.c index dd12a438ca..6797730be9 100644 --- a/source3/rpc_server/srv_samr_util.c +++ b/source3/rpc_server/srv_samr_util.c @@ -268,12 +268,6 @@ void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from) if (!strequal(old, new)) { pdb_set_hours(to, from->logon_hrs.hours, PDB_CHANGED); } - - /* This is max logon hours */ - DEBUG(10,("INFO_21 UNKNOWN_6: %08X -> %08X\n",pdb_get_unknown_6(to),from->unknown_6)); - if (from->unknown_6 != pdb_get_unknown_6(to)) { - pdb_set_unknown_6(to, from->unknown_6, PDB_CHANGED); - } } if (from->fields_present & ACCT_BAD_PWD_COUNT) { @@ -296,8 +290,6 @@ void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from) } DEBUG(10,("INFO_21 PADDING_2: %02X\n",from->padding2)); - - DEBUG(10,("INFO_21 PADDING_4: %08X\n",from->padding4)); } @@ -499,11 +491,6 @@ void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from) /* Fix me: only update if it changes --metze */ pdb_set_hours(to, from->logon_hrs.hours, PDB_CHANGED); - /* This is max logon hours */ - DEBUG(10,("INFO_23 UNKOWN_6: %08X -> %08X\n",pdb_get_unknown_6(to),from->unknown_6)); - if (from->unknown_6 != pdb_get_unknown_6(to)) { - pdb_set_unknown_6(to, from->unknown_6, PDB_CHANGED); - } } if (from->fields_present & ACCT_BAD_PWD_COUNT) { @@ -526,6 +513,4 @@ void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from) } DEBUG(10,("INFO_23 PADDING_2: %02X\n",from->padding2)); - - DEBUG(10,("INFO_23 PADDING_4: %08X\n",from->padding4)); } diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index b18d4b0ba5..13624f7544 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -4377,7 +4377,7 @@ static NTSTATUS rpc_trustdom_add_internals(const DOM_SID *domain_sid, } /* Create trusting domain's account */ - acb_info = ACB_DOMTRUST; + acb_info = ACB_NORMAL; unknown = 0xe00500b0; /* No idea what this is - a permission mask? mimir: yes, most probably it is */ @@ -4390,20 +4390,34 @@ static NTSTATUS rpc_trustdom_add_internals(const DOM_SID *domain_sid, { SAM_USERINFO_CTR ctr; - SAM_USER_INFO_24 p24; + SAM_USER_INFO_23 p23; + NTTIME notime; + char nostr[] = ""; + LOGON_HRS hrs; uchar pwbuf[516]; encode_pw_buffer((char *)pwbuf, argv[1], STR_UNICODE); ZERO_STRUCT(ctr); - ZERO_STRUCT(p24); - - init_sam_user_info24(&p24, (char *)pwbuf, 24); - - ctr.switch_value = 24; - ctr.info.id24 = &p24; - - result = cli_samr_set_userinfo(cli, mem_ctx, &user_pol, 24, + ZERO_STRUCT(p23); + ZERO_STRUCT(notime); + hrs.max_len = 1260; + hrs.offset = 0; + hrs.len = 21; + memset(hrs.hours, 0xFF, sizeof(hrs.hours)); + acb_info = ACB_DOMTRUST; + + init_sam_user_info23A(&p23, ¬ime, ¬ime, ¬ime, + ¬ime, ¬ime, ¬ime, + nostr, nostr, nostr, nostr, nostr, + nostr, nostr, nostr, nostr, nostr, + 0, 0, acb_info, ACCT_FLAGS, 168, &hrs, + 0, 0, (char *)pwbuf); + ctr.switch_value = 23; + ctr.info.id23 = &p23; + p23.passmustchange = 0; + + result = cli_samr_set_userinfo(cli, mem_ctx, &user_pol, 23, &cli->user_session_key, &ctr); if (!NT_STATUS_IS_OK(result)) { |