selftest/Samba4: make use of get_cmd_env_vars() to setup all relevant env variables
[samba.git] / source3 / modules / vfs_default.c
index 3c412f346e1659e4ea01f5b1c0b65c91a69644f0..48b5dd9e39f46b178ba734651a8cf25242839358 100644 (file)
@@ -52,6 +52,9 @@ static int vfswrap_connect(vfs_handle_struct *handle, const char *service, const
        bool bval;
 
        handle->conn->have_proc_fds = sys_have_proc_fds();
+#ifdef DISABLE_PROC_FDS
+       handle->conn->have_proc_fds = false;
+#endif
 
        /*
         * assume the kernel will support openat2(),
@@ -70,6 +73,9 @@ static int vfswrap_connect(vfs_handle_struct *handle, const char *service, const
                handle->conn->open_how_resolve |=
                        VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS;
        }
+#ifdef DISABLE_VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS
+       handle->conn->open_how_resolve &= ~VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS;
+#endif
 
        return 0;    /* Return >= 0 for success */
 }
@@ -1472,7 +1478,7 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
        case FSCTL_CREATE_OR_GET_OBJECT_ID:
        {
                unsigned char objid[16];
-               char *return_data = NULL;
+               uint8_t *return_data = NULL;
 
                /* This should return the object-id on this file.
                 * I think I'll make this be the inode+dev. JRA.
@@ -1484,7 +1490,7 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
                *out_len = MIN(max_out_len, 64);
 
                /* Hmmm, will this cause problems if less data asked for? */
-               return_data = talloc_array(ctx, char, 64);
+               return_data = talloc_array(ctx, uint8_t, 64);
                if (return_data == NULL) {
                        return NT_STATUS_NO_MEMORY;
                }
@@ -1492,16 +1498,17 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
                /* For backwards compatibility only store the dev/inode. */
                push_file_id_16(return_data, &fsp->file_id);
                memcpy(return_data+16,create_volume_objectid(fsp->conn,objid),16);
-               push_file_id_16(return_data+32, &fsp->file_id);
+               push_file_id_16(return_data + 32, &fsp->file_id);
                memset(return_data+48, 0, 16);
-               *out_data = return_data;
+               *_out_data = return_data;
                return NT_STATUS_OK;
        }
 
        case FSCTL_GET_REPARSE_POINT:
        {
+               uint32_t tag;
                status = fsctl_get_reparse_point(
-                       fsp, ctx, out_data, max_out_len, out_len);
+                       fsp, ctx, &tag, _out_data, max_out_len, out_len);
                return status;
        }
 
@@ -1891,14 +1898,14 @@ static void vfswrap_get_dos_attributes_getxattr_done(struct tevent_req *subreq)
 
                state->as_root = true;
 
-               set_effective_capability(DAC_OVERRIDE_CAPABILITY);
+               become_root();
                subreq = SMB_VFS_GETXATTRAT_SEND(state,
                                                 state->ev,
                                                 state->dir_fsp,
                                                 state->smb_fname,
                                                 SAMBA_XATTR_DOS_ATTRIB,
                                                 sizeof(fstring));
-               drop_effective_capability(DAC_OVERRIDE_CAPABILITY);
+               unbecome_root();
                if (tevent_req_nomem(subreq, req)) {
                        return;
                }