s3:vfs: Change get_acl_blob() to take a const smb_filename * parameter from const...
authorJeremy Allison <jra@samba.org>
Fri, 11 Mar 2016 23:50:57 +0000 (15:50 -0800)
committerUri Simchoni <uri@samba.org>
Tue, 15 Mar 2016 07:29:31 +0000 (08:29 +0100)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
source3/modules/vfs_acl_common.c
source3/modules/vfs_acl_tdb.c
source3/modules/vfs_acl_xattr.c

index ba93e7b..c8c0650 100644 (file)
@@ -33,7 +33,7 @@ static NTSTATUS create_acl_blob(const struct security_descriptor *psd,
 static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
                        vfs_handle_struct *handle,
                        files_struct *fsp,
-                       const char *name,
+                       const struct smb_filename *smb_fname,
                        DATA_BLOB *pblob);
 
 static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle,
@@ -366,7 +366,7 @@ static NTSTATUS add_directory_inheritable_components(vfs_handle_struct *handle,
 
 static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
                                    files_struct *fsp,
-                                   const struct smb_filename *smb_fname,
+                                   const struct smb_filename *smb_fname_in,
                                    uint32_t security_info,
                                    TALLOC_CTX *mem_ctx,
                                    struct security_descriptor **ppdesc)
@@ -381,22 +381,22 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
        uint8_t sys_acl_hash_tmp[XATTR_SD_HASH_SIZE];
        struct security_descriptor *psd = NULL;
        struct security_descriptor *pdesc_next = NULL;
-       const char *name = NULL;
+       const struct smb_filename *smb_fname = NULL;
        bool ignore_file_system_acl = lp_parm_bool(SNUM(handle->conn),
                                                ACL_MODULE_NAME,
                                                "ignore system acls",
                                                false);
        TALLOC_CTX *frame = talloc_stackframe();
 
-       if (fsp && smb_fname == NULL) {
-               name = fsp->fsp_name->base_name;
+       if (fsp && smb_fname_in == NULL) {
+               smb_fname = fsp->fsp_name;
        } else {
-               name = smb_fname->base_name;
+               smb_fname = smb_fname_in;
        }
 
-       DEBUG(10, ("get_nt_acl_internal: name=%s\n", name));
+       DEBUG(10, ("get_nt_acl_internal: name=%s\n", smb_fname->base_name));
 
-       status = get_acl_blob(frame, handle, fsp, name, &blob);
+       status = get_acl_blob(frame, handle, fsp, smb_fname, &blob);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(10, ("get_nt_acl_internal: get_acl_blob returned %s\n",
                        nt_errstr(status)));
@@ -440,7 +440,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
                DEBUG(10, ("get_nt_acl_internal: ACL blob revision "
                           "mismatch (%u) for file %s\n",
                           (unsigned int)hash_type,
-                          name));
+                          smb_fname->base_name));
                TALLOC_FREE(psd);
                psd = NULL;
                goto out;
@@ -451,7 +451,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
                DEBUG(10, ("get_nt_acl_internal: ACL blob hash type "
                           "(%u) unexpected for file %s\n",
                           (unsigned int)hash_type,
-                          name));
+                          smb_fname->base_name));
                TALLOC_FREE(psd);
                psd = NULL;
                goto out;
@@ -474,10 +474,10 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
                } else {
                        /* Get the full underlying sd, then hash. */
                        ret = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle,
-                                                                name,
-                                                                frame,
-                                                                &sys_acl_blob_description,
-                                                                &sys_acl_blob);
+                                                smb_fname->base_name,
+                                                frame,
+                                                &sys_acl_blob_description,
+                                                &sys_acl_blob);
                }
 
                /* If we fail to get the ACL blob (for some reason) then this
@@ -494,7 +494,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
                                /* Hash matches, return blob sd. */
                                DEBUG(10, ("get_nt_acl_internal: blob hash "
                                           "matches for file %s\n",
-                                          name ));
+                                          smb_fname->base_name ));
                                goto out;
                        }
                }
@@ -521,7 +521,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(10, ("get_nt_acl_internal: get_next_acl for file %s "
                                   "returned %s\n",
-                                  name,
+                                  smb_fname->base_name,
                                   nt_errstr(status)));
                        TALLOC_FREE(frame);
                        return status;
