The branch, v3-3-test has been updated
       via  5ed457f984c093642afde854715b3792524e0798 (commit)
       via  79003837947882c4a62490c0eff7984f7c343807 (commit)
      from  1b040289f14bb22d3b6ab07a452236549d6c9bf6 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit 5ed457f984c093642afde854715b3792524e0798
Author: Volker Lendecke <[email protected]>
Date:   Wed Apr 15 13:01:09 2009 +0200

    Do not use the file system GET_REAL_FILENAME for mangled names

commit 79003837947882c4a62490c0eff7984f7c343807
Author: Karolin Seeger <[email protected]>
Date:   Fri May 15 15:25:30 2009 +0200

    Revert "Do not use the file system GET_REAL_FILENAME for mangled names"
    
    This reverts commit 5a5dcd125fe236ddd93a6e56ae361fc84e306185.

-----------------------------------------------------------------------

Summary of changes:
 source/smbd/filename.c |   42 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 36 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/smbd/filename.c b/source/smbd/filename.c
index 031668f..d404b90 100644
--- a/source/smbd/filename.c
+++ b/source/smbd/filename.c
@@ -36,6 +36,10 @@ static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx,
 static int get_real_filename_mangled(connection_struct *conn, const char *path,
                                     const char *name, TALLOC_CTX *mem_ctx,
                                     char **found_name);
+static int get_real_filename_internal(connection_struct *conn,
+                                     const char *path, const char *name,
+                                     bool mangled,
+                                     TALLOC_CTX *mem_ctx, char **found_name);
 
 /****************************************************************************
  Mangle the 2nd name and check if it is then equal to the first name.
@@ -837,22 +841,34 @@ static int get_real_filename_mangled(connection_struct 
*conn, const char *path,
                if (!mangled) {
                        /* Name is now unmangled. */
                        name = unmangled_name;
+               } else {
+                       /*
+                        * If we have mangled names, do not ask the VFS'es
+                        * GET_REAL_FILENAME. The Unix file system below does
+                        * not know about Samba's style of mangling.
+                        *
+                        * Boolean flags passed down are evil, the alternative
+                        * would be to pass a comparison function down into
+                        * the loop in get_real_filename_internal(). For now,
+                        * do the quick&dirty boolean flag approach.
+                        */
+                       return get_real_filename_internal(conn, path, name,
+                                                         true,
+                                                         mem_ctx, found_name);
                }
-               return get_real_filename(conn, path, name, mem_ctx,
-                                        found_name);
        }
 
        return SMB_VFS_GET_REAL_FILENAME(conn, path, name, mem_ctx,
                                         found_name);
 }
 
-int get_real_filename(connection_struct *conn, const char *path,
-                     const char *name, TALLOC_CTX *mem_ctx,
-                     char **found_name)
+static int get_real_filename_internal(connection_struct *conn,
+                                     const char *path, const char *name,
+                                     bool mangled,
+                                     TALLOC_CTX *mem_ctx, char **found_name)
 {
        struct smb_Dir *cur_dir;
        const char *dname;
-       bool mangled;
        char *unmangled_name = NULL;
        long curpos;
 
@@ -903,6 +919,20 @@ int get_real_filename(connection_struct *conn, const char 
*path,
        return -1;
 }
 
+
+
+int get_real_filename(connection_struct *conn,
+                     const char *path, const char *name,
+                     TALLOC_CTX *mem_ctx, char **found_name)
+{
+       /*
+        * This is the default VFS function. If we end up here, we know we
+        * don't have mangled names around.
+        */
+       return get_real_filename_internal(conn, path, name, false,
+                                         mem_ctx, found_name);
+}
+
 static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx,
                                  connection_struct *conn,
                                  const char *orig_path,


-- 
Samba Shared Repository

Reply via email to