diff options
author | Jeremy Allison <jra@samba.org> | 2001-03-30 08:57:24 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-03-30 08:57:24 +0000 |
commit | 6e7f03f9b920d1b81056959cca8c0b27ada4ee2d (patch) | |
tree | bf6426290c5aae2012dc4769158b3495cbbc031f /source3/include | |
parent | 9874ebc3d3355465f884f3aad4d69914a4e1f0c5 (diff) | |
download | samba-6e7f03f9b920d1b81056959cca8c0b27ada4ee2d.tar.gz samba-6e7f03f9b920d1b81056959cca8c0b27ada4ee2d.tar.bz2 samba-6e7f03f9b920d1b81056959cca8c0b27ada4ee2d.zip |
This is a big, rather ugly patch. Whilst investigating the files not truncated
when copying to a full disk problem, I discovered that we were not allowing
the delete on close flag to be set properly, this led to other things, and
after investigation of the proper delete on close semantics and their relationship
to the file_share_delete flag I discovered there were some cases where we
weren't doing the deny modes properly. And this after only 5 years working
on them..... :-) :-).
So here's the latest attempt. I realised the delete on close flag needs to
be set across all smbds with a dev/ino pair open - in addition, the delete
on close flag, allow share delete and delete access requested all need to
be stored in the share mode tdb.
The "delete_on_close" entry in the fsp struct is now redundant and should
really be removed. This may also mean we can get rid of the "iterate_fsp"
calls that I didn't like adding in the first place. Whilst doing this patch,
I also discovered we needed to do the se_map_generic() call for file opens
and POSIX ACL mapping, so I added that also.
This code, although ugly, now passes the deny mode torture tests plus the
delete on close tests I added. I do need to add one more multiple connection
delete on close test to make sure I got the semantics exactly right, plus we
should also (as Andrew suggested) move to random testing here.
The good news is that NT should now correctly delete the file on disk
full error when copying to a disk :-).
Jeremy.
(This used to be commit 51987684bd231c744da2e5f3705fd236d5616173)
Diffstat (limited to 'source3/include')
-rw-r--r-- | source3/include/proto.h | 4 | ||||
-rw-r--r-- | source3/include/smb.h | 20 |
2 files changed, 21 insertions, 3 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 9b6aab6645..12a7478e0a 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1155,11 +1155,11 @@ void unlock_share_entry_fsp(files_struct *fsp); int get_share_modes(connection_struct *conn, SMB_DEV_T dev, SMB_INO_T inode, share_mode_entry **shares); -void del_share_mode(files_struct *fsp); +size_t del_share_mode(files_struct *fsp, share_mode_entry **ppse); BOOL set_share_mode(files_struct *fsp, uint16 port, uint16 op_type); BOOL remove_share_oplock(files_struct *fsp); BOOL downgrade_share_oplock(files_struct *fsp); -BOOL modify_share_mode(files_struct *fsp, int new_mode, uint16 new_oplock); +BOOL modify_delete_flag( SMB_DEV_T dev, SMB_INO_T inode, BOOL delete_on_close); int share_mode_forall(SHAREMODE_FN(fn)); /*The following definitions come from locking/posix.c */ diff --git a/source3/include/smb.h b/source3/include/smb.h index ba0a02e950..e154c1eda2 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -123,6 +123,11 @@ implemented */ #define GET_DELETE_ON_CLOSE_FLAG(x) (((x) & DELETE_ON_CLOSE_FLAG) ? True : False) #define SET_DELETE_ON_CLOSE_FLAG(x) ((x) ? DELETE_ON_CLOSE_FLAG : 0) +/* was delete access requested in NT open ? */ +#define DELETE_ACCESS_REQUESTED (1<<17) +#define GET_DELETE_ACCESS_REQUESTED(x) (((x) & DELETE_ACCESS_REQUESTED) ? True : False) +#define SET_DELETE_ACCESS_REQUESTED(x) ((x) ? DELETE_ACCESS_REQUESTED : 0) + /* open disposition values */ #define FILE_EXISTS_FAIL 0 #define FILE_EXISTS_OPEN 1 @@ -1060,7 +1065,7 @@ struct bitmap { #define FILE_READ_ATTRIBUTES 0x080 #define FILE_WRITE_ATTRIBUTES 0x100 -#define FILE_ALL_ATTRIBUTES 0x1FF +#define FILE_ALL_ACCESS 0x1FF /* the desired access to use when opening a pipe */ #define DESIRED_ACCESS_PIPE 0x2019f @@ -1088,6 +1093,19 @@ struct bitmap { #define GENERIC_WRITE_ACCESS (1<<30) #define GENERIC_READ_ACCESS (((unsigned)1)<<31) +/* Mapping of generic access rights for files to specific rights. */ + +#define FILE_GENERIC_ALL (STANDARD_RIGHTS_REQUIRED_ACCESS| SYNCHRONIZE_ACCESS|FILE_ALL_ACCESS) + +#define FILE_GENERIC_READ (STANDARD_RIGHTS_READ_ACCESS|FILE_READ_DATA|FILE_READ_ATTRIBUTES|\ + FILE_READ_EA|SYNCHRONIZE_ACCESS) + +#define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE_ACCESS|FILE_WRITE_DATA|FILE_WRITE_ATTRIBUTES|\ + FILE_WRITE_EA|FILE_APPEND_DATA|SYNCHRONIZE_ACCESS) + +#define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE_ACCESS|FILE_READ_ATTRIBUTES|\ + FILE_EXECUTE|SYNCHRONIZE_ACCESS) + /* Mapping of access rights to UNIX perms. */ #define UNIX_ACCESS_RWX (UNIX_ACCESS_R|UNIX_ACCESS_W|UNIX_ACCESS_X) #define UNIX_ACCESS_R (READ_CONTROL_ACCESS|SYNCHRONIZE_ACCESS|\ |