diff options
-rw-r--r-- | source3/smbd/nttrans.c | 25 | ||||
-rw-r--r-- | source3/smbd/open.c | 2 |
2 files changed, 14 insertions, 13 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index e8bfe9948d..062047b6bd 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -330,7 +330,7 @@ static int map_create_disposition( uint32 create_disposition) ****************************************************************************/ static int map_share_mode( BOOL *pstat_open_only, char *fname, uint32 create_options, - uint32 desired_access, uint32 share_access, uint32 file_attributes) + uint32 *desired_access, uint32 share_access, uint32 file_attributes) { int smb_open_mode = -1; @@ -340,9 +340,9 @@ static int map_share_mode( BOOL *pstat_open_only, char *fname, uint32 create_opt * Convert GENERIC bits to specific bits. */ - se_map_generic(&desired_access, &file_generic_mapping); + se_map_generic(desired_access, &file_generic_mapping); - switch( desired_access & (FILE_READ_DATA|FILE_WRITE_DATA|FILE_APPEND_DATA) ) { + switch( *desired_access & (FILE_READ_DATA|FILE_WRITE_DATA|FILE_APPEND_DATA) ) { case FILE_READ_DATA: smb_open_mode = DOS_OPEN_RDONLY; break; @@ -374,15 +374,15 @@ 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) + 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| + 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| FILE_WRITE_ATTRIBUTES|READ_CONTROL_ACCESS)) { smb_open_mode = DOS_OPEN_RDONLY; - } else if(desired_access == 0) { + } else if(*desired_access == 0) { /* * JRA - NT seems to sometimes send desired_access as zero. play it safe @@ -394,7 +394,7 @@ static int map_share_mode( BOOL *pstat_open_only, char *fname, uint32 create_opt } else { DEBUG(0,("map_share_mode: Incorrect value 0x%lx for desired_access to file %s\n", - (unsigned long)desired_access, fname)); + (unsigned long)*desired_access, fname)); return -1; } } @@ -417,14 +417,13 @@ static int map_share_mode( BOOL *pstat_open_only, char *fname, uint32 create_opt * is the only practical way. JRA. */ - if(desired_access & DELETE_ACCESS) { + if(*desired_access & DELETE_ACCESS) { smb_open_mode |= DELETE_ACCESS_REQUESTED; DEBUG(10,("map_share_mode: DELETE_ACCESS requested. open_mode = 0x%x\n", smb_open_mode)); } if (create_options & FILE_DELETE_ON_CLOSE) { - /* Implicit delete access requested... */ - smb_open_mode |= DELETE_ACCESS_REQUESTED; + /* Implicit delete access is *NOT* requested... */ smb_open_mode |= DELETE_ON_CLOSE_FLAG; DEBUG(10,("map_share_mode: FILE_DELETE_ON_CLOSE requested. open_mode = 0x%x\n", smb_open_mode)); } @@ -453,7 +452,7 @@ static int map_share_mode( BOOL *pstat_open_only, char *fname, uint32 create_opt smb_open_mode |= FILE_SYNC_OPENMODE; DEBUG(10,("map_share_mode: Mapped desired access 0x%lx, share access 0x%lx, file attributes 0x%lx \ -to open_mode 0x%x\n", (unsigned long)desired_access, (unsigned long)share_access, +to open_mode 0x%x\n", (unsigned long)*desired_access, (unsigned long)share_access, (unsigned long)file_attributes, smb_open_mode )); return smb_open_mode; @@ -656,7 +655,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(&stat_open_only, fname, create_options, &desired_access, share_access, file_attributes)) == -1) { END_PROFILE(SMBntcreateX); @@ -1166,7 +1165,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( &stat_open_only, fname, create_options, &desired_access, share_access, file_attributes)) == -1) return ERROR_DOS(ERRDOS,ERRbadaccess); diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 7396233c26..03646c5019 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -941,6 +941,8 @@ flags=0x%X flags2=0x%X mode=0%o returned %d\n", NTSTATUS result = set_delete_on_close_internal(fsp, delete_on_close); if (NT_STATUS_V(result) != NT_STATUS_V(NT_STATUS_OK)) { + /* Remember to delete the mode we just added. */ + del_share_mode(fsp, NULL); unlock_share_entry_fsp(fsp); fd_close(conn,fsp); file_free(fsp); |