static const uint8_t *get_challenge(const struct ntlmssp_state *ntlmssp_state)
{
- uint8_t *chal = talloc(ntlmssp_state, 8);
+ uint8_t *chal = talloc_size(ntlmssp_state, 8);
generate_random_buffer(chal, 8);
return chal;
NTSTATUS ntlmssp_set_username(struct ntlmssp_state *ntlmssp_state, const char *user)
{
+ if (!user) {
+ /* it should be at least "" */
+ return NT_STATUS_INVALID_PARAMETER;
+ }
ntlmssp_state->user = talloc_strdup(ntlmssp_state, user);
if (!ntlmssp_state->user) {
return NT_STATUS_NO_MEMORY;
"NTLMSSP",
&ntlmssp_command)) {
DEBUG(1, ("Failed to parse NTLMSSP packet, could not extract NTLMSSP command\n"));
- dump_data(2, (const char *)input.data, input.length);
+ dump_data(2, input.data, input.length);
return NT_STATUS_INVALID_PARAMETER;
}
}
&cliname,
&domname)) {
DEBUG(1, ("ntlmssp_server_negotiate: failed to parse NTLMSSP:\n"));
- dump_data(2, (const char *)in.data, in.length);
+ dump_data(2, in.data, in.length);
return NT_STATUS_INVALID_PARAMETER;
}
&ntlmssp_state->encrypted_session_key,
&auth_flags)) {
DEBUG(10, ("ntlmssp_server_auth: failed to parse NTLMSSP (nonfatal):\n"));
- dump_data(10, (const char *)request.data, request.length);
+ dump_data(10, request.data, request.length);
/* zero this out */
data_blob_free(&ntlmssp_state->encrypted_session_key);
&user,
&workstation)) {
DEBUG(1, ("ntlmssp_server_auth: failed to parse NTLMSSP:\n"));
- dump_data(2, (const char *)request.data, request.length);
+ dump_data(2, request.data, request.length);
return NT_STATUS_INVALID_PARAMETER;
}
NTSTATUS ntlmssp_server_start(TALLOC_CTX *mem_ctx, struct ntlmssp_state **ntlmssp_state)
{
- *ntlmssp_state = talloc_p(mem_ctx, struct ntlmssp_state);
+ *ntlmssp_state = talloc(mem_ctx, struct ntlmssp_state);
if (!*ntlmssp_state) {
DEBUG(0,("ntlmssp_server_start: talloc failed!\n"));
return NT_STATUS_NO_MEMORY;
&server_domain_blob,
&chal_flags)) {
DEBUG(1, ("Failed to parse the NTLMSSP Challenge: (#1)\n"));
- dump_data(2, (const char *)in.data, in.length);
+ dump_data(2, in.data, in.length);
return NT_STATUS_INVALID_PARAMETER;
}
&unkn1, &unkn2,
&struct_blob)) {
DEBUG(1, ("Failed to parse the NTLMSSP Challenge: (#2)\n"));
- dump_data(2, (const char *)in.data, in.length);
+ dump_data(2, in.data, in.length);
return NT_STATUS_INVALID_PARAMETER;
}
ntlmssp_state->domain,
ntlmssp_state->password, &challenge_blob,
&struct_blob,
- &lm_response, &nt_response, &session_key)) {
+ &lm_response, &nt_response,
+ NULL, &session_key)) {
data_blob_free(&challenge_blob);
data_blob_free(&struct_blob);
return NT_STATUS_NO_MEMORY;
DEBUG(5, ("NTLMSSP challenge set by NTLM2\n"));
DEBUG(5, ("challenge is: \n"));
- dump_data(5, (const char *)session_nonce_hash, 8);
+ dump_data(5, session_nonce_hash, 8);
nt_response = data_blob_talloc(ntlmssp_state, NULL, 24);
SMBNTencrypt(ntlmssp_state->password,
ntlmssp_state->expected_state = NTLMSSP_DONE;
- if (!NT_STATUS_IS_OK(nt_status = ntlmssp_sign_init(ntlmssp_state))) {
+ nt_status = ntlmssp_sign_init(ntlmssp_state);
+ if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(1, ("Could not setup NTLMSSP signing/sealing system (error was: %s)\n",
nt_errstr(nt_status)));
return nt_status;
}
- return NT_STATUS_MORE_PROCESSING_REQUIRED;
+ return nt_status;
}
NTSTATUS ntlmssp_client_start(TALLOC_CTX *mem_ctx, struct ntlmssp_state **ntlmssp_state)
{
- *ntlmssp_state = talloc_p(mem_ctx, struct ntlmssp_state);
+ *ntlmssp_state = talloc(mem_ctx, struct ntlmssp_state);
if (!*ntlmssp_state) {
DEBUG(0,("ntlmssp_client_start: talloc failed!\n"));
return NT_STATUS_NO_MEMORY;