@@ -545,7 +545,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
                        /* Hash matches, return blob sd. */
                        DEBUG(10, ("get_nt_acl_internal: blob hash "
                                   "matches for file %s\n",
-                                  name ));
+                                  smb_fname->base_name ));
                        goto out;
                }
 
@@ -553,11 +553,11 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
                DEBUG(10, ("get_nt_acl_internal: blob hash "
                           "does not match for file %s - returning "
                           "file system SD mapping.\n",
-                          name ));
+                          smb_fname->base_name ));
 
                if (DEBUGLEVEL >= 10) {
                        DEBUG(10,("get_nt_acl_internal: acl for blob hash for %s is:\n",
-                                 name ));
+                                 smb_fname->base_name ));
                        NDR_PRINT_DEBUG(security_descriptor, pdesc_next);
                }
 
@@ -587,7 +587,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(10, ("get_nt_acl_internal: get_next_acl for file %s "
                                   "returned %s\n",
-                                  name,
+                                  smb_fname->base_name,
                                   nt_errstr(status)));
                        TALLOC_FREE(frame);
                        return status;
@@ -641,7 +641,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
                         * is fully plumbed through the VFS.
                         */
                        int ret = vfs_stat_smb_basename(handle->conn,
-                                               name,
+                                               smb_fname->base_name,
                                                &sbuf);
                        if (ret == -1) {
                                TALLOC_FREE(frame);
@@ -653,7 +653,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
                if (ignore_file_system_acl) {
                        TALLOC_FREE(pdesc_next);
                        status = make_default_filesystem_acl(mem_ctx,
-                                               name,
+                                               smb_fname->base_name,
                                                psbuf,
                                                &psd);
                        if (!NT_STATUS_IS_OK(status)) {
@@ -666,7 +666,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
                                                        true)) {
                                status = add_directory_inheritable_components(
                                                        handle,
-                                                       name,
+                                                       smb_fname->base_name,
                                                        psbuf,
                                                        psd);
                                if (!NT_STATUS_IS_OK(status)) {
@@ -701,7 +701,7 @@ static NTSTATUS get_nt_acl_internal(vfs_handle_struct *handle,
 
        if (DEBUGLEVEL >= 10) {
                DEBUG(10,("get_nt_acl_internal: returning acl for %s is:\n",
-                       name ));
+                       smb_fname->base_name ));
                NDR_PRINT_DEBUG(security_descriptor, psd);
        }
 
index 54edb87..1bc5973 100644 (file)
@@ -143,7 +143,7 @@ static NTSTATUS acl_tdb_delete(vfs_handle_struct *handle,
 static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
                        vfs_handle_struct *handle,
                        files_struct *fsp,
-                       const char *name,
+                       const struct smb_filename *smb_fname,
                        DATA_BLOB *pblob)
 {
        uint8_t id_buf[16];
@@ -159,7 +159,9 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
                status = vfs_stat_fsp(fsp);
                sbuf = fsp->fsp_name->st;
        } else {
-               int ret = vfs_stat_smb_basename(handle->conn, name, &sbuf);
+               int ret = vfs_stat_smb_basename(handle->conn,
+                               smb_fname->base_name,
+                               &sbuf);
                if (ret == -1) {
                        status = map_nt_error_from_unix(errno);
                }
@@ -186,7 +188,7 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
        pblob->length = data.dsize;
 
        DEBUG(10,("get_acl_blob: returned %u bytes from file %s\n",
-               (unsigned int)data.dsize, name ));
+               (unsigned int)data.dsize, smb_fname->base_name ));
 
        if (pblob->length == 0 || pblob->data == NULL) {
                return NT_STATUS_NOT_FOUND;
index 2338798..d311c57 100644 (file)
@@ -40,7 +40,7 @@
 static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
                        vfs_handle_struct *handle,
                        files_struct *fsp,
-                       const char *name,
+                       const struct smb_filename *smb_fname,
                        DATA_BLOB *pblob)
 {
        size_t size = 1024;
@@ -64,7 +64,7 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
        if (fsp && fsp->fh->fd != -1) {
                sizeret = SMB_VFS_FGETXATTR(fsp, XATTR_NTACL_NAME, val, size);
        } else {
-               sizeret = SMB_VFS_GETXATTR(handle->conn, name,
+               sizeret = SMB_VFS_GETXATTR(handle->conn, smb_fname->base_name,
                                        XATTR_NTACL_NAME, val, size);
        }
        if (sizeret == -1) {