[PATCH] fix client_reveive_smb() with signing

Stefan Metzmacher metze at metzemix.de
Tue Oct 21 08:10:35 GMT 2003


Hi Jeremy,

here' the patch which fixes the signing problem with the printer connections


-- 

metze

-------------------------------------------
Stefan (metze) Metzmacher <metze at metzemix.de>
-------------- next part --------------
Index: lib/util_sock.c
===================================================================
RCS file: /cvsroot/samba/source/lib/util_sock.c,v
retrieving revision 1.57.2.14
diff -u -r1.57.2.14 util_sock.c
--- lib/util_sock.c	23 Jul 2003 12:33:57 -0000	1.57.2.14
+++ lib/util_sock.c	21 Oct 2003 06:55:38 -0000
@@ -499,7 +499,7 @@
  This function will return on receipt of a session keepalive packet.
 ****************************************************************************/
 
-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 +509,7 @@
 
 	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
@@ -550,6 +550,15 @@
 				smb_read_error = READ_ERROR;
 			return False;
 		}
+	}
+
+	return True;
+}
+
+BOOL receive_smb(int fd,char *buffer, unsigned int timeout)
+{
+	if (!receive_smb_raw(fd, buffer, timeout)) {
+		return False;
 	}
 
 	/* Check the incoming SMB signature. */
Index: libsmb/clientgen.c
===================================================================
RCS file: /cvsroot/samba/source/libsmb/clientgen.c,v
retrieving revision 1.190.2.21
diff -u -r1.190.2.21 clientgen.c
--- libsmb/clientgen.c	4 Sep 2003 01:12:39 -0000	1.190.2.21
+++ libsmb/clientgen.c	21 Oct 2003 06:55:39 -0000
@@ -59,7 +59,7 @@
 	BOOL ret;
 
 	for(;;) {
-		ret = receive_smb(fd, buffer, timeout);
+		ret = receive_smb_raw(fd, buffer, timeout);
 
 		if (!ret) {
 			DEBUG(10,("client_receive_smb failed\n"));
Index: rpc_server/srv_spoolss_nt.c
===================================================================
RCS file: /cvsroot/samba/source/rpc_server/srv_spoolss_nt.c,v
retrieving revision 1.277.2.76
diff -u -r1.277.2.76 srv_spoolss_nt.c
--- rpc_server/srv_spoolss_nt.c	2 Oct 2003 17:36:47 -0000	1.277.2.76
+++ rpc_server/srv_spoolss_nt.c	21 Oct 2003 06:55:56 -0000
@@ -2598,7 +2598,8 @@
 	}
 
 	the_cli->protocol = PROTOCOL_NT1;
-    
+	cli_setup_signing_state(the_cli, lp_client_signing());
+  
 	if (!cli_negprot(the_cli)) {
 		DEBUG(0,("spoolss_connect_to_client: machine %s rejected the negotiate protocol. Error was : %s.\n", remote_machine, cli_errstr(the_cli) ));
 		cli_shutdown(the_cli);


More information about the samba-technical mailing list