First part of fix for bug #8419 - Make VFS op "streaminfo" stackable.
authorFrank Lahm <franklahm@googlemail.com>
Mon, 17 Oct 2011 18:10:29 +0000 (11:10 -0700)
committerJeremy Allison <jra@samba.org>
Mon, 17 Oct 2011 19:39:32 +0000 (21:39 +0200)
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Mon Oct 17 21:39:32 CEST 2011 on sn-devel-104

source3/lib/filename_util.c
source3/smbd/close.c
source3/smbd/filename.c
source3/smbd/nttrans.c
source3/smbd/open.c
source3/smbd/proto.h
source3/smbd/trans2.c
source3/smbd/vfs.c

index 2405183d53bb08d7798c04f317894160aa73ea9b..85d9fb5a868299490566c6a6756089efd3196317 100644 (file)
@@ -47,7 +47,7 @@ NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx,
 
 /**
  * There are actually legitimate callers of this such as functions that
- * enumerate streams using the SMB_VFS_STREAMINFO interface and then want to
+ * enumerate streams using the vfs_streaminfo interface and then want to
  * operate on each stream.
  */
 NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name,
index 33e497c598517da35e4f6b2e92f133095409be8b..b736432a82edeff85b2315e14c87a51b99d54c25 100644 (file)
@@ -212,8 +212,8 @@ NTSTATUS delete_all_streams(connection_struct *conn, const char *fname)
        TALLOC_CTX *frame = talloc_stackframe();
        NTSTATUS status;
 
-       status = SMB_VFS_STREAMINFO(conn, NULL, fname, talloc_tos(),
-                                   &num_streams, &stream_info);
+       status = vfs_streaminfo(conn, NULL, fname, talloc_tos(),
+                               &num_streams, &stream_info);
 
        if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)) {
                DEBUG(10, ("no streams around\n"));
@@ -222,7 +222,7 @@ NTSTATUS delete_all_streams(connection_struct *conn, const char *fname)
        }
 
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(10, ("SMB_VFS_STREAMINFO failed: %s\n",
+               DEBUG(10, ("vfs_streaminfo failed: %s\n",
                           nt_errstr(status)));
                goto fail;
        }
index 7fe7cc8063b1f71ba2ba29b536f481efed87accd..b7c7831008088f46ab0283aa6076938c2d91a2b5 100644 (file)
@@ -1184,8 +1184,8 @@ static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx,
        }
 
        /* Fall back to a case-insensitive scan of all streams on the file. */
-       status = SMB_VFS_STREAMINFO(conn, NULL, smb_fname->base_name, mem_ctx,
-                                   &num_streams, &streams);
+       status = vfs_streaminfo(conn, NULL, smb_fname->base_name, mem_ctx,
+                               &num_streams, &streams);
 
        if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
                SET_STAT_INVALID(smb_fname->st);
index 2d6fa264cc67b0d08d6529d8c447e219800312ce..8e78d3cd9cc1802d0bece50380b566c33c3f46fc 100644 (file)
@@ -702,7 +702,7 @@ void reply_ntcreate_and_X(struct smb_request *req)
                if (NT_STATUS_IS_OK(status) && num_names) {
                        file_status &= ~NO_EAS;
                }
-               status = SMB_VFS_STREAMINFO(conn, NULL, smb_fname->base_name, ctx,
+               status = vfs_streaminfo(conn, NULL, smb_fname->base_name, ctx,
                        &num_streams, &streams);
                /* There is always one stream, ::$DATA. */
                if (NT_STATUS_IS_OK(status) && num_streams > 1) {
@@ -1283,7 +1283,7 @@ static void call_nt_transact_create(connection_struct *conn,
                if (NT_STATUS_IS_OK(status) && num_names) {
                        file_status &= ~NO_EAS;
                }
-               status = SMB_VFS_STREAMINFO(conn, NULL, smb_fname->base_name, ctx,
+               status = vfs_streaminfo(conn, NULL, smb_fname->base_name, ctx,
                        &num_streams, &streams);
                /* There is always one stream, ::$DATA. */
                if (NT_STATUS_IS_OK(status) && num_streams > 1) {
index b897c8aa2565b9856f5ff78613262924ffa5cc65..f3fccd01d233dbd42617f6a7534ae3b0a950d249 100644 (file)
@@ -2972,8 +2972,8 @@ NTSTATUS open_streams_for_delete(connection_struct *conn,
        TALLOC_CTX *frame = talloc_stackframe();
        NTSTATUS status;
 
-       status = SMB_VFS_STREAMINFO(conn, NULL, fname, talloc_tos(),
-                                   &num_streams, &stream_info);
+       status = vfs_streaminfo(conn, NULL, fname, talloc_tos(),
+                               &num_streams, &stream_info);
 
        if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)
            || NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
@@ -2983,7 +2983,7 @@ NTSTATUS open_streams_for_delete(connection_struct *conn,
        }
 
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(10, ("SMB_VFS_STREAMINFO failed: %s\n",
+               DEBUG(10, ("vfs_streaminfo failed: %s\n",
                           nt_errstr(status)));
                goto fail;
        }
index e2b02ecef4cb6f41473ccd85a0fa2269192d6788..49bb911cbca08953ae4cd4ee5e5f818d24bbb5ed 100644 (file)
@@ -1179,6 +1179,12 @@ int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname,
                        SMB_STRUCT_STAT *psbuf);
 NTSTATUS vfs_stat_fsp(files_struct *fsp);
 NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid);
+NTSTATUS vfs_streaminfo(connection_struct *conn,
+                       struct files_struct *fsp,
+                       const char *fname,
+                       TALLOC_CTX *mem_ctx,
+                       unsigned int *num_streams,
+                       struct stream_struct **streams);
 
 /* The following definitions come from smbd/avahi_register.c */
 
index 6ef7156c8e01501f22f0335da6f6b4f32c082783..8b6a15f9f83a24c3bbb78fe2537484dac5f91c58 100644 (file)
@@ -4681,9 +4681,8 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
                                return NT_STATUS_INVALID_PARAMETER;
                        }
 
-                       status = SMB_VFS_STREAMINFO(
-                               conn, fsp, smb_fname->base_name, talloc_tos(),
-                               &num_streams, &streams);
+                       status = vfs_streaminfo(conn, fsp, smb_fname->base_name,
+                                               talloc_tos(), &num_streams, &streams);
 
                        if (!NT_STATUS_IS_OK(status)) {
                                DEBUG(10, ("could not get stream info: %s\n",
index 7f166701732be5cee671630331f96423d81aff24..1424d502d69b8621057125dbe4dc8710e136f8c3 100644 (file)
@@ -1126,6 +1126,21 @@ NTSTATUS vfs_stat_fsp(files_struct *fsp)
        return NT_STATUS_OK;
 }
 
+/**
+ * Initialize num_streams and streams, then call VFS op streaminfo
+ */
+NTSTATUS vfs_streaminfo(connection_struct *conn,
+                       struct files_struct *fsp,
+                       const char *fname,
+                       TALLOC_CTX *mem_ctx,
+                       unsigned int *num_streams,
+                       struct stream_struct **streams)
+{
+       *num_streams = 0;
+       *streams = NULL;
+       return SMB_VFS_STREAMINFO(conn, fsp, fname, mem_ctx, num_streams, streams);
+}
+
 /*
   generate a file_id from a stat structure
  */