summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-08-03 09:33:29 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-08-03 12:45:04 +0200
commitfec25c3a627bfbb14cf0aaf8773f54e0e5017517 (patch)
treec49e380c6ecfb3410133119e60c3ba702fbb2286 /source3
parentd811862b453cc616650cdc10f4d69b239d66943a (diff)
downloadsamba-fec25c3a627bfbb14cf0aaf8773f54e0e5017517.tar.gz
samba-fec25c3a627bfbb14cf0aaf8773f54e0e5017517.tar.bz2
samba-fec25c3a627bfbb14cf0aaf8773f54e0e5017517.zip
ntlmssp: Add ntlmssp_blob_matches_magic()
This avoids having the same check in 3 different parts of the code Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Wed Aug 3 12:45:04 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/sesssetup.c2
-rw-r--r--source3/smbd/smb2_sesssetup.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index 8b133b4a54..6dc8609071 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -1140,7 +1140,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
* identical regardless. In particular, both rely only on the
* status code (not the contents of the packet) and do not
* wrap the result */
- if (sconn->use_gensec_hook || (blob1.length > 7 && strncmp((char *)(blob1.data), "NTLMSSP", 7) == 0)) {
+ if (sconn->use_gensec_hook || ntlmssp_blob_matches_magic(&blob1)) {
DATA_BLOB chal;
if (!vuser->auth_ntlmssp_state) {
diff --git a/source3/smbd/smb2_sesssetup.c b/source3/smbd/smb2_sesssetup.c
index 6517fb6d00..30e65c2137 100644
--- a/source3/smbd/smb2_sesssetup.c
+++ b/source3/smbd/smb2_sesssetup.c
@@ -753,7 +753,7 @@ static NTSTATUS smbd_smb2_session_setup(struct smbd_smb2_request *smb2req,
* status code (not the contents of the packet) and do not
* wrap the result */
if (session->sconn->use_gensec_hook
- || (in_security_buffer.length > 7 && strncmp((char *)(in_security_buffer.data), "NTLMSSP", 7) == 0)) {
+ || ntlmssp_blob_matches_magic(&in_security_buffer)) {
return smbd_smb2_raw_ntlmssp_auth(session,
smb2req,
in_security_mode,