summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-10-21 10:08:39 +0200
committerStefan Metzmacher <metze@samba.org>2011-11-24 19:02:32 +0100
commit8428db0a17c2a70eab52a73a6c883cf1d708b564 (patch)
tree4be5a0b34bc14ed0b0ce00e36049a04761124ba9
parent5c97bbf3ef69e45f3ec7958792868e1e8e605d38 (diff)
downloadsamba-8428db0a17c2a70eab52a73a6c883cf1d708b564.tar.gz
samba-8428db0a17c2a70eab52a73a6c883cf1d708b564.tar.xz
samba-8428db0a17c2a70eab52a73a6c883cf1d708b564.zip
s3:smb2cli: remove unused smb2cli_sesssetup_ntlmssp*
metze
-rw-r--r--source3/libsmb/smb2cli.h10
-rw-r--r--source3/libsmb/smb2cli_session.c203
2 files changed, 0 insertions, 213 deletions
diff --git a/source3/libsmb/smb2cli.h b/source3/libsmb/smb2cli.h
index a022c86d5b..65e2f71aa7 100644
--- a/source3/libsmb/smb2cli.h
+++ b/source3/libsmb/smb2cli.h
@@ -39,16 +39,6 @@ NTSTATUS smb2cli_session_setup_recv(struct tevent_req *req,
struct iovec **recv_iov,
DATA_BLOB *out_security_buffer);
-struct tevent_req *smb2cli_sesssetup_ntlmssp_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct cli_state *cli,
- const char *user,
- const char *domain,
- const char *pass);
-NTSTATUS smb2cli_sesssetup_ntlmssp_recv(struct tevent_req *req);
-NTSTATUS smb2cli_sesssetup_ntlmssp(struct cli_state *cli, const char *user,
- const char *domain, const char *pass);
-
struct tevent_req *smb2cli_logoff_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct cli_state *cli);
diff --git a/source3/libsmb/smb2cli_session.c b/source3/libsmb/smb2cli_session.c
index 85c536f5bc..e060f316ef 100644
--- a/source3/libsmb/smb2cli_session.c
+++ b/source3/libsmb/smb2cli_session.c
@@ -240,209 +240,6 @@ NTSTATUS smb2cli_session_setup_recv(struct tevent_req *req,
return status;
}
-struct smb2cli_sesssetup_ntlmssp_state {
- struct tevent_context *ev;
- struct cli_state *cli;
- struct ntlmssp_state *ntlmssp;
- struct iovec iov[2];
- uint8_t fixed[24];
- DATA_BLOB msg;
- int turn;
-};
-
-static void smb2cli_sesssetup_ntlmssp_done(struct tevent_req *subreq);
-
-struct tevent_req *smb2cli_sesssetup_ntlmssp_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct cli_state *cli,
- const char *user,
- const char *domain,
- const char *pass)
-{
- struct tevent_req *req, *subreq;
- struct smb2cli_sesssetup_ntlmssp_state *state;
- NTSTATUS status;
- DATA_BLOB blob_out;
- const char *OIDs_ntlm[] = {OID_NTLMSSP, NULL};
-
- req = tevent_req_create(mem_ctx, &state,
- struct smb2cli_sesssetup_ntlmssp_state);
- if (req == NULL) {
- return NULL;
- }
- state->ev = ev;
- state->cli = cli;
-
- status = ntlmssp_client_start(state,
- lp_netbios_name(),
- lp_workgroup(),
- lp_client_ntlmv2_auth(),
- &state->ntlmssp);
- if (!NT_STATUS_IS_OK(status)) {
- goto post_status;
- }
- ntlmssp_want_feature(state->ntlmssp,
- NTLMSSP_FEATURE_SESSION_KEY);
- status = ntlmssp_set_username(state->ntlmssp, user);
- if (!NT_STATUS_IS_OK(status)) {
- goto post_status;
- }
- status = ntlmssp_set_domain(state->ntlmssp, domain);
- if (!NT_STATUS_IS_OK(status)) {
- goto post_status;
- }
- status = ntlmssp_set_password(state->ntlmssp, pass);
- if (!NT_STATUS_IS_OK(status)) {
- goto post_status;
- }
-
- status = ntlmssp_update(state->ntlmssp, data_blob_null, &blob_out);
- if (!NT_STATUS_IS_OK(status)
- && !NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
- goto post_status;
- }
-
- blob_out = spnego_gen_negTokenInit(state, OIDs_ntlm, &blob_out, NULL);
- state->turn = 1;
-
- state->cli->smb2.session = smbXcli_session_create(cli, cli->conn);
- if (tevent_req_nomem(state->cli->smb2.session, req)) {
- return tevent_req_post(req, ev);
- }
-
- subreq = smb2cli_session_setup_send(state, state->ev,
- state->cli->conn,
- state->cli->timeout,
- state->cli->smb2.session,
- 0, /* in_flags */
- SMB2_CAP_DFS, /* in_capabilities */
- 0, /* in_channel */
- NULL, /* in_previous_session */
- &blob_out);
- if (tevent_req_nomem(subreq, req)) {
- return tevent_req_post(req, ev);
- }
- tevent_req_set_callback(subreq, smb2cli_sesssetup_ntlmssp_done, req);
- return req;
-post_status:
- tevent_req_nterror(req, status);
- return tevent_req_post(req, ev);
-}
-
-static void smb2cli_sesssetup_ntlmssp_done(struct tevent_req *subreq)
-{
- struct tevent_req *req =
- tevent_req_callback_data(subreq,
- struct tevent_req);
- struct smb2cli_sesssetup_ntlmssp_state *state =
- tevent_req_data(req,
- struct smb2cli_sesssetup_ntlmssp_state);
- NTSTATUS status;
- DATA_BLOB blob, blob_in, blob_out, spnego_blob;
- bool ret;
- struct iovec *recv_iov;
-
- status = smb2cli_session_setup_recv(subreq, state, &recv_iov, &blob);
- TALLOC_FREE(subreq);
- if (!NT_STATUS_IS_OK(status)
- && !NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
- tevent_req_nterror(req, status);
- return;
- }
-
- if (NT_STATUS_IS_OK(status)) {
- status = smb2cli_session_update_session_key(state->cli->smb2.session,
- state->ntlmssp->session_key,
- recv_iov);
- if (tevent_req_nterror(req, status)) {
- return;
- }
-
- tevent_req_done(req);
- return;
- }
-
- if (state->turn == 1) {
- DATA_BLOB tmp_blob = data_blob_null;
- ret = spnego_parse_challenge(state, blob, &blob_in, &tmp_blob);
- data_blob_free(&tmp_blob);
- } else {
- ret = spnego_parse_auth_response(state, blob, status,
- OID_NTLMSSP, &blob_in);
- }
- TALLOC_FREE(subreq);
- if (!ret) {
- tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
- return;
- }
-
- status = ntlmssp_update(state->ntlmssp, blob_in, &blob_out);
- data_blob_free(&blob_in);
- state->turn += 1;
-
- if (!NT_STATUS_IS_OK(status)) {
- tevent_req_nterror(req, status);
- return;
- }
-
- spnego_blob = spnego_gen_auth(state, blob_out);
- TALLOC_FREE(subreq);
- if (tevent_req_nomem(spnego_blob.data, req)) {
- return;
- }
-
- subreq = smb2cli_session_setup_send(state, state->ev,
- state->cli->conn,
- state->cli->timeout,
- state->cli->smb2.session,
- 0, /* in_flags */
- SMB2_CAP_DFS, /* in_capabilities */
- 0, /* in_channel */
- NULL, /* in_previous_session */
- &spnego_blob);
- if (tevent_req_nomem(subreq, req)) {
- return;
- }
- tevent_req_set_callback(subreq, smb2cli_sesssetup_ntlmssp_done, req);
-}
-
-NTSTATUS smb2cli_sesssetup_ntlmssp_recv(struct tevent_req *req)
-{
- return tevent_req_simple_recv_ntstatus(req);
-}
-
-NTSTATUS smb2cli_sesssetup_ntlmssp(struct cli_state *cli, const char *user,
- const char *domain, const char *pass)
-{
- TALLOC_CTX *frame = talloc_stackframe();
- struct event_context *ev;
- struct tevent_req *req;
- NTSTATUS status = NT_STATUS_NO_MEMORY;
-
- if (cli_has_async_calls(cli)) {
- /*
- * Can't use sync call while an async call is in flight
- */
- status = NT_STATUS_INVALID_PARAMETER;
- goto fail;
- }
- ev = event_context_init(frame);
- if (ev == NULL) {
- goto fail;
- }
- req = smb2cli_sesssetup_ntlmssp_send(frame, ev, cli, user, domain, pass);
- if (req == NULL) {
- goto fail;
- }
- if (!tevent_req_poll_ntstatus(req, ev, &status)) {
- goto fail;
- }
- status = smb2cli_sesssetup_ntlmssp_recv(req);
- fail:
- TALLOC_FREE(frame);
- return status;
-}
-
struct smb2cli_logoff_state {
uint8_t fixed[4];
};