From: Volker Lendecke Date: Fri, 17 Jul 2020 10:36:22 +0000 (+0200) Subject: lib: Move send_keepalive() to smbd/smb1_utils.c X-Git-Tag: talloc-2.3.2~865 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e7f3e5e650b31c5cdd89dfa703844053b4e4885;p=thirdparty%2Fsamba.git lib: Move send_keepalive() to smbd/smb1_utils.c This is a SMB1-only packet sent from smbd only Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/include/proto.h b/source3/include/proto.h index 51bac188919..fe3acde078e 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -535,7 +535,6 @@ NTSTATUS read_fd_with_timeout(int fd, char *buf, size_t *size_ret); NTSTATUS read_data_ntstatus(int fd, char *buffer, size_t N); -bool send_keepalive(int client); NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf, unsigned int timeout, size_t *len); diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index 0b7029706a6..fb64c0e61cd 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -203,20 +203,6 @@ NTSTATUS read_data_ntstatus(int fd, char *buffer, size_t N) return read_fd_with_timeout(fd, buffer, N, N, 0, NULL); } -/**************************************************************************** - Send a keepalive packet (rfc1002). -****************************************************************************/ - -bool send_keepalive(int client) -{ - unsigned char buf[4]; - - buf[0] = NBSSkeepalive; - buf[1] = buf[2] = buf[3] = 0; - - return(write_data(client,(char *)buf,4) == 4); -} - /**************************************************************************** Read 4 bytes of a smb packet and return the smb length of the packet. Store the result in the buffer. diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 2bff5bf5a8f..5205674a006 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -46,6 +46,7 @@ #include "util_event.h" #include "libcli/smb/smbXcli_base.h" #include "lib/util/time_basic.h" +#include "smb1_utils.h" /* Internal message queue for deferred opens. */ struct pending_message_list { diff --git a/source3/smbd/smb1_utils.c b/source3/smbd/smb1_utils.c index 75bc16e1cc7..95aabddb997 100644 --- a/source3/smbd/smb1_utils.c +++ b/source3/smbd/smb1_utils.c @@ -22,6 +22,7 @@ #include "includes.h" #include "smb1_utils.h" #include "libcli/security/security.h" +#include "lib/util/sys_rw_data.h" /**************************************************************************** Special FCB or DOS processing in the case of a sharing violation. @@ -109,3 +110,17 @@ struct files_struct *fcb_or_dos_open( return new_fsp; } + +/**************************************************************************** + Send a keepalive packet (rfc1002). +****************************************************************************/ + +bool send_keepalive(int client) +{ + unsigned char buf[4]; + + buf[0] = NBSSkeepalive; + buf[1] = buf[2] = buf[3] = 0; + + return(write_data(client,(char *)buf,4) == 4); +} diff --git a/source3/smbd/smb1_utils.h b/source3/smbd/smb1_utils.h index 71f0c6d3ee6..2416a91148a 100644 --- a/source3/smbd/smb1_utils.h +++ b/source3/smbd/smb1_utils.h @@ -32,5 +32,6 @@ struct files_struct *fcb_or_dos_open( uint32_t access_mask, uint32_t create_options, uint32_t private_flags); +bool send_keepalive(int client); #endif