diff options
author | Jeremy Allison <jra@samba.org> | 1998-04-29 19:22:01 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-04-29 19:22:01 +0000 |
commit | e305c2c9e2e657974d34d1d58a8f9372921fdae2 (patch) | |
tree | cf35e6a21e2ba4cdc00539c24cb41b229b55a06b /source3/rpc_client | |
parent | 4eb37c104d3a23ecefcefe9038de5d10515078dd (diff) | |
download | samba-e305c2c9e2e657974d34d1d58a8f9372921fdae2.tar.gz samba-e305c2c9e2e657974d34d1d58a8f9372921fdae2.tar.bz2 samba-e305c2c9e2e657974d34d1d58a8f9372921fdae2.zip |
clientgen.c: Fixed null session setup bug.
password.c: Stopped cli_nt_logout call (we don't have it correct yet).
Added Luke object-orientation fix :-).
smb.h: Added clnt_name_slash to cli_state.
lib/rpc/client/cli_login.c: Changed global_myname to clnt_name_slash where needed.
lib/rpc/client/cli_netlogon.c: Fixed debug messages, don't check creds on error.
lib/rpc/client/cli_pipe.c: Fixed debug messages, Added Luke object-orientation fix.
lib/rpc/parse/parse_misc.c: Fixed STRING2 linearization bug that was adding 1.
Jeremy.
(This used to be commit c6c22df20196cb7f0ae84b1a1dd202a87adb8d4e)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r-- | source3/rpc_client/cli_login.c | 6 | ||||
-rw-r--r-- | source3/rpc_client/cli_netlogon.c | 25 | ||||
-rw-r--r-- | source3/rpc_client/cli_pipe.c | 24 |
3 files changed, 37 insertions, 18 deletions
diff --git a/source3/rpc_client/cli_login.c b/source3/rpc_client/cli_login.c index 1feda1cfe3..80dca21149 100644 --- a/source3/rpc_client/cli_login.c +++ b/source3/rpc_client/cli_login.c @@ -127,13 +127,13 @@ BOOL cli_nt_login_interactive(struct cli_state *cli, char *domain, char *usernam DEBUG(5,("cli_nt_login_network: %d\n", __LINE__)); - /* indicate a "network" login */ + /* indicate an "interactive" login */ ctr->switch_value = INTERACTIVE_LOGON_TYPE; /* Create the structure needed for SAM logon. */ make_id_info1(&ctr->auth.id1, domain, 0, smb_userid_low, 0, - username, global_myname, + username, cli->clnt_name_slash, cli->sess_key, lm_owf_user_pwd, nt_owf_user_pwd); /* Ensure we overwrite all the plaintext password @@ -169,7 +169,7 @@ BOOL cli_nt_login_network(struct cli_state *cli, char *domain, char *username, /* Create the structure needed for SAM logon. */ make_id_info2(&ctr->auth.id2, domain, 0, smb_userid_low, 0, - username, global_myname, + username, cli->clnt_name_slash, lm_chal, lm_chal_resp, nt_chal_resp); /* Send client sam-logon request - update credentials on success. */ diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index a8aba1c5dc..da74bc6bc6 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -50,6 +50,7 @@ static void gen_next_creds( struct cli_state *cli, DOM_CRED *new_clnt_cred) /* Calculate the new credentials. */ cred_create(cli->sess_key, &(cli->clnt_cred.challenge), new_clnt_cred->timestamp, &(new_clnt_cred->challenge)); + } /**************************************************************************** @@ -285,13 +286,13 @@ BOOL cli_net_srv_pwset(struct cli_state *cli, uint8 hashed_mach_pwd[16]) if (ok && r_s.status != 0) { /* report error code */ - DEBUG(0,("NET_R_SRV_PWSET: %s\n", get_nt_error_msg(r_s.status))); + DEBUG(0,("cli_net_srv_pwset: %s\n", get_nt_error_msg(r_s.status))); cli->nt_error = r_s.status; ok = False; } /* Update the credentials. */ - if (clnt_deal_with_creds(cli->sess_key, &(cli->clnt_cred), &(r_s.srv_cred)) == 0) + if (ok && !clnt_deal_with_creds(cli->sess_key, &(cli->clnt_cred), &(r_s.srv_cred))) { /* * Server replied with bad credential. Fail. @@ -316,6 +317,7 @@ BOOL cli_net_sam_logon(struct cli_state *cli, NET_ID_INFO_CTR *ctr, NET_USER_INFO_3 *user_info3) { DOM_CRED new_clnt_cred; + DOM_CRED dummy_rtn_creds; prs_struct rbuf; prs_struct buf; uint16 validation_level = 3; @@ -334,9 +336,11 @@ BOOL cli_net_sam_logon(struct cli_state *cli, NET_ID_INFO_CTR *ctr, credstr(new_clnt_cred.challenge.data), cli->clnt_cred.timestamp.time, ctr->switch_value)); + memset(&dummy_rtn_creds, '\0', sizeof(dummy_rtn_creds)); + /* store the parameters */ make_sam_info(&(q_s.sam_id), cli->srv_name_slash, global_myname, - &new_clnt_cred, NULL, ctr->switch_value, ctr, validation_level); + &new_clnt_cred, &dummy_rtn_creds, ctr->switch_value, ctr, validation_level); /* turn parameters into data stream */ net_io_q_sam_logon("", &q_s, &buf, 0); @@ -360,7 +364,7 @@ BOOL cli_net_sam_logon(struct cli_state *cli, NET_ID_INFO_CTR *ctr, } /* Update the credentials. */ - if (clnt_deal_with_creds(cli->sess_key, &(cli->clnt_cred), &(r_s.srv_creds)) == 0) + if (ok && !clnt_deal_with_creds(cli->sess_key, &(cli->clnt_cred), &(r_s.srv_creds))) { /* * Server replied with bad credential. Fail. @@ -387,11 +391,18 @@ password ?).\n", cli->desthost )); /*************************************************************************** LSA SAM Logoff. + +This currently doesnt work correctly as the domain controller +returns NT_STATUS_INVALID_INFO_CLASS - we obviously need to +send a different info level. Right now though, I'm not sure +what that needs to be (I need to see one on the wire before +I can be sure). JRA. ****************************************************************************/ BOOL cli_net_sam_logoff(struct cli_state *cli, NET_ID_INFO_CTR *ctr) { DOM_CRED new_clnt_cred; + DOM_CRED dummy_rtn_creds; prs_struct rbuf; prs_struct buf; NET_Q_SAM_LOGOFF q_s; @@ -410,9 +421,11 @@ BOOL cli_net_sam_logoff(struct cli_state *cli, NET_ID_INFO_CTR *ctr) credstr(new_clnt_cred.challenge.data), new_clnt_cred.timestamp.time, ctr->switch_value)); + memset(&dummy_rtn_creds, '\0', sizeof(dummy_rtn_creds)); + /* store the parameters */ make_sam_info(&(q_s.sam_id), cli->srv_name_slash, global_myname, - &new_clnt_cred, NULL, ctr->switch_value, ctr, validation_level); + &new_clnt_cred, &dummy_rtn_creds, ctr->switch_value, ctr, validation_level); /* turn parameters into data stream */ net_io_q_sam_logoff("", &q_s, &buf, 0); @@ -434,7 +447,7 @@ BOOL cli_net_sam_logoff(struct cli_state *cli, NET_ID_INFO_CTR *ctr) } /* Update the credentials. */ - if (clnt_deal_with_creds(cli->sess_key, &(cli->clnt_cred), &(r_s.srv_creds)) == 0) + if (ok && !clnt_deal_with_creds(cli->sess_key, &(cli->clnt_cred), &(r_s.srv_creds))) { /* * Server replied with bad credential. Fail. diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 4058538f21..3076df3bb7 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -124,7 +124,7 @@ static BOOL rpc_check_hdr(prs_struct *rdata, uint8 *pkt_type, if (!rdata->offset || rdata->offset != 0x10) { - DEBUG(5,("cli_pipe: error in rpc header\n")); + DEBUG(0,("cli_pipe: error in rpc header\n")); return False; } @@ -199,7 +199,7 @@ BOOL rpc_api_pipe(struct cli_state *cli, uint16 cmd, pp_ret_params, p_ret_params_len, /* return params, len */ pp_ret_data, p_ret_data_len)) /* return data, len */ { - DEBUG(5, ("cli_pipe: return critical error\n")); + DEBUG(0, ("cli_pipe: return critical error. Error was %s\n", cli_errstr(cli))); return False; } @@ -273,7 +273,7 @@ BOOL rpc_api_pipe(struct cli_state *cli, uint16 cmd, if (first) { - DEBUG(4,("rpc_api_pipe: wierd rpc header received\n")); + DEBUG(0,("rpc_api_pipe: wierd rpc header received\n")); return False; } @@ -558,7 +558,7 @@ static BOOL check_bind_response(RPC_HDR_BA *hdr_ba, char *pipe_name, RPC_IFACE * (memcmp(hdr_ba->transfer.data, transfer->data, sizeof(transfer->version)) ==0))) { - DEBUG(2,("bind_rpc_pipe: transfer syntax differs\n")); + DEBUG(0,("bind_rpc_pipe: transfer syntax differs\n")); return False; } @@ -647,8 +647,8 @@ BOOL cli_nt_session_open(struct cli_state *cli, char *pipe_name, BOOL encrypted) /******************* open the pipe *****************/ if ((fnum = cli_open(cli, pipe_name, O_CREAT|O_RDWR, DENY_NONE)) == -1) { - DEBUG(1,("do_session_open: cli_open failed on pipe %s to machine %s. \ -Error was %s.\n", pipe_name, cli->desthost, cli_errstr(cli))); + DEBUG(0,("cli_nt_session_open: cli_open failed on pipe %s to machine %s. \ +Error was %s\n", pipe_name, cli->desthost, cli_errstr(cli))); return False; } @@ -657,14 +657,17 @@ Error was %s.\n", pipe_name, cli->desthost, cli_errstr(cli))); /**************** Set Named Pipe State ***************/ if (!rpc_pipe_set_hnd_state(cli, pipe_name, 0x4300)) { - DEBUG(1,("do_session_open: pipe hnd state failed.\n")); + DEBUG(0,("cli_nt_session_open: pipe hnd state failed. Error was %s\n", + cli_errstr(cli))); + cli_close(cli, cli->nt_pipe_fnum); return False; } /******************* bind request on pipe *****************/ if (!rpc_pipe_bind(cli, pipe_name, &abstract, &transfer, encrypted)) { - DEBUG(1,("do_session_open: rpc bind failed.\n")); + DEBUG(0,("cli_nt_session_open: rpc bind failed. Error was %s\n", cli_errstr(cli))); + cli_close(cli, cli->nt_pipe_fnum); return False; } @@ -675,6 +678,9 @@ Error was %s.\n", pipe_name, cli->desthost, cli_errstr(cli))); sprintf(cli->srv_name_slash, "\\\\%s", cli->desthost); strupper(cli->srv_name_slash); + sprintf(cli->clnt_name_slash, "\\\\%s", global_myname); + strupper(cli->clnt_name_slash); + sprintf(cli->mach_acct, "%s$", global_myname); strupper(cli->mach_acct); @@ -685,7 +691,7 @@ Error was %s.\n", pipe_name, cli->desthost, cli_errstr(cli))); close the session ****************************************************************************/ -void nt_session_close(struct cli_state *cli) +void cli_nt_session_close(struct cli_state *cli) { cli_close(cli, cli->nt_pipe_fnum); } |