samba4 - SVN 4328 startp panic on FreeBSD

Joerg Pulz Joerg.Pulz at frm2.tum.de
Wed Dec 22 13:32:02 GMT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

i could successfully configure and compile the current svn version of 
samba4.
unfortunately, if i try to start smbd, it panics and dumps core.
the problem is in smbd/service.c in function 'service_cleanup_tmp_files()'
the test for the returned errno of 'unlink(fname)' is weak and very Linux 
specific. the panic occurs while 'unlink' tries to delete the "." (dot) 
and ".." (dot-dot) and later the "messaging" directories.

some thoughts and facts:

1. EISDIR is only available on Linux and True64 as far as i can test
2. EISDIR is tested twice after 'unlink(fname)' fails and i don't see why
3. EPERM reflects that the 'unlink(fname)' failed if 'fname' was a
     directory (at least on linux, True64, IRIX and FreeBSD)
     unfortunately, EPERM also means "Operation not permitted", which can
     confuse some people.
4. at least on Linux and FreeBSD, 'struct dirent' has a member 'd_type'
     which contains the type of 'fname'. if de->d_type == DT_DIR is true
     'fname' is a directory.
5. 'strcmp' can be used to compare 'de->d_name' to well know directory
     names (eg. ".", ".." and "messaging") and hide these from 'unlink'


the simplest and less confusing way would probably point 5 as this should 
work on the most systems. point 3 is a variant, but as already said, can 
confuse some people. point 4 is in my opinion the cleanest but is like 
EISDIR limited to some systems which support this.

i have not included a patch, as i don't know which version to prefer.

any comments would be appreciated.
regards
Joerg

- -- 
The beginning is the most important part of the work.
  				-Plato
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (FreeBSD)

iD8DBQFByXdVSPOsGF+KA+MRAjQgAJ4lfzzF5xRMEgoh2qrLKRemeI2HxwCfcerg
osQslhyvj4UGJPk6KULMZaA=
=cPn8
-----END PGP SIGNATURE-----


More information about the samba-technical mailing list