diff options
author | Volker Lendecke <vl@samba.org> | 2011-07-29 16:36:58 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2011-07-29 16:43:17 +0200 |
commit | 190b5432f0fd55113b26c97aeac97c76b28dbedf (patch) | |
tree | 0bf4362f0e1e59ef570662799ba46e2b3f08a17b /source3/smbd | |
parent | 0102c6e2bc289352ab726d68956c126727cf8d81 (diff) | |
download | samba-190b5432f0fd55113b26c97aeac97c76b28dbedf.tar.gz samba-190b5432f0fd55113b26c97aeac97c76b28dbedf.tar.bz2 samba-190b5432f0fd55113b26c97aeac97c76b28dbedf.zip |
s3: Make map_open_params_to_ntcreate() available in lib/
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/open.c | 147 | ||||
-rw-r--r-- | source3/smbd/proto.h | 7 |
2 files changed, 0 insertions, 154 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 2529cbe0ce..510dfe030c 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1318,153 +1318,6 @@ NTSTATUS fcb_or_dos_open(struct smb_request *req, create_options, fsp_to_dup_into); } -/**************************************************************************** - Open a file with a share mode - old openX method - map into NTCreate. -****************************************************************************/ - -bool map_open_params_to_ntcreate(const char *smb_base_fname, - int deny_mode, int open_func, - uint32 *paccess_mask, - uint32 *pshare_mode, - uint32 *pcreate_disposition, - uint32 *pcreate_options, - uint32_t *pprivate_flags) -{ - uint32 access_mask; - uint32 share_mode; - uint32 create_disposition; - uint32 create_options = FILE_NON_DIRECTORY_FILE; - uint32_t private_flags = 0; - - DEBUG(10,("map_open_params_to_ntcreate: fname = %s, deny_mode = 0x%x, " - "open_func = 0x%x\n", - smb_base_fname, (unsigned int)deny_mode, - (unsigned int)open_func )); - - /* Create the NT compatible access_mask. */ - switch (GET_OPENX_MODE(deny_mode)) { - case DOS_OPEN_EXEC: /* Implies read-only - used to be FILE_READ_DATA */ - case DOS_OPEN_RDONLY: - access_mask = FILE_GENERIC_READ; - break; - case DOS_OPEN_WRONLY: - access_mask = FILE_GENERIC_WRITE; - break; - case DOS_OPEN_RDWR: - case DOS_OPEN_FCB: - access_mask = FILE_GENERIC_READ|FILE_GENERIC_WRITE; - break; - default: - DEBUG(10,("map_open_params_to_ntcreate: bad open mode = 0x%x\n", - (unsigned int)GET_OPENX_MODE(deny_mode))); - return False; - } - - /* Create the NT compatible create_disposition. */ - switch (open_func) { - case OPENX_FILE_EXISTS_FAIL|OPENX_FILE_CREATE_IF_NOT_EXIST: - create_disposition = FILE_CREATE; - break; - - case OPENX_FILE_EXISTS_OPEN: - create_disposition = FILE_OPEN; - break; - - case OPENX_FILE_EXISTS_OPEN|OPENX_FILE_CREATE_IF_NOT_EXIST: - create_disposition = FILE_OPEN_IF; - break; - - case OPENX_FILE_EXISTS_TRUNCATE: - create_disposition = FILE_OVERWRITE; - break; - - case OPENX_FILE_EXISTS_TRUNCATE|OPENX_FILE_CREATE_IF_NOT_EXIST: - create_disposition = FILE_OVERWRITE_IF; - break; - - default: - /* From samba4 - to be confirmed. */ - if (GET_OPENX_MODE(deny_mode) == DOS_OPEN_EXEC) { - create_disposition = FILE_CREATE; - break; - } - DEBUG(10,("map_open_params_to_ntcreate: bad " - "open_func 0x%x\n", (unsigned int)open_func)); - return False; - } - - /* Create the NT compatible share modes. */ - switch (GET_DENY_MODE(deny_mode)) { - case DENY_ALL: - share_mode = FILE_SHARE_NONE; - break; - - case DENY_WRITE: - share_mode = FILE_SHARE_READ; - break; - - case DENY_READ: - share_mode = FILE_SHARE_WRITE; - break; - - case DENY_NONE: - share_mode = FILE_SHARE_READ|FILE_SHARE_WRITE; - break; - - case DENY_DOS: - private_flags |= NTCREATEX_OPTIONS_PRIVATE_DENY_DOS; - if (is_executable(smb_base_fname)) { - share_mode = FILE_SHARE_READ|FILE_SHARE_WRITE; - } else { - if (GET_OPENX_MODE(deny_mode) == DOS_OPEN_RDONLY) { - share_mode = FILE_SHARE_READ; - } else { - share_mode = FILE_SHARE_NONE; - } - } - break; - - case DENY_FCB: - private_flags |= NTCREATEX_OPTIONS_PRIVATE_DENY_FCB; - share_mode = FILE_SHARE_NONE; - break; - - default: - DEBUG(10,("map_open_params_to_ntcreate: bad deny_mode 0x%x\n", - (unsigned int)GET_DENY_MODE(deny_mode) )); - return False; - } - - DEBUG(10,("map_open_params_to_ntcreate: file %s, access_mask = 0x%x, " - "share_mode = 0x%x, create_disposition = 0x%x, " - "create_options = 0x%x private_flags = 0x%x\n", - smb_base_fname, - (unsigned int)access_mask, - (unsigned int)share_mode, - (unsigned int)create_disposition, - (unsigned int)create_options, - (unsigned int)private_flags)); - - if (paccess_mask) { - *paccess_mask = access_mask; - } - if (pshare_mode) { - *pshare_mode = share_mode; - } - if (pcreate_disposition) { - *pcreate_disposition = create_disposition; - } - if (pcreate_options) { - *pcreate_options = create_options; - } - if (pprivate_flags) { - *pprivate_flags = private_flags; - } - - return True; - -} - static void schedule_defer_open(struct share_mode_lock *lck, struct timeval request_time, struct smb_request *req) diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 02c82f7d2a..b2acaa0ee7 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -608,13 +608,6 @@ NTSTATUS fcb_or_dos_open(struct smb_request *req, uint32 access_mask, uint32 share_access, uint32 create_options); -bool map_open_params_to_ntcreate(const char *smb_base_fname, - int deny_mode, int open_func, - uint32 *paccess_mask, - uint32 *pshare_mode, - uint32 *pcreate_disposition, - uint32 *pcreate_options, - uint32_t *pprivate_flags); void remove_deferred_open_entry(struct file_id id, uint64_t mid, struct server_id pid); NTSTATUS open_file_fchmod(connection_struct *conn, |