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

« back to all changes in this revision

Viewing changes to source3/modules/vfs_acl_common.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:
378
378
                                return map_nt_error_from_unix(errno);
379
379
                        }
380
380
                }
381
 
                is_directory = S_ISDIR(sbuf.st_ex_mode);
 
381
                is_directory = S_ISDIR(psbuf->st_ex_mode);
382
382
 
383
383
                if (ignore_file_system_acl) {
384
384
                        TALLOC_FREE(pdesc_next);
413
413
                psd->group_sid = NULL;
414
414
        }
415
415
        if (!(security_info & SECINFO_DACL)) {
 
416
                psd->type &= ~SEC_DESC_DACL_PRESENT;
416
417
                psd->dacl = NULL;
417
418
        }
418
419
        if (!(security_info & SECINFO_SACL)) {
 
420
                psd->type &= ~SEC_DESC_SACL_PRESENT;
419
421
                psd->sacl = NULL;
420
422
        }
421
423
 
537
539
                                        parent_name,
538
540
                                        (SECINFO_OWNER |
539
541
                                         SECINFO_GROUP |
540
 
                                         SECINFO_DACL),
 
542
                                         SECINFO_DACL  |
 
543
                                         SECINFO_SACL),
541
544
                                        pp_parent_desc);
542
545
 
543
546
        if (!NT_STATUS_IS_OK(status)) {
620
623
                                fname,
621
624
                                (SECINFO_OWNER |
622
625
                                 SECINFO_GROUP |
623
 
                                 SECINFO_DACL),
 
626
                                 SECINFO_DACL  |
 
627
                                 SECINFO_SACL),
624
628
                                &pdesc);
625
629
        if (NT_STATUS_IS_OK(status)) {
626
630
                /* See if we can access it. */
631
635
                                        &access_granted);
632
636
                if (!NT_STATUS_IS_OK(status)) {
633
637
                        DEBUG(10,("open_acl_xattr: %s open "
 
638
                                "for access 0x%x (0x%x) "
634
639
                                "refused with error %s\n",
635
640
                                fsp_str_dbg(fsp),
 
641
                                (unsigned int)fsp->access_mask,
 
642
                                (unsigned int)access_granted,
636
643
                                nt_errstr(status) ));
637
644
                        goto err;
638
645
                }
917
924
{
918
925
        int ret;
919
926
 
 
927
        /* Try the normal rmdir first. */
920
928
        ret = SMB_VFS_NEXT_RMDIR(handle, path);
921
 
        if (!(ret == -1 && (errno == EACCES || errno == EPERM))) {
922
 
                DEBUG(10,("rmdir_acl_common: unlink of %s failed %s\n",
923
 
                        path,
924
 
                        strerror(errno) ));
925
 
                return ret;
 
929
        if (ret == 0) {
 
930
                return 0;
 
931
        }
 
932
        if (errno == EACCES || errno == EPERM) {
 
933
                /* Failed due to access denied,
 
934
                   see if we need to root override. */
 
935
                return acl_common_remove_object(handle,
 
936
                                                path,
 
937
                                                true);
926
938
        }
927
939
 
928
 
        return acl_common_remove_object(handle,
929
 
                                        path,
930
 
                                        true);
 
940
        DEBUG(10,("rmdir_acl_common: unlink of %s failed %s\n",
 
941
                path,
 
942
                strerror(errno) ));
 
943
        return -1;
931
944
}
932
945
 
933
946
static NTSTATUS create_file_acl_common(struct vfs_handle_struct *handle,
1047
1060
{
1048
1061
        int ret;
1049
1062
 
 
1063
        /* Try the normal unlink first. */
1050
1064
        ret = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
1051
 
        if (!(ret == -1 && (errno == EACCES || errno == EPERM))) {
1052
 
                DEBUG(10,("unlink_acl_common: unlink of %s failed %s\n",
1053
 
                        smb_fname->base_name,
1054
 
                        strerror(errno) ));
1055
 
                return ret;
1056
 
        }
1057
 
        /* Don't do anything fancy for streams. */
1058
 
        if (smb_fname->stream_name) {
1059
 
                return ret;
1060
 
        }
 
1065
        if (ret == 0) {
 
1066
                return 0;
 
1067
        }
 
1068
        if (errno == EACCES || errno == EPERM) {
 
1069
                /* Failed due to access denied,
 
1070
                   see if we need to root override. */
1061
1071
 
1062
 
        return acl_common_remove_object(handle,
 
1072
                /* Don't do anything fancy for streams. */
 
1073
                if (smb_fname->stream_name) {
 
1074
                        return -1;
 
1075
                }
 
1076
                return acl_common_remove_object(handle,
1063
1077
                                        smb_fname->base_name,
1064
1078
                                        false);
 
1079
        }
 
1080
 
 
1081
        DEBUG(10,("unlink_acl_common: unlink of %s failed %s\n",
 
1082
                smb_fname->base_name,
 
1083
                strerror(errno) ));
 
1084
        return -1;
1065
1085
}
1066
1086
 
1067
1087
static int chmod_acl_module_common(struct vfs_handle_struct *handle,