The branch, v3-2-test has been updated via d04d93f783533612e20326b7b6ea5958eb5fcdc6 (commit) from 7e38054a94d3feacda9c249549d2721a4ee0b261 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log ----------------------------------------------------------------- commit d04d93f783533612e20326b7b6ea5958eb5fcdc6 Author: Jeremy Allison <j...@samba.org> Date: Thu Jan 22 16:10:36 2009 -0800 Fix logic error in try_chown - we shouldn't arbitrarily chown to ourselves unless that was passed in. Jeremy. ----------------------------------------------------------------------- Summary of changes: source/smbd/posix_acls.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) Changeset truncated at 500 lines: diff --git a/source/smbd/posix_acls.c b/source/smbd/posix_acls.c index 0598384..97c3f82 100644 --- a/source/smbd/posix_acls.c +++ b/source/smbd/posix_acls.c @@ -3197,6 +3197,15 @@ int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid) return -1; } + /* only allow chown to the current user. This is more secure, + and also copes with the case where the SID in a take ownership ACL is + a local SID on the users workstation + */ + if (uid != current_user.ut.uid) { + errno = EPERM; + return -1; + } + if (SMB_VFS_STAT(conn,fname,&st)) { return -1; } @@ -3205,12 +3214,6 @@ int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid) return -1; } - /* only allow chown to the current user. This is more secure, - and also copes with the case where the SID in a take ownership ACL is - a local SID on the users workstation - */ - uid = current_user.ut.uid; - become_root(); /* Keep the current file gid the same. */ ret = SMB_VFS_FCHOWN(fsp, uid, (gid_t)-1); -- Samba Shared Repository