diff options
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/cliconnect.c | 6 | ||||
-rw-r--r-- | source3/libsmb/clifsinfo.c | 6 | ||||
-rw-r--r-- | source3/libsmb/ntlmssp.c | 57 |
3 files changed, 51 insertions, 18 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 11faa27b3f..9ac3551d7c 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -1000,7 +1000,11 @@ static struct tevent_req *cli_session_setup_ntlmssp_send( cli_temp_set_signing(cli); - status = ntlmssp_client_start(&state->ntlmssp_state); + status = ntlmssp_client_start(state, + global_myname(), + lp_workgroup(), + lp_client_ntlmv2_auth(), + &state->ntlmssp_state); if (!NT_STATUS_IS_OK(status)) { goto fail; } diff --git a/source3/libsmb/clifsinfo.c b/source3/libsmb/clifsinfo.c index b3c9d5f6e7..3297ec76ca 100644 --- a/source3/libsmb/clifsinfo.c +++ b/source3/libsmb/clifsinfo.c @@ -634,7 +634,11 @@ NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli, if (!es) { return NT_STATUS_NO_MEMORY; } - status = ntlmssp_client_start(&es->s.ntlmssp_state); + status = ntlmssp_client_start(NULL, + global_myname(), + lp_workgroup(), + lp_client_ntlmv2_auth(), + &es->s.ntlmssp_state); if (!NT_STATUS_IS_OK(status)) { goto fail; } diff --git a/source3/libsmb/ntlmssp.c b/source3/libsmb/ntlmssp.c index 8723588467..e2bf4f2247 100644 --- a/source3/libsmb/ntlmssp.c +++ b/source3/libsmb/ntlmssp.c @@ -982,8 +982,8 @@ static NTSTATUS ntlmssp_client_initial(struct ntlmssp_state *ntlmssp_state, "NTLMSSP", NTLMSSP_NEGOTIATE, ntlmssp_state->neg_flags, - ntlmssp_state->get_domain(), - ntlmssp_state->get_global_myname()); + ntlmssp_state->client.netbios_domain, + ntlmssp_state->client.netbios_name); if (DEBUGLEVEL >= 10) { if (NT_STATUS_IS_OK(ntlmssp_pull_NEGOTIATE_MESSAGE(next_request, @@ -1272,7 +1272,7 @@ noccache: nt_response.data, nt_response.length, ntlmssp_state->domain, ntlmssp_state->user, - ntlmssp_state->get_global_myname(), + ntlmssp_state->client.netbios_name, encrypted_session_key.data, encrypted_session_key.length, ntlmssp_state->neg_flags)) { @@ -1310,27 +1310,36 @@ done: return nt_status; } -NTSTATUS ntlmssp_client_start(struct ntlmssp_state **ntlmssp_state) +NTSTATUS ntlmssp_client_start(TALLOC_CTX *mem_ctx, + const char *netbios_name, + const char *netbios_domain, + bool use_ntlmv2, + struct ntlmssp_state **_ntlmssp_state) { - *ntlmssp_state = TALLOC_ZERO_P(NULL, struct ntlmssp_state); - if (!*ntlmssp_state) { - DEBUG(0,("ntlmssp_client_start: talloc failed!\n")); - talloc_destroy(*ntlmssp_state); - return NT_STATUS_NO_MEMORY; + struct ntlmssp_state *ntlmssp_state; + + if (!netbios_name) { + netbios_name = ""; } - (*ntlmssp_state)->role = NTLMSSP_CLIENT; + if (!netbios_domain) { + netbios_domain = ""; + } - (*ntlmssp_state)->get_global_myname = global_myname; - (*ntlmssp_state)->get_domain = lp_workgroup; + ntlmssp_state = talloc_zero(mem_ctx, struct ntlmssp_state); + if (!ntlmssp_state) { + return NT_STATUS_NO_MEMORY; + } - (*ntlmssp_state)->unicode = True; + ntlmssp_state->role = NTLMSSP_CLIENT; - (*ntlmssp_state)->use_ntlmv2 = lp_client_ntlmv2_auth(); + ntlmssp_state->unicode = True; - (*ntlmssp_state)->expected_state = NTLMSSP_INITIAL; + ntlmssp_state->use_ntlmv2 = use_ntlmv2; - (*ntlmssp_state)->neg_flags = + ntlmssp_state->expected_state = NTLMSSP_INITIAL; + + ntlmssp_state->neg_flags = NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_ALWAYS_SIGN | NTLMSSP_NEGOTIATE_NTLM | @@ -1338,5 +1347,21 @@ NTSTATUS ntlmssp_client_start(struct ntlmssp_state **ntlmssp_state) NTLMSSP_NEGOTIATE_KEY_EXCH | NTLMSSP_REQUEST_TARGET; + ntlmssp_state->client.netbios_name = talloc_strdup(ntlmssp_state, netbios_name); + if (!ntlmssp_state->client.netbios_name) { + talloc_free(ntlmssp_state); + return NT_STATUS_NO_MEMORY; + } + ntlmssp_state->client.netbios_domain = talloc_strdup(ntlmssp_state, netbios_domain); + if (!ntlmssp_state->client.netbios_domain) { + talloc_free(ntlmssp_state); + return NT_STATUS_NO_MEMORY; + } + + /* TODO: remove this */ + ntlmssp_state->get_global_myname = global_myname; + ntlmssp_state->get_domain = lp_workgroup; + + *_ntlmssp_state = ntlmssp_state; return NT_STATUS_OK; } |