Ignore:
Timestamp:
Jun 17, 2009, 2:19:52 PM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.3 branch to 3.3.5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.3.x/source/smbd/filename.c

    r224 r274  
    3737                                     const char *name, TALLOC_CTX *mem_ctx,
    3838                                     char **found_name);
     39static int get_real_filename_internal(connection_struct *conn,
     40                                      const char *path, const char *name,
     41                                      bool mangled,
     42                                      TALLOC_CTX *mem_ctx, char **found_name);
    3943
    4044/****************************************************************************
     
    494498                                }
    495499
    496                                 /* ENOENT is the only valid error here. */
    497                                 if ((errno != 0) && (errno != ENOENT)) {
     500                                /*
     501                                 * ENOENT/EACCESS are the only valid errors
     502                                 * here. EACCESS needs handling here for
     503                                 * "dropboxes", i.e. directories where users
     504                                 * can only put stuff with permission -wx.
     505                                 */
     506                                if ((errno != 0) && (errno != ENOENT)
     507                                    && (errno != EACCES)) {
    498508                                        /*
    499509                                         * ENOTDIR and ELOOP both map to
     
    505515                                                result =
    506516                                                NT_STATUS_OBJECT_PATH_NOT_FOUND;
    507                                         }
    508                                         else {
     517                                        } else {
    509518                                                result =
    510519                                                map_nt_error_from_unix(errno);
     
    838847                        /* Name is now unmangled. */
    839848                        name = unmangled_name;
    840                 }
    841                 return get_real_filename(conn, path, name, mem_ctx,
    842                                          found_name);
     849                } else {
     850                        /*
     851                         * If we have mangled names, do not ask the VFS'es
     852                         * GET_REAL_FILENAME. The Unix file system below does
     853                         * not know about Samba's style of mangling.
     854                         *
     855                         * Boolean flags passed down are evil, the alternative
     856                         * would be to pass a comparison function down into
     857                         * the loop in get_real_filename_internal(). For now,
     858                         * do the quick&dirty boolean flag approach.
     859                         */
     860                        return get_real_filename_internal(conn, path, name,
     861                                                          true,
     862                                                          mem_ctx, found_name);
     863                }
    843864        }
    844865
     
    847868}
    848869
    849 int get_real_filename(connection_struct *conn, const char *path,
    850                       const char *name, TALLOC_CTX *mem_ctx,
    851                       char **found_name)
     870static int get_real_filename_internal(connection_struct *conn,
     871                                      const char *path, const char *name,
     872                                      bool mangled,
     873                                      TALLOC_CTX *mem_ctx, char **found_name)
    852874{
    853875        struct smb_Dir *cur_dir;
    854876        const char *dname;
    855         bool mangled;
    856877        char *unmangled_name = NULL;
    857878        long curpos;
     
    902923        errno = ENOENT;
    903924        return -1;
     925}
     926
     927
     928
     929int get_real_filename(connection_struct *conn,
     930                      const char *path, const char *name,
     931                      TALLOC_CTX *mem_ctx, char **found_name)
     932{
     933        /*
     934         * This is the default VFS function. If we end up here, we know we
     935         * don't have mangled names around.
     936         */
     937        return get_real_filename_internal(conn, path, name, false,
     938                                          mem_ctx, found_name);
    904939}
    905940
Note: See TracChangeset for help on using the changeset viewer.