summaryrefslogtreecommitdiff
path: root/source3/libsmb/ntlmssp.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-11-08 17:25:45 -0800
committerJeremy Allison <jra@samba.org>2007-11-08 17:25:45 -0800
commitd40e47db4b5da41c8604a2058f3a0b0a82164f08 (patch)
tree1974bfa70d7b527714b8c68c40e33f2b88efb9e1 /source3/libsmb/ntlmssp.c
parent976b0ec487720982e456f8c3634be3df64882dae (diff)
downloadsamba-d40e47db4b5da41c8604a2058f3a0b0a82164f08.tar.gz
samba-d40e47db4b5da41c8604a2058f3a0b0a82164f08.tar.bz2
samba-d40e47db4b5da41c8604a2058f3a0b0a82164f08.zip
Remove more fstring/pstring bad useage. Go talloc !
Jeremy. (This used to be commit 2a0173743d2cf615d52278f3dd87cc804abe2d16)
Diffstat (limited to 'source3/libsmb/ntlmssp.c')
-rw-r--r--source3/libsmb/ntlmssp.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/source3/libsmb/ntlmssp.c b/source3/libsmb/ntlmssp.c
index 7205d57a0a..ed08e8102b 100644
--- a/source3/libsmb/ntlmssp.c
+++ b/source3/libsmb/ntlmssp.c
@@ -501,18 +501,19 @@ DATA_BLOB ntlmssp_weaken_keys(NTLMSSP_STATE *ntlmssp_state, TALLOC_CTX *mem_ctx)
/**
* Next state function for the Negotiate packet
- *
+ *
* @param ntlmssp_state NTLMSSP State
* @param request The request, as a DATA_BLOB
* @param request The reply, as an allocated DATA_BLOB, caller to free.
- * @return Errors or MORE_PROCESSING_REQUIRED if a reply is sent.
+ * @return Errors or MORE_PROCESSING_REQUIRED if a reply is sent.
*/
static NTSTATUS ntlmssp_server_negotiate(struct ntlmssp_state *ntlmssp_state,
const DATA_BLOB request, DATA_BLOB *reply)
{
DATA_BLOB struct_blob;
- fstring dnsname, dnsdomname;
+ const char *dnsname;
+ char *dnsdomname = NULL;
uint32 neg_flags = 0;
uint32 ntlmssp_command, chal_flags;
const uint8 *cryptkey;
@@ -535,7 +536,7 @@ static NTSTATUS ntlmssp_server_negotiate(struct ntlmssp_state *ntlmssp_state,
}
debug_ntlmssp_flags(neg_flags);
}
-
+
ntlmssp_handle_neg_flags(ntlmssp_state, neg_flags, lp_lanman_auth());
/* Ask our caller what challenge they would like in the packet */
@@ -548,31 +549,34 @@ static NTSTATUS ntlmssp_server_negotiate(struct ntlmssp_state *ntlmssp_state,
/* The flags we send back are not just the negotiated flags,
* they are also 'what is in this packet'. Therfore, we
- * operate on 'chal_flags' from here on
+ * operate on 'chal_flags' from here on
*/
chal_flags = ntlmssp_state->neg_flags;
/* get the right name to fill in as 'target' */
- target_name = ntlmssp_target_name(ntlmssp_state,
- neg_flags, &chal_flags);
- if (target_name == NULL)
+ target_name = ntlmssp_target_name(ntlmssp_state,
+ neg_flags, &chal_flags);
+ if (target_name == NULL)
return NT_STATUS_INVALID_PARAMETER;
ntlmssp_state->chal = data_blob_talloc(ntlmssp_state->mem_ctx, cryptkey, 8);
ntlmssp_state->internal_chal = data_blob_talloc(ntlmssp_state->mem_ctx, cryptkey, 8);
-
/* This should be a 'netbios domain -> DNS domain' mapping */
- dnsdomname[0] = '\0';
- get_mydnsdomname(dnsdomname);
+ dnsdomname = get_mydnsdomname(ntlmssp_state->mem_ctx);
+ if (!dnsdomname) {
+ return NT_STATUS_BAD_NETWORK_NAME;
+ }
strlower_m(dnsdomname);
-
- dnsname[0] = '\0';
- get_mydnsfullname(dnsname);
-
+
+ dnsname = get_mydnsfullname();
+ if (!dnsdomname) {
+ return NT_STATUS_INVALID_COMPUTER_NAME;
+ }
+
/* This creates the 'blob' of names that appears at the end of the packet */
- if (chal_flags & NTLMSSP_CHAL_TARGET_INFO)
+ if (chal_flags & NTLMSSP_CHAL_TARGET_INFO)
{
msrpc_gen(&struct_blob, "aaaaa",
NTLMSSP_NAME_TYPE_DOMAIN, target_name,
@@ -592,9 +596,9 @@ static NTSTATUS ntlmssp_server_negotiate(struct ntlmssp_state *ntlmssp_state,
} else {
gen_string = "CdAdbddB";
}
-
+
msrpc_gen(reply, gen_string,
- "NTLMSSP",
+ "NTLMSSP",
NTLMSSP_CHALLENGE,
target_name,
chal_flags,
@@ -602,7 +606,7 @@ static NTSTATUS ntlmssp_server_negotiate(struct ntlmssp_state *ntlmssp_state,
0, 0,
struct_blob.data, struct_blob.length);
}
-
+
data_blob_free(&struct_blob);
ntlmssp_state->expected_state = NTLMSSP_AUTH;
@@ -612,7 +616,7 @@ static NTSTATUS ntlmssp_server_negotiate(struct ntlmssp_state *ntlmssp_state,
/**
* Next state function for the Authenticate packet
- *
+ *
* @param ntlmssp_state NTLMSSP State
* @param request The request, as a DATA_BLOB
* @param request The reply, as an allocated DATA_BLOB, caller to free.