s3:vfs: add SMB_VFS_GET_DFS_REFERRAL() hooks
[garming/samba-autobuild/.git] / source3 / smbd / vfs.c
index 7be386726780da7a19033893d69449848c8717ef..7f166701732be5cee671630331f96423d81aff24 100644 (file)
@@ -729,7 +729,7 @@ const char *vfs_readdirname(connection_struct *conn, void *p,
        if (!p)
                return(NULL);
 
-       ptr = SMB_VFS_READDIR(conn, (DIR *)p, sbuf);
+       ptr = SMB_VFS_READDIR(conn, (SMB_STRUCT_DIR *)p, sbuf);
        if (!ptr)
                return(NULL);
 
@@ -1196,6 +1196,13 @@ uint32_t smb_vfs_call_fs_capabilities(struct vfs_handle_struct *handle,
        return handle->fns->fs_capabilities(handle, p_ts_res);
 }
 
+NTSTATUS smb_vfs_call_get_dfs_referrals(struct vfs_handle_struct *handle,
+                                       struct dfs_GetDFSReferral *r)
+{
+       VFS_FIND(get_dfs_referrals);
+       return handle->fns->get_dfs_referrals(handle, r);
+}
+
 SMB_STRUCT_DIR *smb_vfs_call_opendir(struct vfs_handle_struct *handle,
                                     const char *fname, const char *mask,
                                     uint32 attributes)
@@ -1501,7 +1508,7 @@ NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid)
                }
 
                /* cd into the parent dir to pin it. */
-               ret = SMB_VFS_CHDIR(fsp->conn, parent_dir);
+               ret = vfs_ChDir(fsp->conn, parent_dir);
                if (ret == -1) {
                        return map_nt_error_from_unix(errno);
                }
@@ -1512,12 +1519,14 @@ NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid)
                /* Must use lstat here. */
                ret = SMB_VFS_LSTAT(fsp->conn, &local_fname);
                if (ret == -1) {
-                       return map_nt_error_from_unix(errno);
+                       status = map_nt_error_from_unix(errno);
+                       goto out;
                }
 
                /* Ensure it matches the fsp stat. */
                if (!check_same_stat(&local_fname.st, &fsp->fsp_name->st)) {
-                        return NT_STATUS_ACCESS_DENIED;
+                        status = NT_STATUS_ACCESS_DENIED;
+                       goto out;
                 }
                 path = final_component;
         } else {
@@ -1540,6 +1549,8 @@ NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid)
                status = map_nt_error_from_unix(errno);
        }
 
+  out:
+
        if (as_root) {
                vfs_ChDir(fsp->conn,saved_dir);
                TALLOC_FREE(saved_dir);
@@ -1717,6 +1728,23 @@ NTSTATUS smb_vfs_call_translate_name(struct vfs_handle_struct *handle,
                                           mapped_name);
 }
 
+NTSTATUS smb_vfs_call_fsctl(struct vfs_handle_struct *handle,
+                           struct files_struct *fsp,
+                           TALLOC_CTX *ctx,
+                           uint32_t function,
+                           uint16_t req_flags,
+                           const uint8_t *in_data,
+                           uint32_t in_len,
+                           uint8_t **out_data,
+                           uint32_t max_out_len,
+                           uint32_t *out_len)
+{
+       VFS_FIND(fsctl);
+       return handle->fns->fsctl(handle, fsp, ctx, function, req_flags, 
+                                 in_data, in_len, out_data, max_out_len, 
+                                 out_len);
+}
+
 NTSTATUS smb_vfs_call_fget_nt_acl(struct vfs_handle_struct *handle,
                                  struct files_struct *fsp,
                                  uint32 security_info,