[bug]: SMB_OFF_T for VFS module in samba-2.2.3a tarball

Juergen Hasch Hasch at t-online.de
Fri Mar 8 13:34:07 GMT 2002


Am Dienstag, 5. März 2002 12:15 schrieb Timothee Besset:
> If you compile the example skel.so VFS module that comes with samba-2.2.3a
> tarball, SMB_OFF_T has sizeof 8 in the daemon, and 4 in the vfs module.
> This causes stack corruption in lseek function typically (and all others
> that use SMB_OFF_T prototypes).
>
> logged by smbd:
> sys_lseek fd 24 whence 136258136
> sizeof(SMB_OFF_T): 8
> seek_file: sys_lseek failed. Error was Invalid argument
> read_file: Failed to seek to 0
>
> logged by the skeleton module:
> Loading skeleton module!
> sizoef(SMB_OFF_T): 4
>
> This is on a Linux x86 Debian Woody
>
> note that this is samba-2.2.3a that I had to patch to fix the VFS code
> with Ries van twisk patches
>
> I also note that:
> sizeof(SMB_OFF_T) != SIZEOF_OFF_T
> the SIZEOF_OFF_T as defined in config.h is matching smbd, #define
> SIZEOF_OFF_T 8
>
> The only way I found around this is adding a #define SMB_OFF_T __off64_t
> in skel.c code before any #include <includes.h> and #include <vfs.h>
>
> TTimo

The same thing applies to Samba head. I added -D_LARGEFILE_SOURCE and 
-D_FILE_OFFSET_BITS=64 to the makefile to make it work:

CFLAGS = -I$(SAMBA_SRC) -I$(SAMBA_INCL) -I$(UBIQX_SRC) -I$(SMBWR_SRC) -Wall -g 
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -fno-builtin  

This is the way the Samba makefile does it.

...Juergen





More information about the samba-technical mailing list