]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
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)
committerKarolin Seeger <kseeger@samba.org>
Mon, 23 Jan 2012 20:25:40 +0000 (21:25 +0100)
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Mon Oct 17 21:39:32 CEST 2011 on sn-devel-104
(cherry picked from commit c3bdcab5161107be8155a7913d9cb325383a781d)
(cherry picked from commit b8244184fe37da645f9544b68197707abe0d2ad3)

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 aad8a08e2b54cdfc20d747b480737ad129fc649f..e22a97a8ee14a838c4c77aaadbfef4f02f842e37 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 603cfffb332d390e9fed09a2fa3e6342af67c5a1..25c8b4640e9dbe69ef6a69ca79c02ad6244e5e86 100644 (file)
@@ -207,8 +207,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"));
@@ -217,7 +217,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 ec9ca20e32ce00a03d9c664dbec7af8f2a1e545c..25301e60af2faa84e060cfdec42f1e8e3acf7b8b 100644 (file)
@@ -1185,8 +1185,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 8f5a4c560472cd862b8837a53d902bb229875ec2..81e850c984f8199e9686b5897909ebd46a5381fd 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 0813496bf96c2efc20db5d431d4c4bfe72f0699b..09716d906be37bbb345f0567d36b85c107aad872 100644 (file)
@@ -2974,8 +2974,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)) {
@@ -2985,7 +2985,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 6cbbcfa8405726a443b116b1dc5392dcb1231db1..c455ffe36dbe2ec56fbd3158a9bf2b1049eb9c2e 100644 (file)
@@ -1167,6 +1167,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 ffa730945ba2eaf9422c13a529dd0f43717dda0c..0931fff54aa2f0029abbeb2cd2e282442f8e950b 100644 (file)
@@ -4683,9 +4683,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 35a8331e8d8e0cfe4bf0c2501664c2d479f281e6..6c56964628a88a1f10f6e1a075fff4fe27f90e57 100644 (file)
@@ -1125,6 +1125,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
  */