~ubuntu-branches/ubuntu/utopic/samba/utopic

« back to all changes in this revision

Viewing changes to source3/smbd/filename.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-02-21 09:06:34 UTC
  • mfrom: (0.39.23 sid)
  • Revision ID: package-import@ubuntu.com-20120221090634-svd7q7m33pfz0847
Tags: 2:3.6.3-1ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module.
* Dropped:
  - debian/patches/fix-samba-printer-browsing.patch: No longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
383
383
 
384
384
        if((!conn->case_sensitive || !(conn->fs_capabilities &
385
385
                                       FILE_CASE_SENSITIVE_SEARCH)) &&
386
 
            stat_cache_lookup(conn, &smb_fname->base_name, &dirpath, &start,
 
386
            stat_cache_lookup(conn, posix_pathnames, &smb_fname->base_name, &dirpath, &start,
387
387
                              &smb_fname->st)) {
388
388
                goto done;
389
389
        }
977
977
}
978
978
 
979
979
/****************************************************************************
 
980
 Ensure a path is not vetod.
 
981
****************************************************************************/
 
982
 
 
983
NTSTATUS check_veto_path(connection_struct *conn, const char *name)
 
984
{
 
985
        if (IS_VETO_PATH(conn, name))  {
 
986
                /* Is it not dot or dot dot. */
 
987
                if (!(ISDOT(name) || ISDOTDOT(name))) {
 
988
                        DEBUG(5,("check_veto_path: file path name %s vetoed\n",
 
989
                                                name));
 
990
                        return map_nt_error_from_unix(ENOENT);
 
991
                }
 
992
        }
 
993
        return NT_STATUS_OK;
 
994
}
 
995
 
 
996
/****************************************************************************
980
997
 Check a filename - possibly calling check_reduced_name.
981
998
 This is called by every routine before it allows an operation on a filename.
982
999
 It does any final confirmation necessary to ensure that the filename is
985
1002
 
986
1003
NTSTATUS check_name(connection_struct *conn, const char *name)
987
1004
{
988
 
        if (IS_VETO_PATH(conn, name))  {
989
 
                /* Is it not dot or dot dot. */
990
 
                if (!((name[0] == '.') && (!name[1] ||
991
 
                                        (name[1] == '.' && !name[2])))) {
992
 
                        DEBUG(5,("check_name: file path name %s vetoed\n",
993
 
                                                name));
994
 
                        return map_nt_error_from_unix(ENOENT);
995
 
                }
 
1005
        NTSTATUS status = check_veto_path(conn, name);
 
1006
 
 
1007
        if (!NT_STATUS_IS_OK(status)) {
 
1008
                return status;
996
1009
        }
997
1010
 
998
1011
        if (!lp_widelinks(SNUM(conn)) || !lp_symlinks(SNUM(conn))) {
999
 
                NTSTATUS status = check_reduced_name(conn,name);
 
1012
                status = check_reduced_name(conn,name);
1000
1013
                if (!NT_STATUS_IS_OK(status)) {
1001
1014
                        DEBUG(5,("check_name: name %s failed with %s\n",name,
1002
1015
                                                nt_errstr(status)));
1170
1183
                                  struct smb_filename *smb_fname)
1171
1184
{
1172
1185
        NTSTATUS status;
1173
 
        unsigned int i, num_streams;
 
1186
        unsigned int i, num_streams = 0;
1174
1187
        struct stream_struct *streams = NULL;
1175
1188
 
1176
1189
        if (SMB_VFS_STAT(conn, smb_fname) == 0) {
1185
1198
        }
1186
1199
 
1187
1200
        /* Fall back to a case-insensitive scan of all streams on the file. */
1188
 
        status = SMB_VFS_STREAMINFO(conn, NULL, smb_fname->base_name, mem_ctx,
1189
 
                                    &num_streams, &streams);
 
1201
        status = vfs_streaminfo(conn, NULL, smb_fname->base_name, mem_ctx,
 
1202
                                &num_streams, &streams);
1190
1203
 
1191
1204
        if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
1192
1205
                SET_STAT_INVALID(smb_fname->st);
1314
1327
                return status;
1315
1328
        }
1316
1329
 
 
1330
        if ((ucf_flags & UCF_UNIX_NAME_LOOKUP) &&
 
1331
                        VALID_STAT((*pp_smb_fname)->st) &&
 
1332
                        S_ISLNK((*pp_smb_fname)->st.st_ex_mode)) {
 
1333
                return check_veto_path(conn, (*pp_smb_fname)->base_name);
 
1334
        }
 
1335
 
1317
1336
        status = check_name(conn, (*pp_smb_fname)->base_name);
1318
1337
        if (!NT_STATUS_IS_OK(status)) {
1319
1338
                DEBUG(3,("filename_convert: check_name failed "