summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-08-06 10:42:30 +0200
committerStefan Metzmacher <metze@samba.org>2012-08-07 11:16:37 +0200
commitaba6df9f5502fcb3fb8b86ae14890554065155f8 (patch)
tree45ad4230376319b202f2b123dfbb96d4dbf8f836
parente01333242f149fcbdd9db3b2195c1543c3f0647f (diff)
downloadsamba-aba6df9f5502fcb3fb8b86ae14890554065155f8.tar.gz
samba-aba6df9f5502fcb3fb8b86ae14890554065155f8.tar.bz2
samba-aba6df9f5502fcb3fb8b86ae14890554065155f8.zip
s3:smb2_server: add and use smbd_smb2_call()
metze
-rw-r--r--source3/smbd/smb2_server.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 5fcf03c51c..4ee0e2f0b5 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -131,6 +131,21 @@ const char *smb2_opcode_name(uint16_t opcode)
return smbd_smb2_table[opcode].name;
}
+static const struct smbd_smb2_dispatch_table *smbd_smb2_call(uint16_t opcode)
+{
+ const struct smbd_smb2_dispatch_table *ret = NULL;
+
+ if (opcode >= ARRAY_SIZE(smbd_smb2_table)) {
+ return NULL;
+ }
+
+ ret = &smbd_smb2_table[opcode];
+
+ SMB_ASSERT(ret->opcode == opcode);
+
+ return ret;
+}
+
static void print_req_vectors(struct smbd_smb2_request *req)
{
int i;
@@ -1638,6 +1653,7 @@ NTSTATUS smbd_smb2_request_verify_sizes(struct smbd_smb2_request *req,
NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req)
{
struct smbXsrv_connection *conn = req->sconn->conn;
+ const struct smbd_smb2_dispatch_table *call = NULL;
const uint8_t *inhdr;
uint16_t opcode;
uint32_t flags;
@@ -1680,6 +1696,11 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req)
}
}
+ call = smbd_smb2_call(opcode);
+ if (call == NULL) {
+ return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
+ }
+
allowed_flags = SMB2_HDR_FLAG_CHAINED |
SMB2_HDR_FLAG_SIGNED |
SMB2_HDR_FLAG_DFS;