The branch, master has been updated
via cf86adc Fix the UNIX extensions CHOWN calls to use FCHOWN if
available, else LCHOWN.
via ce77655 Allow UNIX extensions client to act on open fsp instead of
pathname if available.
via f124d6f Fix the erroneous masking of chmod requests via the UNIX
extensions.
from 9423d5a Fix bug #10063 - source3/lib/util.c:1493 leaking memory w/
pam_winbind.so / winbind
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit cf86adc4419f2636a0b24824ab04ebfcd5bb074d
Author: Jeremy Allison <[email protected]>
Date: Wed Aug 21 12:20:48 2013 -0700
Fix the UNIX extensions CHOWN calls to use FCHOWN if available, else LCHOWN.
UNIX calls never deref links.
Signed-off-by: Jeremy Allison <[email protected]>
Autobuild-User(master): Jeremy Allison <[email protected]>
Autobuild-Date(master): Sun Aug 25 01:02:40 CEST 2013 on sn-devel-104
commit ce776551abb07f18cf302ee7c0c437ee27952099
Author: Jeremy Allison <[email protected]>
Date: Wed Aug 21 12:10:05 2013 -0700
Allow UNIX extensions client to act on open fsp instead of pathname if
available.
Eliminates possible race condition on pathname op.
Signed-off-by: Jeremy Allison <[email protected]>
commit f124d6fbcd0a03bbd95d69477c144f475546de66
Author: Jeremy Allison <[email protected]>
Date: Wed Aug 21 12:03:25 2013 -0700
Fix the erroneous masking of chmod requests via the UNIX extensions.
Signed-off-by: Jeremy Allison <[email protected]>
-----------------------------------------------------------------------
Summary of changes:
source3/smbd/trans2.c | 38 ++++++++++++++++++++++++--------------
1 files changed, 24 insertions(+), 14 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index e7c0da1..04947d3 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1392,20 +1392,15 @@ static NTSTATUS unix_perms_from_wire( connection_struct
*conn,
ret |= ((perms & UNIX_SET_UID ) ? S_ISUID : 0);
#endif
- switch (ptype) {
- case PERM_NEW_FILE:
- case PERM_EXISTING_FILE:
+ if (ptype == PERM_NEW_FILE) {
/* Apply mode mask */
ret &= lp_create_mask(SNUM(conn));
/* Add in force bits */
ret |= lp_force_create_mode(SNUM(conn));
- break;
- case PERM_NEW_DIR:
- case PERM_EXISTING_DIR:
+ } else if (ptype == PERM_NEW_DIR) {
ret &= lp_dir_mask(SNUM(conn));
/* Add in force bits */
ret |= lp_force_dir_mode(SNUM(conn));
- break;
}
*ret_perms = ret;
@@ -7124,11 +7119,18 @@ static NTSTATUS
smb_set_file_unix_basic(connection_struct *conn,
*/
if (raw_unixmode != SMB_MODE_NO_CHANGE) {
+ int ret;
+
DEBUG(10,("smb_set_file_unix_basic: SMB_SET_FILE_UNIX_BASIC "
"setting mode 0%o for file %s\n",
(unsigned int)unixmode,
smb_fname_str_dbg(smb_fname)));
- if (SMB_VFS_CHMOD(conn, smb_fname->base_name, unixmode) != 0) {
+ if (fsp && fsp->fh->fd != -1) {
+ ret = SMB_VFS_FCHMOD(fsp, unixmode);
+ } else {
+ ret = SMB_VFS_CHMOD(conn, smb_fname->base_name,
unixmode);
+ }
+ if (ret != 0) {
return map_nt_error_from_unix(errno);
}
}
@@ -7146,12 +7148,12 @@ static NTSTATUS
smb_set_file_unix_basic(connection_struct *conn,
(unsigned int)set_owner,
smb_fname_str_dbg(smb_fname)));
- if (S_ISLNK(sbuf.st_ex_mode)) {
+ if (fsp && fsp->fh->fd != -1) {
+ ret = SMB_VFS_FCHOWN(fsp, set_owner, (gid_t)-1);
+ } else {
+ /* UNIX calls always operate on symlinks. */
ret = SMB_VFS_LCHOWN(conn, smb_fname->base_name,
set_owner, (gid_t)-1);
- } else {
- ret = SMB_VFS_CHOWN(conn, smb_fname->base_name,
- set_owner, (gid_t)-1);
}
if (ret != 0) {
@@ -7169,12 +7171,20 @@ static NTSTATUS
smb_set_file_unix_basic(connection_struct *conn,
if ((set_grp != (uid_t)SMB_GID_NO_CHANGE) &&
(sbuf.st_ex_gid != set_grp)) {
+ int ret;
+
DEBUG(10,("smb_set_file_unix_basic: SMB_SET_FILE_UNIX_BASIC "
"changing group %u for file %s\n",
(unsigned int)set_owner,
smb_fname_str_dbg(smb_fname)));
- if (SMB_VFS_CHOWN(conn, smb_fname->base_name, (uid_t)-1,
- set_grp) != 0) {
+ if (fsp && fsp->fh->fd != -1) {
+ ret = SMB_VFS_FCHOWN(fsp, set_owner, (gid_t)-1);
+ } else {
+ /* UNIX calls always operate on symlinks. */
+ ret = SMB_VFS_LCHOWN(conn, smb_fname->base_name,
(uid_t)-1,
+ set_grp);
+ }
+ if (ret != 0) {
status = map_nt_error_from_unix(errno);
if (delete_on_fail) {
SMB_VFS_UNLINK(conn, smb_fname);
--
Samba Shared Repository