The branch, master has been updated
       via  2a3270beec2800e0a5dcb69af111d053abaa9245 (commit)
       via  5234d10c8e8c9d0d2576133c209ba474e1867d28 (commit)
       via  09fe57923ab5570aad106b6b82faabe3fcd130fd (commit)
       via  e91d5dbed05f364d155ff8b91ddf5af718fb1462 (commit)
      from  1f3d0c54850b4b9ab6889d50bfa2049970a7cb17 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 2a3270beec2800e0a5dcb69af111d053abaa9245
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Aug 19 09:58:38 2009 +0200

    s3:smbd: teach filename_convert() about fake files (2nd fix for bug #6642)
    
    metze

commit 5234d10c8e8c9d0d2576133c209ba474e1867d28
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Aug 19 09:57:47 2009 +0200

    s3:smbd: add is_fake_file_path() that takes only the raw path as string
    
    metze

commit 09fe57923ab5570aad106b6b82faabe3fcd130fd
Author: Stefan Metzmacher <me...@samba.org>
Date:   Tue Aug 18 11:34:54 2009 +0200

    s3:streams: check for :$DATA only in the backend (fix bug #6642)
    
    We need to allow "\\$Extend\\$Quota:$Q:$INDEX_ALLOCATION" to pass
    check_path(), so that the Quota Dialog works.
    
    metze

commit e91d5dbed05f364d155ff8b91ddf5af718fb1462
Author: Stefan Metzmacher <me...@samba.org>
Date:   Tue Aug 18 11:32:37 2009 +0200

    s3:error_map: make NTSTATUS -> errno -> NTSTATUS mapping consistent for 
NT_STATUS_INVALID_PARAMETER
    
    Why have we mapped EINVAL -> NT_STATUS_INVALID_HANDLE before?
    
    metze

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

Summary of changes:
 source3/include/proto.h             |    1 +
 source3/lib/errmap_unix.c           |    2 +-
 source3/modules/onefs_streams.c     |    3 ++
 source3/modules/vfs_streams_depot.c |   10 +++++++-
 source3/smbd/fake_file.c            |   36 +++++++++++++++++++++-------------
 source3/smbd/filename.c             |   11 ++++++++++
 source3/smbd/reply.c                |    3 --
 7 files changed, 46 insertions(+), 20 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index b87e3b7..ac0eed2 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -6288,6 +6288,7 @@ void reply_openerror(struct smb_request *req, NTSTATUS 
status);
 
 /* The following definitions come from smbd/fake_file.c  */
 
+enum FAKE_FILE_TYPE is_fake_file_path(const char *path);
 enum FAKE_FILE_TYPE is_fake_file(const struct smb_filename *smb_fname);
 NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
                                uint16_t current_vuid,
diff --git a/source3/lib/errmap_unix.c b/source3/lib/errmap_unix.c
index d43598b..d5b94e9 100644
--- a/source3/lib/errmap_unix.c
+++ b/source3/lib/errmap_unix.c
@@ -31,7 +31,7 @@ const struct unix_error_map unix_dos_nt_errmap[] = {
        { ENOTDIR, ERRDOS, ERRbadpath,  NT_STATUS_NOT_A_DIRECTORY },
        { EIO, ERRHRD, ERRgeneral, NT_STATUS_IO_DEVICE_ERROR },
        { EBADF, ERRSRV, ERRsrverror, NT_STATUS_INVALID_HANDLE },
-       { EINVAL, ERRSRV, ERRsrverror, NT_STATUS_INVALID_HANDLE },
+       { EINVAL, ERRSRV, ERRsrverror, NT_STATUS_INVALID_PARAMETER },
        { EEXIST, ERRDOS, ERRfilexists, NT_STATUS_OBJECT_NAME_COLLISION},
        { ENFILE, ERRDOS, ERRnofids, NT_STATUS_TOO_MANY_OPENED_FILES },
        { EMFILE, ERRDOS, ERRnofids, NT_STATUS_TOO_MANY_OPENED_FILES },
diff --git a/source3/modules/onefs_streams.c b/source3/modules/onefs_streams.c
index 66eda57..da26661 100644
--- a/source3/modules/onefs_streams.c
+++ b/source3/modules/onefs_streams.c
@@ -55,6 +55,9 @@ NTSTATUS onefs_stream_prep_smb_fname(TALLOC_CTX *ctx,
                /* Strip off the :$DATA if one exists. */
                str_tmp = strrchr_m(stream_name, ':');
                if (str_tmp) {
+                       if (StrCaseCmp(str_tmp, ":$DATA") != 0) {
+                               return NT_STATUS_INVALID_PARAMETER;
+                       }
                        str_tmp[0] = '\0';
                }
        }
diff --git a/source3/modules/vfs_streams_depot.c 
b/source3/modules/vfs_streams_depot.c
index d09255a..aa01891 100644
--- a/source3/modules/vfs_streams_depot.c
+++ b/source3/modules/vfs_streams_depot.c
@@ -321,6 +321,14 @@ static NTSTATUS stream_smb_fname(vfs_handle_struct *handle,
 
        *smb_fname_out = NULL;
 
+       stype = strchr_m(smb_fname->stream_name + 1, ':');
+
+       if (stype) {
+               if (StrCaseCmp(stype, ":$DATA") != 0) {
+                       return NT_STATUS_INVALID_PARAMETER;
+               }
+       }
+
        dirname = stream_dir(handle, smb_fname, NULL, create_dir);
 
        if (dirname == NULL) {
@@ -328,8 +336,6 @@ static NTSTATUS stream_smb_fname(vfs_handle_struct *handle,
                goto fail;
        }
 
-       stype = strchr_m(smb_fname->stream_name + 1, ':');
-
        stream_fname = talloc_asprintf(talloc_tos(), "%s/%s", dirname,
                                       smb_fname->stream_name);
 
diff --git a/source3/smbd/fake_file.c b/source3/smbd/fake_file.c
index 743d88f..6898793 100644
--- a/source3/smbd/fake_file.c
+++ b/source3/smbd/fake_file.c
@@ -71,38 +71,46 @@ static struct fake_file_handle *init_fake_file_handle(enum 
FAKE_FILE_TYPE type)
  Does this name match a fake filename ?
 ****************************************************************************/
 
-enum FAKE_FILE_TYPE is_fake_file(const struct smb_filename *smb_fname)
+enum FAKE_FILE_TYPE is_fake_file_path(const char *path)
 {
-#ifdef HAVE_SYS_QUOTAS
        int i;
+
+       if (!path) {
+               return FAKE_FILE_TYPE_NONE;
+       }
+
+       for (i=0;fake_files[i].name!=NULL;i++) {
+               if 
(strncmp(path,fake_files[i].name,strlen(fake_files[i].name))==0) {
+                       DEBUG(5,("is_fake_file: [%s] is a fake file\n",path));
+                       return fake_files[i].type;
+               }
+       }
+
+       return FAKE_FILE_TYPE_NONE;
+}
+
+enum FAKE_FILE_TYPE is_fake_file(const struct smb_filename *smb_fname)
+{
        char *fname = NULL;
        NTSTATUS status;
-#endif
+       enum FAKE_FILE_TYPE ret;
 
        if (!smb_fname) {
                return FAKE_FILE_TYPE_NONE;
        }
 
-#ifdef HAVE_SYS_QUOTAS
        status = get_full_smb_filename(talloc_tos(), smb_fname, &fname);
        if (!NT_STATUS_IS_OK(status)) {
                return FAKE_FILE_TYPE_NONE;
        }
 
-       for (i=0;fake_files[i].name!=NULL;i++) {
-               if 
(strncmp(fname,fake_files[i].name,strlen(fake_files[i].name))==0) {
-                       DEBUG(5,("is_fake_file: [%s] is a fake file\n",fname));
-                       TALLOC_FREE(fname);
-                       return fake_files[i].type;
-               }
-       }
+       ret = is_fake_file_path(fname);
+
        TALLOC_FREE(fname);
-#endif
 
-       return FAKE_FILE_TYPE_NONE;
+       return ret;
 }
 
-
 /****************************************************************************
  Open a fake quota file with a share mode.
 ****************************************************************************/
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 1e2ebcf..2538bc1 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -1073,6 +1073,17 @@ NTSTATUS filename_convert(TALLOC_CTX *ctx,
                return status;
        }
 
+       if (is_fake_file_path(name_in)) {
+               SMB_STRUCT_STAT st;
+               ZERO_STRUCT(st);
+               st.st_ex_nlink = 1;
+               status = create_synthetic_smb_fname_split(ctx,
+                                                         name_in,
+                                                         &st,
+                                                         pp_smb_fname);
+               return status;
+       }
+
        /*
         * If the caller conditionally allows wildcard lookups, only add the
         * always allow if the path actually does contain a wildcard.
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 7b290a6..bdc71c2 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -65,9 +65,6 @@ static NTSTATUS check_path_syntax_internal(char *path,
                                if (strchr_m(&s[1], ':')) {
                                        return NT_STATUS_OBJECT_NAME_INVALID;
                                }
-                               if (StrCaseCmp(s, ":$DATA") != 0) {
-                                       return NT_STATUS_INVALID_PARAMETER;
-                               }
                                break;
                        }
                }


-- 
Samba Shared Repository

Reply via email to