2.0.4b - Bug in dfree > 2GB reporting for 16-bit clients

Douglas K. Fischer skeet at Bridgewater.EDU
Thu Jun 24 20:04:12 GMT 1999


In 2.0.4b using a 16-bit client (in this case Lanman for DOS), disk space
reporting for partitions greater than 2GB always reports 0 space free.
I've tracked this down to the disk_norm routine in the smbd/dfree.c file.

In the code for adjusting block size and disk size/free values for 16-bit
reporting, WORDMAX was incorrectly being multiplied by 512 before being
compared with bsize. This resulted in the offending values not being
truncated to fit into 16-bit fields.

I've included a patch below to fix this:

----- begin dfree.c.patch -----
*** smbd/dfree.c.orig   Mon Feb  1 18:37:33 1999
--- smbd/dfree.c        Thu Jun 24 14:54:47 1999
***************
*** 48,55 ****
                        /*
                         * Force max to fit in 16 bit fields.
                         */
!                       if (*bsize > (WORDMAX*512)) {
!                               *bsize = (WORDMAX*512);
                                if (*dsize > WORDMAX)
                                        *dsize = WORDMAX;
                                if (*dfree >  WORDMAX)
--- 48,55 ----
                        /*
                         * Force max to fit in 16 bit fields.
                         */
!                       if (*bsize > (WORDMAX)) {
!                               *bsize = (WORDMAX);
                                if (*dsize > WORDMAX)
                                        *dsize = WORDMAX;
                                if (*dfree >  WORDMAX)
----- end dfree.c.patch -----

Douglas
 ----------------------------------------------------------------------
  Douglas K. Fischer    DFischer at Bridgewater.EDU      (540) 828 - 5343
  Network Systems Engineer               Information Technology Center
  College Box 36        Bridgewater College      Bridgewater, VA 22812
  Internet: http://www.bridgewater.edu/~dfischer FAX: (540) 828 - 5493
 ----------------------------------------------------------------------



More information about the samba-technical mailing list