Samba doesn't fully respect directory permissions?

David Collier-Brown davecb at Canada.Sun.COM
Thu Nov 19 16:31:02 GMT 1998


Mass Sivilotti wrote:
>			 Granted, the Explorer
> window is EMPTY (i.e., regardless of the actual contents of
> the directory, Explorer shows no files, consistent with
> the UNIX permisssion of not allowing searching), but the very fact
> that the window opens and the directory APPEARS empty is confusing
> some folks. Wouldn't it be better if you got a permission denied
> message when you opened the dir in the first place?

	Hmmn: I misspoke, before.  
	It is an artifact of Unix/Windows permissions, but
	it seems bizarre that Samba doesn't fail in the
	cd-equivalent...

	OOK!  Found it. Any change-directory operation is 
	done as a lazy evaluation, just like Unix.
	Therefor, the cd should fail if and only if there is
	no execute on the directory or some directory in the
	path to it.

	On unix, we get
$ mkdir zguk
$ chmod a-x zguk
$ cd zguk
/bin/ksh: zguk: permission denied
	
	ok, as expected...

$ chmod +x zguk
$ chmod a-r zguk
$ ls zguk
zguk: Permission denied

	also ok

$ cd zguk
	
	the probable seat of the problem

$ $ ls 
.: Permission denied

	as expected.

	Is this what you're observing from the client side?

	This makes me think that we have a semantic problem between 
	Windows and Unix... or a bug in explorer.

	The obvious question then arises: can and should
	Samba simulate the bug?  I groveled the
	code, and in principle, Samba could use
		1) a simple (expensive!) stat check, or
		2) a "greedy" algorithm : try to pre-read 
		   the directory and report failure if
	     	  it couldn't.

	Is this a good idea?  

	Indeed, is it a sane idea? Can you cd on the Windows/NT
	command-line to a DOS or NTFS directory you can't
	read?  If you can, changing Samba will remove that
	capability...

--dave
-- 
David Collier-Brown,  | Always do right. This will gratify some people
185 Ellerslie Ave.,   | and astonish the rest.        -- Mark Twain
Willowdale, Ontario   | http://java.science.yorku.ca/~davecb
Work: (905) 477-0437, Home: (416) 223-8968, Email: davecb at canada.sun.com


More information about the samba mailing list