diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index aa549c9cc3e..134d8190603 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -896,7 +896,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); +bool valid_smb1_header(const uint8_t *inbuf); bool init_smb_request(struct smb_request *req, struct smbd_server_connection *sconn, struct smbXsrv_connection *xconn, diff --git a/source3/smbd/smb1_process.c b/source3/smbd/smb1_process.c index 1c747105f5e..c8957ef6b92 100644 --- a/source3/smbd/smb1_process.c +++ b/source3/smbd/smb1_process.c @@ -1477,7 +1477,7 @@ void process_smb1(struct smbXsrv_connection *xconn, /* Make sure this is an SMB packet. smb_size contains NetBIOS header * so subtract 4 from it. */ - if ((nread < (smb_size - 4)) || !valid_smb_header(inbuf)) { + if ((nread < (smb_size - 4)) || !valid_smb1_header(inbuf)) { DEBUG(2,("Non-SMB packet of length %d. Terminating server\n", smb_len(inbuf))); @@ -2346,7 +2346,7 @@ static bool smbd_echo_reply(struct smbd_echo_state *state, DEBUG(10, ("Got short packet: %d bytes\n", (int)inbuf_len)); return false; } - if (!valid_smb_header(inbuf)) { + if (!valid_smb1_header(inbuf)) { DEBUG(10, ("Got invalid SMB header\n")); return false; } diff --git a/source3/smbd/smb2_process.c b/source3/smbd/smb2_process.c index 545649701e7..e726167d779 100644 --- a/source3/smbd/smb2_process.c +++ b/source3/smbd/smb2_process.c @@ -568,7 +568,7 @@ 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) +bool valid_smb1_header(const uint8_t *inbuf) { if (is_encrypted_packet(inbuf)) { return true; @@ -631,7 +631,7 @@ void process_smb(struct smbXsrv_connection *xconn, return; #if defined(WITH_SMB1SERVER) } - if (nread >= smb_size && valid_smb_header(inbuf) + if (nread >= smb_size && valid_smb1_header(inbuf) && CVAL(inbuf, smb_com) != 0x72) { /* This is a non-negprot SMB1 packet. Disable SMB2 from now on. */ @@ -940,7 +940,7 @@ static void smbd_smb2_server_connection_read_handler( exit_server_cleanly("Invalid initial SMB1 or SMB2 packet"); return; } - if (valid_smb_header(buffer)) { + if (valid_smb1_header(buffer)) { /* Can *only* allow an SMB1 negprot here. */ uint8_t cmd = PULL_LE_U8(buffer, smb_com); if (cmd != SMBnegprot) {