From 2803a72751cf511aa0b5e6745e1b169faa66f68a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 24 Nov 1999 22:45:09 +0000 Subject: ok. *whew*. this is the first completed part of the restructure. verified that lsaquery, lsalookupsids work, and found some bugs in the parameters of these commands :-) soo... we now have an lsa_* api that has the same arguments as the nt Lsa* api! cool! the only significant coding difference is the introduction of a user_credentials structure, containing user, domain, pass and ntlmssp flags. (This used to be commit 57bff6fe82d777e599d535f076efb2328ba1188b) --- source3/rpc_client/cli_lsarpc.c | 19 +++++++++++++------ source3/rpc_client/cli_netlogon.c | 4 ++-- source3/rpc_client/cli_netlogon_sync.c | 4 +--- source3/rpc_client/cli_pipe.c | 12 ++++++------ 4 files changed, 22 insertions(+), 17 deletions(-) (limited to 'source3/rpc_client') diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index 26b17243cd..a7c15307a1 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -31,8 +31,6 @@ extern int DEBUGLEVEL; -extern struct cli_state *rpc_smb_cli; - /**************************************************************************** obtain the sid from the PDC. do some verification along the way... ****************************************************************************/ @@ -45,8 +43,12 @@ BOOL get_domain_sids(const char *myname, BOOL res = True; fstring dom3; fstring dom5; - - rpc_smb_cli = &cli; + extern struct user_credentials *usr_creds; + struct user_credentials usr; + + usr_creds = &usr; + ZERO_STRUCT(usr); + pwd_set_nullpwd(&usr.pwd); if (sid3 == NULL && sid5 == NULL) { @@ -142,7 +144,12 @@ BOOL get_trust_sid_and_domain(const char* myname, char *server, fstring dom3; fstring dom5; - rpc_smb_cli = &cli; + extern struct user_credentials *usr_creds; + struct user_credentials usr; + + usr_creds = &usr; + ZERO_STRUCT(usr); + pwd_set_nullpwd(&usr.pwd); if (!cli_connect_serverlist(&cli, server)) { @@ -478,7 +485,7 @@ BOOL lsa_query_secret(POLICY_HND *hnd, STRING2 *secret, memcpy(&enc_secret, &(r_q.info.value.enc_secret), sizeof(STRING2)); memcpy(last_update, &(r_q.info.last_update), sizeof(NTTIME)); valid_info = nt_decrypt_string2(secret, &enc_secret, - (char*)(cli->pwd.smb_nt_pwd)); + (char*)(cli->usr.pwd.smb_nt_pwd)); } } diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index 0a9228a3b2..d6db75f243 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -572,8 +572,8 @@ BOOL do_sam_sync(struct cli_state *cli, uchar trust_passwd[16], *num_deltas = 0; - DEBUG(5,("Attempting SAM sync with PDC, domain: %s name: %s\n", - cli->domain, srv_name)); + DEBUG(5,("Attempting SAM sync with PDC: %s\n", + srv_name)); /* open NETLOGON session. negotiate credentials */ res = res ? cli_nt_session_open(cli, PIPE_NETLOGON, &nt_pipe_fnum) : False; diff --git a/source3/rpc_client/cli_netlogon_sync.c b/source3/rpc_client/cli_netlogon_sync.c index 5dd2ab4909..526f366a15 100644 --- a/source3/rpc_client/cli_netlogon_sync.c +++ b/source3/rpc_client/cli_netlogon_sync.c @@ -55,9 +55,7 @@ BOOL synchronise_passdb(void) return False; } - pstrcpy(cli.domain, lp_workgroup()); - - if (!trust_get_passwd(trust_passwd, cli.domain, global_myname)) + if (!trust_get_passwd(trust_passwd, lp_workgroup(), global_myname)) { return False; } diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 1c8c406bae..9aad93246e 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -903,7 +903,7 @@ static BOOL rpc_pipe_bind(struct cli_state *cli, uint16 fnum, ntlmssp_auth ? &auth_ntlm : NULL, rpc_call_id, abstract, transfer, - global_myname, cli->domain, cli->ntlmssp_cli_flgs); + global_myname, cli->usr.domain, cli->usr.ntlmssp_flags); /* this is a hack due to limitations in rpc_api_pipe */ prs_init(&data, mem_buf_len(hdr.data), 4, 0x0, False); @@ -967,16 +967,16 @@ static BOOL rpc_pipe_bind(struct cli_state *cli, uint16 fnum, prs_init(&hdr_autha, 1024, 4, SAFETY_MARGIN, False); prs_init(&auth_resp, 1024, 4, SAFETY_MARGIN, False); - pwd_make_lm_nt_owf(&cli->pwd, rhdr_chal.challenge); + pwd_make_lm_nt_owf(&cli->usr.pwd, rhdr_chal.challenge); - create_rpc_bind_resp(&cli->pwd, cli->domain, - cli->user_name, global_myname, + create_rpc_bind_resp(&cli->usr.pwd, cli->usr.domain, + cli->usr.user_name, global_myname, cli->ntlmssp_cli_flgs, rpc_call_id, &hdra, &hdr_autha, &auth_resp); - pwd_get_lm_nt_owf(&cli->pwd, lm_owf, NULL, NULL, NULL); - pwd_get_lm_nt_16(&cli->pwd, lm_hash, NULL); + pwd_get_lm_nt_owf(&cli->usr.pwd, lm_owf, NULL, NULL, NULL); + pwd_get_lm_nt_16(&cli->usr.pwd, lm_hash, NULL); NTLMSSPOWFencrypt(lm_hash, lm_owf, p24); { unsigned char j = 0; -- cgit