summaryrefslogtreecommitdiff
path: root/source3/lib/util_sock.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-10-21 21:19:00 +0000
committerJeremy Allison <jra@samba.org>2003-10-21 21:19:00 +0000
commitf589164ed94d79161d0798296c325b81c5eadbc7 (patch)
tree83a14b6ae1ada17b4c8d954e9ee7bcce8ff06b13 /source3/lib/util_sock.c
parent3fe18a46a33cc1c0a0ecfefc61618356d7746a15 (diff)
downloadsamba-f589164ed94d79161d0798296c325b81c5eadbc7.tar.gz
samba-f589164ed94d79161d0798296c325b81c5eadbc7.tar.bz2
samba-f589164ed94d79161d0798296c325b81c5eadbc7.zip
Patch from Stefan Metzmacher <metze@metzemix.de> to fix signing problems
when reverse connecting back to a client for printer notify. Jeremy. (This used to be commit 06aa434c3fdb139e3f3143d19413556945cbcd4f)
Diffstat (limited to 'source3/lib/util_sock.c')
-rw-r--r--source3/lib/util_sock.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index b8b8471708..5a1f631ba4 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -497,9 +497,10 @@ ssize_t read_smb_length(int fd,char *inbuf,unsigned int timeout)
BUFFER_SIZE+SAFETY_MARGIN.
The timeout is in milliseconds.
This function will return on receipt of a session keepalive packet.
+ Doesn't check the MAC on signed packets.
****************************************************************************/
-BOOL receive_smb(int fd,char *buffer, unsigned int timeout)
+BOOL receive_smb_raw(int fd,char *buffer, unsigned int timeout)
{
ssize_t len,ret;
@@ -509,7 +510,7 @@ BOOL receive_smb(int fd,char *buffer, unsigned int timeout)
len = read_smb_length_return_keepalive(fd,buffer,timeout);
if (len < 0) {
- DEBUG(10,("receive_smb: length < 0!\n"));
+ DEBUG(10,("receive_smb_raw: length < 0!\n"));
/*
* Correct fix. smb_read_error may have already been
@@ -552,6 +553,20 @@ BOOL receive_smb(int fd,char *buffer, unsigned int timeout)
}
}
+ return True;
+}
+
+/****************************************************************************
+ Wrapper for receive_smb_raw().
+ Checks the MAC on signed packets.
+****************************************************************************/
+
+BOOL receive_smb(int fd,char *buffer, unsigned int timeout)
+{
+ if (!receive_smb_raw(fd, buffer, timeout)) {
+ return False;
+ }
+
/* Check the incoming SMB signature. */
if (!srv_check_sign_mac(buffer)) {
DEBUG(0, ("receive_smb: SMB Signature verification failed on incoming packet!\n"));