]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Move valid_smb_header to smb2_process.c
authorDavid Mulder <dmulder@suse.com>
Fri, 25 Mar 2022 19:59:14 +0000 (13:59 -0600)
committerJeremy Allison <jra@samba.org>
Thu, 7 Apr 2022 17:37:30 +0000 (17:37 +0000)
valid_smb_header is needed for a multi-protocol
negotiation.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/proto.h
source3/smbd/smb1_process.c
source3/smbd/smb1_process.h
source3/smbd/smb2_process.c

index 426e7fdc2d07e32eb724b74ea04a53bf8506a84e..35f0c1ef721cca71a44d7243976ff2c72ea48c44 100644 (file)
@@ -891,6 +891,7 @@ void smbd_process(struct tevent_context *ev_ctx,
                  struct messaging_context *msg_ctx,
                  int sock_fd,
                  bool interactive);
+bool valid_smb_header(const uint8_t *inbuf);
 
 /* The following definitions come from smbd/quotas.c  */
 
index 7d568ec7067f2b0aeec1dd5388a35bab55f2dd38..cbd0a8aa334afd65bd4326d5e496bb0e6bc693ea 100644 (file)
@@ -276,18 +276,6 @@ out:
        return (ret > 0);
 }
 
-bool valid_smb_header(const uint8_t *inbuf)
-{
-       if (is_encrypted_packet(inbuf)) {
-               return true;
-       }
-       /*
-        * This used to be (strncmp(smb_base(inbuf),"\377SMB",4) == 0)
-        * but it just looks weird to call strncmp for this one.
-        */
-       return (IVAL(smb_base(inbuf), 0) == 0x424D53FF);
-}
-
 /* Socket functions for smbd packet processing. */
 
 static bool valid_packet_size(size_t len)
index 234a19599ab1d992c71ed2ae947ff113f4b804ba..53074e090f6f19d0221f5cc4f1ebd9107e5c5dc2 100644 (file)
@@ -57,7 +57,6 @@ void process_smb1(struct smbXsrv_connection *xconn,
                  uint8_t *inbuf, size_t nread, size_t unread_bytes,
                  uint32_t seqnum, bool encrypted,
                  struct smb_perfcount_data *deferred_pcd);
-bool valid_smb_header(const uint8_t *inbuf);
 void smbd_echo_init(struct smbXsrv_connection *xconn);
 void construct_reply(struct smbXsrv_connection *xconn,
                     char *inbuf, int size, size_t unread_bytes,
index 81bde560f321b852e80b289f787dd5bc9628ccd3..0bc77b971202ed6317488b1c3ddd4dc6fae791b1 100644 (file)
@@ -570,6 +570,18 @@ void reply_outbuf(struct smb_request *req, uint8_t num_words, uint32_t num_bytes
        req->outbuf = (uint8_t *)outbuf;
 }
 
+bool valid_smb_header(const uint8_t *inbuf)
+{
+       if (is_encrypted_packet(inbuf)) {
+               return true;
+       }
+       /*
+        * This used to be (strncmp(smb_base(inbuf),"\377SMB",4) == 0)
+        * but it just looks weird to call strncmp for this one.
+        */
+       return (IVAL(smb_base(inbuf), 0) == 0x424D53FF);
+}
+
 /****************************************************************************
  Process an smb from the client
 ****************************************************************************/