diff options
author | Tim Potter <tpot@samba.org> | 2001-10-30 01:49:44 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2001-10-30 01:49:44 +0000 |
commit | 5c3ccf77666ab63e8dfc980188c365a7b15bafcf (patch) | |
tree | aa937315977f0544db124f9042680c95acf4b833 /source3/libsmb | |
parent | d16ce1910bfa5836b99b1fcb75c86d008f7bf666 (diff) | |
download | samba-5c3ccf77666ab63e8dfc980188c365a7b15bafcf.tar.gz samba-5c3ccf77666ab63e8dfc980188c365a7b15bafcf.tar.bz2 samba-5c3ccf77666ab63e8dfc980188c365a7b15bafcf.zip |
Added samlogon command to test against win2k native mode server. I think
there's a bug in the marshalling of net_sam_logon.
(This used to be commit 7c5ac46b8ad0be681d102e7ef3478d64d7a2b8e6)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/cli_netlogon.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/source3/libsmb/cli_netlogon.c b/source3/libsmb/cli_netlogon.c index 98f448c6a7..21a97466a0 100644 --- a/source3/libsmb/cli_netlogon.c +++ b/source3/libsmb/cli_netlogon.c @@ -392,3 +392,75 @@ NTSTATUS cli_netlogon_sam_deltas(struct cli_state *cli, TALLOC_CTX *mem_ctx, return result; } + +/* Logon domain user */ + +NTSTATUS cli_netlogon_sam_logon(struct cli_state *cli, TALLOC_CTX *mem_ctx, + char *username, char *password, + int validation_level) +{ + prs_struct qbuf, rbuf; + NET_Q_SAM_LOGON q; + NET_R_SAM_LOGON r; + NTSTATUS result = NT_STATUS_UNSUCCESSFUL; + DOM_CRED clnt_creds, dummy_rtn_creds; + extern pstring global_myname; + NET_ID_INFO_CTR ctr; + uint8 chal[8]; + unsigned char local_lm_response[24]; + unsigned char local_nt_response[24]; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Initialise parse structures */ + + prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL); + prs_init(&rbuf, 0, mem_ctx, UNMARSHALL); + + /* Initialise input parameters */ + + gen_next_creds(cli, &clnt_creds); + + q.validation_level = validation_level; + + memset(&dummy_rtn_creds, '\0', sizeof(dummy_rtn_creds)); + dummy_rtn_creds.timestamp.time = time(NULL); + + generate_random_buffer(chal, 8, False); + + SMBencrypt(password, chal, local_lm_response); + SMBNTencrypt(password, chal, local_nt_response); + + ctr.switch_value = NET_LOGON_TYPE; + init_id_info2(&ctr.auth.id2, lp_workgroup(), 0, + 0xdead, 0xbeef, /* LUID? */ + username, global_myname, chal, + local_lm_response, 24, local_nt_response, 24); + + init_sam_info(&q.sam_id, cli->srv_name_slash, global_myname, + &clnt_creds, &dummy_rtn_creds, ctr.switch_value, + &ctr); + + /* Marshall data and send request */ + + if (!net_io_q_sam_logon("", &q, &qbuf, 0) || + !rpc_api_pipe_req(cli, NET_SAMLOGON, &qbuf, &rbuf)) { + result = NT_STATUS_UNSUCCESSFUL; + goto done; + } + + /* Unmarshall response */ + + if (!net_io_r_sam_logon("", &r, &rbuf, 0)) { + result = NT_STATUS_UNSUCCESSFUL; + goto done; + } + + /* Return results */ + + result = r.status; + + done: + return result; +} |