[PATCH][SMB1] SMB_INFO_ALLOC return UINT_MAX rather than cut at 4-byte

Volker Lendecke Volker.Lendecke at SerNet.DE
Mon May 15 12:35:54 UTC 2017


On Mon, May 15, 2017 at 10:26:04AM +0000, Peter Somogyi wrote:
> Yes, here it is:

Thanks!

Reformatted the commit msg, added a comment, reviewed.

Another Team review?

Thanks, Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From e75f67ecc7056de017d3afad0be2e35034c7236e Mon Sep 17 00:00:00 2001
From: Peter Somogyi <psomogyi at hu.ibm.com>
Date: Mon, 15 May 2017 10:21:01 +0200
Subject: [PATCH] SMB_INFO_ALLOCATION: return with UINT32_MAX rather than
 cutting at 4 bytes

An AIX cifs client queries SMB_INFO_ALLOCATION that has only 4 bytes to report
dfree and dsize. Return the max instead of random unexpeced numbers.

Signed-off-by: Peter Somogyi <psomogyi at hu.ibm.com>
Reviewed-by: Volker Lendecke <vl at samba.org>
---
 source3/smbd/trans2.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index e8346ba..01df2ee 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -3510,6 +3510,12 @@ NTSTATUS smbd_do_qfsinfo(struct smbXsrv_connection *xconn,
 cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)st.st_ex_dev, (unsigned int)bsize, (unsigned int)sectors_per_unit,
 				(unsigned int)bytes_per_sector, (unsigned int)dsize, (unsigned int)dfree));
 
+			/*
+			 * For large drives, return max values and not modulo.
+			 */
+			dsize = MIN(dsize, UINT32_MAX);
+			dfree = MIN(dfree, UINT32_MAX);
+
 			SIVAL(pdata,l1_idFileSystem,st.st_ex_dev);
 			SIVAL(pdata,l1_cSectorUnit,sectors_per_unit);
 			SIVAL(pdata,l1_cUnit,dsize);
-- 
2.1.4



More information about the samba-technical mailing list