Author: jra Date: 2005-07-03 00:34:21 +0000 (Sun, 03 Jul 2005) New Revision: 8087
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8087 Log: Get closer to passing the Samba4 deny tests. The added code in share_conflict() was checking the same things twice (ie. access_mask, share_mode, entry->access_mask, entry->share_mode instead of reversing the access_mask and entry->access_mask in each subsequent macro. Still fails tests but getting closer. Jeremy. Modified: trunk/source/include/smb.h trunk/source/smbd/open.c Changeset: Modified: trunk/source/include/smb.h =================================================================== --- trunk/source/include/smb.h 2005-07-03 00:05:52 UTC (rev 8086) +++ trunk/source/include/smb.h 2005-07-03 00:34:21 UTC (rev 8087) @@ -1071,18 +1071,18 @@ #define DESIRED_ACCESS_PIPE 0x2019f /* Generic access masks & rights. */ -#define DELETE_ACCESS (1L<<16) /* 0x00010000 */ -#define READ_CONTROL_ACCESS (1L<<17) /* 0x00020000 */ -#define WRITE_DAC_ACCESS (1L<<18) /* 0x00040000 */ -#define WRITE_OWNER_ACCESS (1L<<19) /* 0x00080000 */ -#define SYNCHRONIZE_ACCESS (1L<<20) /* 0x00100000 */ +#define DELETE_ACCESS 0x00010000 /* (1L<<16) */ +#define READ_CONTROL_ACCESS 0x00020000 /* (1L<<17) */ +#define WRITE_DAC_ACCESS 0x00040000 /* (1L<<18) */ +#define WRITE_OWNER_ACCESS 0x00080000 /* (1L<<19) */ +#define SYNCHRONIZE_ACCESS 0x00100000 /* (1L<<20) */ -#define SYSTEM_SECURITY_ACCESS (1L<<24) /* 0x01000000 */ -#define MAXIMUM_ALLOWED_ACCESS (1L<<25) /* 0x02000000 */ -#define GENERIC_ALL_ACCESS (1<<28) /* 0x10000000 */ -#define GENERIC_EXECUTE_ACCESS (1<<29) /* 0x20000000 */ -#define GENERIC_WRITE_ACCESS (1<<30) /* 0x40000000 */ -#define GENERIC_READ_ACCESS (((unsigned)1)<<31) /* 0x80000000 */ +#define SYSTEM_SECURITY_ACCESS 0x01000000 /* (1L<<24) */ +#define MAXIMUM_ALLOWED_ACCESS 0x02000000 /* (1L<<25) */ +#define GENERIC_ALL_ACCESS 0x10000000 /* (1<<28) */ +#define GENERIC_EXECUTE_ACCESS 0x20000000 /* (1<<29) */ +#define GENERIC_WRITE_ACCESS 0x40000000 /* (1<<30) */ +#define GENERIC_READ_ACCESS ((unsigned)0x80000000) /* (((unsigned)1)<<31) */ /* Mapping of generic access rights for files to specific rights. */ Modified: trunk/source/smbd/open.c =================================================================== --- trunk/source/smbd/open.c 2005-07-03 00:05:52 UTC (rev 8086) +++ trunk/source/smbd/open.c 2005-07-03 00:34:21 UTC (rev 8087) @@ -388,6 +388,12 @@ return False; } + DEBUG(10,("share_conflict: entry->access_mask = 0x%x, entry->share_access = 0x%x, entry->create_options = 0x%x\n", + (unsigned int)entry->access_mask, (unsigned int)entry->share_access, (unsigned int)entry->create_options)); + + DEBUG(10,("share_conflict: access_mask = 0x%x, share_access = 0x%x, create_options = 0x%x\n", + (unsigned int)access_mask, (unsigned int)share_access, (unsigned int)create_options)); + if ((entry->access_mask & (FILE_WRITE_DATA| FILE_APPEND_DATA| FILE_READ_DATA| @@ -409,6 +415,10 @@ } #define CHECK_MASK(num, am, right, sa, share) \ + DEBUG(10,("share_conflict: [%d] am (0x%x) & right (0x%x) = 0x%x\n", \ + (unsigned int)(num), (unsigned int)(am), (unsigned int)(right), (unsigned int)(am)&(right) )); \ + DEBUG(10,("share_conflict: [%d] sa (0x%x) & share (0x%x) = 0x%x\n", \ + (unsigned int)(num), (unsigned int)(sa), (unsigned int)(share), (unsigned int)(sa)&(share) )); \ if (((am) & (right)) && !((sa) & (share))) { \ DEBUG(10,("share_conflict: check %d conflict am = 0x%x, right = 0x%x, \ sa = 0x%x, share = 0x%x\n", (num), (unsigned int)(am), (unsigned int)(right), (unsigned int)(sa), \ @@ -418,18 +428,18 @@ CHECK_MASK(1, entry->access_mask, FILE_WRITE_DATA | FILE_APPEND_DATA, share_access, FILE_SHARE_WRITE); - CHECK_MASK(2, entry->access_mask, FILE_WRITE_DATA | FILE_APPEND_DATA, - share_access, FILE_SHARE_WRITE); + CHECK_MASK(2, access_mask, FILE_WRITE_DATA | FILE_APPEND_DATA, + entry->share_access, FILE_SHARE_WRITE); CHECK_MASK(3, entry->access_mask, FILE_READ_DATA | FILE_EXECUTE, share_access, FILE_SHARE_READ); - CHECK_MASK(4, entry->access_mask, FILE_READ_DATA | FILE_EXECUTE, - share_access, FILE_SHARE_READ); + CHECK_MASK(4, access_mask, FILE_READ_DATA | FILE_EXECUTE, + entry->share_access, FILE_SHARE_READ); CHECK_MASK(5, entry->access_mask, DELETE_ACCESS, share_access, FILE_SHARE_DELETE); - CHECK_MASK(6, entry->access_mask, DELETE_ACCESS, - share_access, FILE_SHARE_DELETE); + CHECK_MASK(6, access_mask, DELETE_ACCESS, + entry->share_access, FILE_SHARE_DELETE); /* if a delete is pending then a second open is not allowed */ if ((entry->create_options & FILE_DELETE_ON_CLOSE) ||