From 180fa12026caef8f22154e0e7c60f9043b5588e2 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Sat, 26 Feb 2005 15:26:55 +0000 Subject: r5580: Fix "net rpc trustdom add". Much closer to what windows does. Also stop referencing unknown_6 from sam, because it's just fixed at 1260, the max len of LOGON_HRS. Need to go in and mark it as "remove me" from passdb. (This used to be commit ffac752875938d510446ebbeba6fc983f65cda1e) --- source3/utils/net_rpc.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'source3/utils') 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)) { -- cgit