Changeset 274 for branches/samba-3.3.x/source/smbd/posix_acls.c#
- Timestamp:
- Jun 17, 2009, 2:19:52 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/smbd/posix_acls.c#
r206 r274 1 1 *************** 2 *** 4289,4298 **** 3 if (!S_ISDIR(sbuf.st_mode)) { 2 *** 1117,1132 **** 3 if (sid_equal(&group_ace->trustee, &global_sid_World)) 4 return True; 5 6 - /* Assume that the current user is in the current group (force group) */ 7 8 - if (uid_ace->unix_ug.uid == current_user.ut.uid && group_ace->unix_ug.gid == current_user.ut.gid) 9 - return True; 10 11 /* u_name talloc'ed off tos. */ 12 u_name = uidtoname(uid_ace->unix_ug.uid); 13 if (!u_name) { 4 14 return False; 5 15 } 6 if (current_user.ut.uid == 0 || conn->admin_user) { 7 /* I'm sorry sir, I didn't know you were root... */ 16 return user_in_group_sid(u_name, &group_ace->trustee); 17 } 18 19 --- 1117,1147 ---- 20 if (sid_equal(&group_ace->trustee, &global_sid_World)) 8 21 return True; 9 }10 22 11 /* Check primary owner write access. */ 12 if (current_user.ut.uid == sbuf.st_uid) { 13 --- 4289,4301 ---- 14 if (!S_ISDIR(sbuf.st_mode)) { 23 + /* 24 + * if it's the current user, we already have the unix token 25 + * and don't need to do the complex user_in_group_sid() call 26 + */ 27 + if (uid_ace->unix_ug.uid == current_user.ut.uid) { 28 + size_t i; 29 30 + if (group_ace->unix_ug.gid == current_user.ut.gid) { 31 + return True; 32 + } 33 + 34 + for (i=0; i < current_user.ut.ngroups; i++) { 35 + if (group_ace->unix_ug.gid == current_user.ut.groups[i]) { 36 + return True; 37 + } 38 + } 39 + } 40 41 /* u_name talloc'ed off tos. */ 42 u_name = uidtoname(uid_ace->unix_ug.uid); 43 if (!u_name) { 15 44 return False; 16 45 } 17 + #ifndef __OS2__ 18 + /* Samba always runs as root on OS/2 */ 19 if (current_user.ut.uid == 0 || conn->admin_user) { 20 /* I'm sorry sir, I didn't know you were root... */ 21 return True; 22 } 23 + #endif 46 + 47 + /* notice that this is not reliable for users exported by winbindd! */ 48 return user_in_group_sid(u_name, &group_ace->trustee); 49 } 24 50 25 /* Check primary owner write access. */26 if (current_user.ut.uid == sbuf.st_uid) {
Note:
See TracChangeset
for help on using the changeset viewer.