access_table() challenge - win a Samba t-shirt!

Matt Chapman matty at
Mon Jan 17 12:13:09 GMT 2000

On Mon, Jan 17, 2000 at 12:30:39AM +1100, Andrew Tridgell wrote:
> I've just spent quite some time re-doing our deny mode code in
> Samba. We now pass (ie. match NT4) on all possible deny mode
> combinations.

I don't know if you are getting different results for one reason or another,
but against my NT4 (SP6) server the results for the standard deny modes are 
just what one would expect. So, for those modes we can simply write:

static BOOL test_compatibility(int deny, int mode)
	switch (deny) {
		case DENY_ALL:
			return 0;
		case DENY_NONE:
			return 1;
		case DENY_READ:
			return (mode == DOS_OPEN_WRONLY);
		case DENY_WRITE:
			return (mode == DOS_OPEN_RDONLY);

static BOOL check_access(int new_deny, int new_mode, int old_deny, int old_mode)
	return test_compatibility(new_deny, old_mode)
		&& test_compatibility(old_deny, new_mode);

The DOS compatibility mode (DENY_DOS) is rather tricky, and as of this
moment I am still struggling to understand exactly what it does (it
*certainly* does not match what is documented in MSDN). It also seems
to be symmetric, however, so it should be possible to write a final
compatibility test for it.

DENY_FCB is not a real deny mode, and should be handled further up
the call chain.


Matthew "Austin" Chapman
SysAdmin, Developer, Samba Team Member

More information about the samba-technical mailing list