~ubuntu-branches/ubuntu/precise/samba/precise

« back to all changes in this revision

Viewing changes to source4/ntvfs/posix/pvfs_acl_nfs4.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* 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/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
        struct nfs4acl *acl;
40
40
        struct security_descriptor *sd;
41
41
        int i, num_ids;
42
 
        struct id_mapping *ids;
 
42
        struct id_map *ids;
43
43
        struct composite_context *ctx;
44
44
 
45
45
        acl = talloc_zero(mem_ctx, struct nfs4acl);
47
47
 
48
48
        status = pvfs_xattr_ndr_load(pvfs, mem_ctx, name->full_name, fd, 
49
49
                                     NFS4ACL_XATTR_NAME,
50
 
                                     acl, ndr_pull_nfs4acl);
 
50
                                     acl, (void *) ndr_pull_nfs4acl);
51
51
        if (!NT_STATUS_IS_OK(status)) {
52
52
                talloc_free(acl);
53
53
                return status;
62
62
 
63
63
        /* the number of ids to map is the acl count plus uid and gid */
64
64
        num_ids = acl->a_count +2;
65
 
        ids = talloc_array(sd, struct id_mapping, num_ids);
 
65
        ids = talloc_array(sd, struct id_map, num_ids);
66
66
        NT_STATUS_HAVE_NO_MEMORY(ids);
67
67
 
68
 
        ids[0].unixid = talloc(ids, struct unixid);
69
 
        NT_STATUS_HAVE_NO_MEMORY(ids[0].unixid);
70
 
        ids[0].unixid->id = name->st.st_uid;
71
 
        ids[0].unixid->type = ID_TYPE_UID;
 
68
        ids[0].xid.id = name->st.st_uid;
 
69
        ids[0].xid.type = ID_TYPE_UID;
72
70
        ids[0].sid = NULL;
73
 
        ids[0].status = NT_STATUS_NONE_MAPPED;
 
71
        ids[0].status = ID_UNKNOWN;
74
72
 
75
 
        ids[1].unixid = talloc(ids, struct unixid);
76
 
        NT_STATUS_HAVE_NO_MEMORY(ids[1].unixid);
77
 
        ids[1].unixid->id = name->st.st_gid;
78
 
        ids[1].unixid->type = ID_TYPE_GID;
 
73
        ids[1].xid.id = name->st.st_gid;
 
74
        ids[1].xid.type = ID_TYPE_GID;
79
75
        ids[1].sid = NULL;
80
 
        ids[1].status = NT_STATUS_NONE_MAPPED;
 
76
        ids[1].status = ID_UNKNOWN;
81
77
 
82
78
        for (i=0;i<acl->a_count;i++) {
83
79
                struct nfs4ace *a = &acl->ace[i];
84
 
                ids[i+2].unixid = talloc(ids, struct unixid);
85
 
                NT_STATUS_HAVE_NO_MEMORY(ids[i+2].unixid);
86
 
                ids[i+2].unixid->id = a->e_id;
 
80
                ids[i+2].xid.id = a->e_id;
87
81
                if (a->e_flags & ACE4_IDENTIFIER_GROUP) {
88
 
                        ids[i+2].unixid->type = ID_TYPE_GID;
 
82
                        ids[i+2].xid.type = ID_TYPE_GID;
89
83
                } else {
90
 
                        ids[i+2].unixid->type = ID_TYPE_UID;
 
84
                        ids[i+2].xid.type = ID_TYPE_UID;
91
85
                }
92
86
                ids[i+2].sid = NULL;
93
 
                ids[i+2].status = NT_STATUS_NONE_MAPPED;
 
87
                ids[i+2].status = ID_UNKNOWN;
94
88
        }
95
89
 
96
90
        /* Allocate memory for the sids from the security descriptor to be on
127
121
        struct nfs4acl acl;
128
122
        int i;
129
123
        TALLOC_CTX *tmp_ctx;
130
 
        struct id_mapping *ids;
 
124
        struct id_map *ids;
131
125
        struct composite_context *ctx;
132
126
 
133
127
        tmp_ctx = talloc_new(pvfs);
146
140
                return NT_STATUS_NO_MEMORY;
147
141
        }
148
142
 
149
 
        ids = talloc_array(tmp_ctx, struct id_mapping, acl.a_count);
 
143
        ids = talloc_array(tmp_ctx, struct id_map, acl.a_count);
150
144
        if (ids == NULL) {
151
145
                talloc_free(tmp_ctx);
152
146
                return NT_STATUS_NO_MEMORY;
154
148
 
155
149
        for (i=0;i<acl.a_count;i++) {
156
150
                struct security_ace *ace = &sd->dacl->aces[i];
157
 
                ids[i].unixid = NULL;
 
151
                ZERO_STRUCT(ids[i].xid);
158
152
                ids[i].sid = dom_sid_dup(ids, &ace->trustee);
159
153
                if (ids[i].sid == NULL) {
160
154
                        talloc_free(tmp_ctx);
161
155
                        return NT_STATUS_NO_MEMORY;
162
156
                }
163
 
                ids[i].status = NT_STATUS_NONE_MAPPED;
 
157
                ids[i].status = ID_UNKNOWN;
164
158
        }
165
159
 
166
160
        ctx = wbc_sids_to_xids_send(pvfs->wbc_ctx,ids, acl.a_count, ids);
180
174
                a->e_type  = ace->type;
181
175
                a->e_flags = ace->flags;
182
176
                a->e_mask  = ace->access_mask;
183
 
                if (ids[i].unixid->type != ID_TYPE_UID) {
 
177
                if (ids[i].xid.type != ID_TYPE_UID) {
184
178
                        a->e_flags |= ACE4_IDENTIFIER_GROUP;
185
179
                }
186
 
                a->e_id = ids[i].unixid->id;
 
180
                a->e_id = ids[i].xid.id;
187
181
                a->e_who   = "";
188
182
        }
189
183
 
190
184
        privs = root_privileges();
191
185
        status = pvfs_xattr_ndr_save(pvfs, name->full_name, fd, 
192
186
                                     NFS4ACL_XATTR_NAME, 
193
 
                                     &acl, ndr_push_nfs4acl);
 
187
                                     &acl, (void *) ndr_push_nfs4acl);
194
188
        talloc_free(privs);
195
189
 
196
190
        talloc_free(tmp_ctx);