smbd: Fix a typo in a few places
[samba.git] / source3 / modules / vfs_default.c
index fe9b87929532f2bb47c4d4d0ce9eb567d7a23733..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 */
 }
@@ -744,7 +750,16 @@ static int vfswrap_openat(vfs_handle_struct *handle,
        }
 
 done:
-       fsp->fsp_flags.have_proc_fds = fsp->conn->have_proc_fds;
+       if (result >= 0) {
+               fsp->fsp_flags.have_proc_fds = fsp->conn->have_proc_fds;
+       } else {
+               /*
+                * "/proc/self/fd/-1" never exists. Indicate to upper
+                * layers that for this fsp a possible name-based
+                * fallback is the only way to go.
+                */
+               fsp->fsp_flags.have_proc_fds = false;
+       }
 
 out:
        END_PROFILE(syscall_openat);
@@ -1463,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.
@@ -1475,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;
                }
@@ -1483,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;
        }