s3: General cleanup of the open path in the OneFS vfs module
authorTim Prouty <tprouty@samba.org>
Wed, 31 Dec 2008 01:17:24 +0000 (17:17 -0800)
committerTim Prouty <tprouty@samba.org>
Mon, 12 Jan 2009 06:13:36 +0000 (22:13 -0800)
source3/modules/onefs.h
source3/modules/onefs_acl.c
source3/modules/onefs_open.c
source3/modules/onefs_system.c
source3/modules/vfs_onefs.c

index 8d0f45abdb28a6d5ead9cacfbbe3f2c0a6b14bfb..884f1416611752ab3a0eeecd5de40f9d9f4966cf 100644 (file)
@@ -80,8 +80,8 @@ NTSTATUS onefs_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
 /*
  * Utility functions
  */
-NTSTATUS onefs_setup_sd(uint32 security_info_sent, SEC_DESC *psd,
-                       struct ifs_security_descriptor *sd);
+NTSTATUS onefs_samba_sd_to_sd(uint32 security_info_sent, SEC_DESC *psd,
+                             struct ifs_security_descriptor *sd);
 
 /*
  * System Interfaces
index 5351118a87d1df9f3f85d59c1771fe9308d4ed99..9258e0cddc175f85642026c63e7253d69813f72f 100644 (file)
@@ -696,8 +696,8 @@ onefs_get_nt_acl(vfs_handle_struct *handle, const char* name,
  *
  * @return NTSTATUS_OK if successful
  */
-NTSTATUS onefs_setup_sd(uint32 security_info_sent, SEC_DESC *psd,
-                       struct ifs_security_descriptor *sd)
+NTSTATUS onefs_samba_sd_to_sd(uint32 security_info_sent, SEC_DESC *psd,
+                             struct ifs_security_descriptor *sd)
 {
        struct ifs_security_acl dacl, sacl, *daclp, *saclp;
        struct ifs_identity owner, group, *ownerp, *groupp;
@@ -789,7 +789,7 @@ onefs_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
 
        DEBUG(5,("Setting SD on file %s.\n", fsp->fsp_name ));
 
-       status = onefs_setup_sd(security_info_sent, psd, &sd);
+       status = onefs_samba_sd_to_sd(security_info_sent, psd, &sd);
 
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(3, ("SD initialization failure: %s", nt_errstr(status)));
index a86d39948d835ecb5690e2876c9cf4abcc6295c9..df0b75df958f6970b2fe82803170347d1897c381 100644 (file)
@@ -575,8 +575,6 @@ NTSTATUS onefs_open_file_ntcreate(connection_struct *conn,
                 * (requiring delete access) then recreates it.
                 */
                case FILE_SUPERSEDE:
-                       /* If file exists replace/overwrite. If file doesn't
-                        * exist create. */
                        /**
                         * @todo: Clear all file attributes?
                         * http://www.osronline.com/article.cfm?article=302
@@ -748,19 +746,8 @@ NTSTATUS onefs_open_file_ntcreate(connection_struct *conn,
                 */
                flags2 &= ~(O_CREAT|O_TRUNC);
 
-               /**
-                * XXX: TODO
-                * Apparently this is necessary because we ship with
-                * lp_acl_check_permissions = no.  It is set to no because our
-                * ifs_createfile does the access check correctly.  This check
-                * was added in the last merge, and the question is why is it
-                * necessary?  Check out Bug 25547 and Bug 14596.  The key is
-                * to figure out what case this is covering, and do some
-                * testing to see if it's actually necessary.  If it is, maybe
-                * it should go upstream in open.c.
-                */
-               if (!lp_acl_check_permissions(SNUM(conn)) &&
-                   (access_mask & DELETE_ACCESS)) {
+               /* Deny DELETE_ACCESS explicitly if the share is read only. */
+               if (access_mask & DELETE_ACCESS) {
                        return map_nt_error_from_unix(EACCES);
                }
        }
index 485e7f56ac7e610e1ac8fc54277927d7d15db56e..ee257d8f9092115065c52d856107dbdfd9d92e92 100644 (file)
@@ -91,7 +91,7 @@ static const char *onefs_oplock_str(enum oplock_type onefs_oplock_type)
 /*
  * Convert from onefs to samba oplock.
  */
-static int onefs_to_samba_oplock(enum oplock_type onefs_oplock)
+static int onefs_oplock_to_samba_oplock(enum oplock_type onefs_oplock)
 {
        switch (onefs_oplock) {
        case OPLOCK_NONE:
@@ -112,7 +112,7 @@ static int onefs_to_samba_oplock(enum oplock_type onefs_oplock)
 /*
  * Convert from samba to onefs oplock.
  */
-static enum oplock_type samba_to_onefs_oplock(int samba_oplock_type)
+static enum oplock_type onefs_samba_oplock_to_oplock(int samba_oplock_type)
 {
        if (BATCH_OPLOCK_TYPE(samba_oplock_type)) return OPLOCK_BATCH;
        if (EXCLUSIVE_OPLOCK_TYPE(samba_oplock_type)) return OPLOCK_EXCLUSIVE;
@@ -152,7 +152,7 @@ int onefs_sys_create_file(connection_struct *conn,
 
                secinfo = (get_sec_info(sd) & IFS_SEC_INFO_KNOWN_MASK);
 
-               status = onefs_setup_sd(secinfo, sd, &ifs_sd);
+               status = onefs_samba_sd_to_sd(secinfo, sd, &ifs_sd);
 
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(1, ("SD initialization failure: %s",
@@ -164,7 +164,7 @@ int onefs_sys_create_file(connection_struct *conn,
                pifs_sd = &ifs_sd;
        }
 
-       onefs_oplock = samba_to_onefs_oplock(oplock_request);
+       onefs_oplock = onefs_samba_oplock_to_oplock(oplock_request);
 
        /* Temporary until oplock work is added to vfs_onefs */
        onefs_oplock = OPLOCK_NONE;
@@ -204,7 +204,8 @@ int onefs_sys_create_file(connection_struct *conn,
                  onefs_oplock_str(onefs_granted_oplock)));
 
        if (granted_oplock) {
-               *granted_oplock = onefs_to_samba_oplock(onefs_granted_oplock);
+               *granted_oplock =
+                   onefs_oplock_to_samba_oplock(onefs_granted_oplock);
        }
 
  out:
index b902812498abc9dc2413a2efca576d9703a161dd..b6faf52c9aecc349cb47b5e95ce24e1a12deb50b 100644 (file)
 static int onefs_mkdir(vfs_handle_struct *handle, const char *path,
                       mode_t mode)
 {
-       DEBUG(0, ("SMB_VFS_MKDIR should never be called in vfs_onefs"));
+       /* SMB_VFS_MKDIR should never be called in vfs_onefs */
+       SMB_ASSERT(false);
        return SMB_VFS_NEXT_MKDIR(handle, path, mode);
 }
 
 static int onefs_open(vfs_handle_struct *handle, const char *fname,
                      files_struct *fsp, int flags, mode_t mode)
 {
-       DEBUG(0, ("SMB_VFS_OPEN should never be called in vfs_onefs"));
+       /* SMB_VFS_OPEN should never be called in vfs_onefs */
+       SMB_ASSERT(false);
        return SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode);
 }