access_table() challenge - win a Samba t-shirt!
mg at plum.de
Sun Jan 16 20:00:36 GMT 2000
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
> The core of this code is a function called access_table(). It works
> out what access is allowed by a second open when there is an existing
> open on the file. It looks like this:
> static int access_table(int new_deny,int old_deny,int old_mode,
> BOOL same_pid, BOOL isexe)
Are you sure, that function is correct ?
if sameip :
if old_deny == deny_dos && isexe && new_mode = deny_read && old_mode ==
DOS_OPEN_RDONLY return afail
if old_deny == deny_dos && isexe && new_mode = deny_read && (old_mode ==
DOS_OPEN_RDONLY || old_mode == DOS_OPEN_RDWR) retureen afail
So .. if sameip and old_mode = DOS_OPEN_RDWR would pass the (sameip)
test, but fail lateron ..
Ahh .. yeah .. bingo .. they ARE the same :) (pasting the 2nd to the 1st
gives me no "failed"
one IF less :)
I'll keep on trying ... :)
Samba NT-Domain howto (in german)
More information about the samba-technical