[Samba] About Length of Mountpoint(mounting smb shares on linux mntpoint)

Urban Widmark urban at teststation.com
Sat Feb 9 15:56:04 GMT 2002


On Wed, 6 Feb 2002, Louis Lam wrote:

> smbmnt.c(ver samba-2.0.7), uses fullpath() to check for the MAXPATHLEN of 
> the mount-point specified. Unless i've made a mistake, the MAXPATHLEN is 
> defined in "includes.h" which is of len 256. fullpath() checks this 

It is defined only if it is not already defined on the system.


> I've tried to create a directory(mount point) whose name is 256 chars long, 
> and I can still call smbmount to mount it.
> 
> Q1. In this case, shouldn't fullpath return NULL and the smbmount(which in 
> turn calls smbmnt) fail?

No. In glibc 2.2 sys/param.h defines MAXPATHLEN to be PATH_MAX, which is
defined elsewhere to 4096 or so.

> Q2. What is the reason for checking this MAXPATHLEN?

smbmnt calls realpath() and the second argument must be a buffer of
PATH_MAX size.

I see no real reason to check the length of the input data, as realpath()
must check the length of the resolved path anyway. Someone was being
paranoid, possibly to guard vs some libc5 bug ...

/Urban





More information about the samba-technical mailing list