svn commit: samba r22924 - in branches: SAMBA_3_0/source/libsmb SAMBA_3_0_26/source/libsmb

jra at samba.org jra at samba.org
Wed May 16 01:34:24 GMT 2007


Author: jra
Date: 2007-05-16 01:34:22 +0000 (Wed, 16 May 2007)
New Revision: 22924

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22924

Log:
Fix the build by correctly processing readX
errors in the direct read case.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/libsmb/clientgen.c
   branches/SAMBA_3_0_26/source/libsmb/clientgen.c


Changeset:
Modified: branches/SAMBA_3_0/source/libsmb/clientgen.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/clientgen.c	2007-05-16 01:13:25 UTC (rev 22923)
+++ branches/SAMBA_3_0/source/libsmb/clientgen.c	2007-05-16 01:34:22 UTC (rev 22924)
@@ -249,30 +249,34 @@
 		}
 	}
 
-	/* Check it's a non-chained readX reply. */
-	if (!(CVAL(cli->inbuf, smb_flg) & FLAG_REPLY) ||
-		(CVAL(cli->inbuf,smb_vwv0) != 0xFF) ||
-		(CVAL(cli->inbuf,smb_com) != SMBreadX)) {
+	/* If it's not the above size it probably was an error packet. */
+
+	if ((len == (smb_size - 4) + 24) && !cli_is_error(cli)) {
+		/* Check it's a non-chained readX reply. */
+		if (!(CVAL(cli->inbuf, smb_flg) & FLAG_REPLY) ||
+			(CVAL(cli->inbuf,smb_vwv0) != 0xFF) ||
+			(CVAL(cli->inbuf,smb_com) != SMBreadX)) {
+			/* 
+			 * We're not coping here with asnyc replies to
+			 * other calls. Punt here - we need async client
+			 * libs for this.
+			 */
+			goto read_err;
+		}
+
 		/* 
-		 * We're not coping here with asnyc replies to
-		 * other calls. Punt here - we need async client
-		 * libs for this.
+		 * We know it's a readX reply - ensure we've read the
+		 * padding bytes also.
 		 */
-		goto read_err;
-	}
 
-	/* 
-	 * We know it's a readX reply - ensure we've read the
-	 * padding bytes also.
-	 */
-
-	offset = SVAL(cli->inbuf,smb_vwv6);
-	if (offset > len) {
-		ssize_t ret;
-		size_t padbytes = offset - len;
-		ret = cli_receive_smb_data(cli,smb_buf(cli->inbuf),padbytes);
-                if (ret != padbytes) {
-			goto read_err;
+		offset = SVAL(cli->inbuf,smb_vwv6);
+		if (offset > len) {
+			ssize_t ret;
+			size_t padbytes = offset - len;
+			ret = cli_receive_smb_data(cli,smb_buf(cli->inbuf),padbytes);
+			if (ret != padbytes) {
+				goto read_err;
+			}
 		}
 	}
 

Modified: branches/SAMBA_3_0_26/source/libsmb/clientgen.c
===================================================================
--- branches/SAMBA_3_0_26/source/libsmb/clientgen.c	2007-05-16 01:13:25 UTC (rev 22923)
+++ branches/SAMBA_3_0_26/source/libsmb/clientgen.c	2007-05-16 01:34:22 UTC (rev 22924)
@@ -207,30 +207,34 @@
 		}
 	}
 
-	/* Check it's a non-chained readX reply. */
-	if (!(CVAL(cli->inbuf, smb_flg) & FLAG_REPLY) ||
-		(CVAL(cli->inbuf,smb_vwv0) != 0xFF) ||
-		(CVAL(cli->inbuf,smb_com) != SMBreadX)) {
+	/* If it's not the above size it probably was an error packet. */
+
+	if ((len == (smb_size - 4) + 24) && !cli_is_error(cli)) {
+		/* Check it's a non-chained readX reply. */
+		if (!(CVAL(cli->inbuf, smb_flg) & FLAG_REPLY) ||
+			(CVAL(cli->inbuf,smb_vwv0) != 0xFF) ||
+			(CVAL(cli->inbuf,smb_com) != SMBreadX)) {
+			/* 
+			 * We're not coping here with asnyc replies to
+			 * other calls. Punt here - we need async client
+			 * libs for this.
+			 */
+			goto read_err;
+		}
+
 		/* 
-		 * We're not coping here with asnyc replies to
-		 * other calls. Punt here - we need async client
-		 * libs for this.
+		 * We know it's a readX reply - ensure we've read the
+		 * padding bytes also.
 		 */
-		goto read_err;
-	}
 
-	/* 
-	 * We know it's a readX reply - ensure we've read the
-	 * padding bytes also.
-	 */
-
-	offset = SVAL(cli->inbuf,smb_vwv6);
-	if (offset > len) {
-		ssize_t ret;
-		size_t padbytes = offset - len;
-		ret = cli_receive_smb_data(cli,smb_buf(cli->inbuf),padbytes);
-                if (ret != padbytes) {
-			goto read_err;
+		offset = SVAL(cli->inbuf,smb_vwv6);
+		if (offset > len) {
+			ssize_t ret;
+			size_t padbytes = offset - len;
+			ret = cli_receive_smb_data(cli,smb_buf(cli->inbuf),padbytes);
+			if (ret != padbytes) {
+				goto read_err;
+			}
 		}
 	}
 



More information about the samba-cvs mailing list