diff options
author | Jeremy Allison <jra@samba.org> | 2002-03-20 00:46:53 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2002-03-20 00:46:53 +0000 |
commit | b9e91d2a8e41a43d7ebb7d7eed807a7d8de9b329 (patch) | |
tree | bd74664377abf0b1d0745476d88f6668d06c5718 /source3/smbd/nttrans.c | |
parent | 0cd5dd67ce12f02d3d20568e901ef7666caa8472 (diff) | |
download | samba-b9e91d2a8e41a43d7ebb7d7eed807a7d8de9b329.tar.gz samba-b9e91d2a8e41a43d7ebb7d7eed807a7d8de9b329.tar.bz2 samba-b9e91d2a8e41a43d7ebb7d7eed807a7d8de9b329.zip |
Remove the "stat open" code - make it inline. This should fix the
bugs with opening and renaming mp3 files, also the word rename
problems that people have had for a while.
Needs a make clean :-) make.
Also added JohnR's printing fix.
Jeremy.
(This used to be commit 504e5ef0494c54efbd0357e334cb2aa5a9eb9c14)
Diffstat (limited to 'source3/smbd/nttrans.c')
-rw-r--r-- | source3/smbd/nttrans.c | 53 |
1 files changed, 3 insertions, 50 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index d9b90c14cb..fb985bb325 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -329,13 +329,11 @@ static int map_create_disposition( uint32 create_disposition) Utility function to map share modes. ****************************************************************************/ -static int map_share_mode( BOOL *pstat_open_only, char *fname, uint32 create_options, +static int map_share_mode( char *fname, uint32 create_options, uint32 *desired_access, uint32 share_access, uint32 file_attributes) { int smb_open_mode = -1; - *pstat_open_only = False; - /* * Convert GENERIC bits to specific bits. */ @@ -374,9 +372,6 @@ static int map_share_mode( BOOL *pstat_open_only, char *fname, uint32 create_opt if (smb_open_mode == -1) { - if(*desired_access == WRITE_DAC_ACCESS || *desired_access == READ_CONTROL_ACCESS) - *pstat_open_only = True; - if(*desired_access & (DELETE_ACCESS|WRITE_DAC_ACCESS|WRITE_OWNER_ACCESS| FILE_EXECUTE|FILE_READ_ATTRIBUTES| FILE_READ_EA|FILE_WRITE_EA|SYSTEM_SECURITY_ACCESS| @@ -389,7 +384,6 @@ static int map_share_mode( BOOL *pstat_open_only, char *fname, uint32 create_opt * and map to a stat open. */ - *pstat_open_only = True; smb_open_mode = DOS_OPEN_RDONLY; } else { @@ -569,7 +563,6 @@ int reply_ntcreate_and_X(connection_struct *conn, BOOL bad_path = False; files_struct *fsp=NULL; char *p = NULL; - BOOL stat_open_only = False; time_t c_time; START_PROFILE(SMBntcreateX); @@ -655,7 +648,7 @@ int reply_ntcreate_and_X(connection_struct *conn, */ RESOLVE_DFSPATH(fname, conn, inbuf, outbuf); - if((smb_open_mode = map_share_mode(&stat_open_only, fname, create_options, &desired_access, + if((smb_open_mode = map_share_mode(fname, create_options, &desired_access, share_access, file_attributes)) == -1) { END_PROFILE(SMBntcreateX); @@ -770,26 +763,6 @@ int reply_ntcreate_and_X(connection_struct *conn, END_PROFILE(SMBntcreateX); return(UNIXERROR(ERRDOS,ERRnoaccess)); } -#ifdef EROFS - } else if (((errno == EACCES) || (errno == EROFS)) && stat_open_only) { -#else /* !EROFS */ - } else if (errno == EACCES && stat_open_only) { -#endif - /* - * We couldn't open normally and all we want - * are the permissions. Try and do a stat open. - */ - - oplock_request = 0; - - fsp = open_file_stat(conn,fname,&sbuf,smb_open_mode,&smb_action); - - if(!fsp) { - restore_case_semantics(file_attributes); - END_PROFILE(SMBntcreateX); - return(UNIXERROR(ERRDOS,ERRnoaccess)); - } - } else { if((errno == ENOENT) && bad_path) { @@ -1059,7 +1032,6 @@ static int call_nt_transact_create(connection_struct *conn, BOOL bad_path = False; files_struct *fsp = NULL; char *p = NULL; - BOOL stat_open_only = False; uint32 flags; uint32 desired_access; uint32 file_attributes; @@ -1172,7 +1144,7 @@ static int call_nt_transact_create(connection_struct *conn, * and the share access. */ - if((smb_open_mode = map_share_mode( &stat_open_only, fname, create_options, &desired_access, + if((smb_open_mode = map_share_mode( fname, create_options, &desired_access, share_access, file_attributes)) == -1) return ERROR_DOS(ERRDOS,ERRbadaccess); @@ -1252,25 +1224,6 @@ static int call_nt_transact_create(connection_struct *conn, } return(UNIXERROR(ERRDOS,ERRnoaccess)); } -#ifdef EROFS - } else if (((errno == EACCES) || (errno == EROFS)) && stat_open_only) { -#else /* !EROFS */ - } else if (errno == EACCES && stat_open_only) { -#endif - - /* - * We couldn't open normally and all we want - * are the permissions. Try and do a stat open. - */ - - oplock_request = 0; - - fsp = open_file_stat(conn,fname,&sbuf,smb_open_mode,&smb_action); - - if(!fsp) { - restore_case_semantics(file_attributes); - return(UNIXERROR(ERRDOS,ERRnoaccess)); - } } else { if((errno == ENOENT) && bad_path) { |