summaryrefslogtreecommitdiff
path: root/source3/smbd/smb2_server.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2014-10-08 19:25:15 +0200
committerMichael Adam <obnox@samba.org>2015-05-08 13:00:28 +0200
commit08845ad61641a66f9019a9ae35ff765d9d093ea9 (patch)
tree7dd9ef1aca2ba7db6f989c10e1e0015787f57deb /source3/smbd/smb2_server.c
parentd9445854199caff2be08f59fe74c5791cbe473d8 (diff)
downloadsamba-08845ad61641a66f9019a9ae35ff765d9d093ea9.tar.gz
s3:smb2_negprot.c: add support SMB 3.1 negotiate contexts
Used for: - preauthentication validation - negotiation of ciphers for sigingn and encryprtion Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/smbd/smb2_server.c')
-rw-r--r--source3/smbd/smb2_server.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 9658534a062..9e5eff7cb60 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -30,6 +30,7 @@
#include "../librpc/gen_ndr/krb5pac.h"
#include "lib/util/iov_buf.h"
#include "auth.h"
+#include "lib/crypto/sha512.h"
static void smbd_smb2_connection_handler(struct tevent_context *ev,
struct tevent_fd *fde,
@@ -2523,6 +2524,33 @@ static NTSTATUS smbd_smb2_request_reply(struct smbd_smb2_request *req)
data_blob_clear_free(&req->first_key);
}
+ if (req->preauth != NULL) {
+ struct hc_sha512state sctx;
+ int i;
+
+ samba_SHA512_Init(&sctx);
+ samba_SHA512_Update(&sctx, req->preauth->sha512_value,
+ sizeof(req->preauth->sha512_value));
+ for (i = 1; i < req->in.vector_count; i++) {
+ samba_SHA512_Update(&sctx,
+ req->in.vector[i].iov_base,
+ req->in.vector[i].iov_len);
+ }
+ samba_SHA512_Final(req->preauth->sha512_value, &sctx);
+
+ samba_SHA512_Init(&sctx);
+ samba_SHA512_Update(&sctx, req->preauth->sha512_value,
+ sizeof(req->preauth->sha512_value));
+ for (i = 1; i < req->out.vector_count; i++) {
+ samba_SHA512_Update(&sctx,
+ req->out.vector[i].iov_base,
+ req->out.vector[i].iov_len);
+ }
+ samba_SHA512_Final(req->preauth->sha512_value, &sctx);
+
+ req->preauth = NULL;
+ }
+
/* I am a sick, sick man... :-). Sendfile hack ... JRA. */
if (req->out.vector_count < (2*SMBD_SMB2_NUM_IOV_PER_REQ) &&
outdyn->iov_base == NULL && outdyn->iov_len != 0) {