summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-11-13 12:34:35 -0800
committerAndrew Bartlett <abartlet@samba.org>2012-11-13 22:48:19 +0100
commita4434297f19a3520d0f2ac242d4e99576d927ecc (patch)
tree5f422f8bb101bdb02658d415caf76b5c8a15faea
parentdc05ab8e19a26265ace720528f7e9341aea62ee2 (diff)
downloadsamba-a4434297f19a3520d0f2ac242d4e99576d927ecc.tar.gz
samba-a4434297f19a3520d0f2ac242d4e99576d927ecc.tar.bz2
samba-a4434297f19a3520d0f2ac242d4e99576d927ecc.zip
smbd: Correctly set fsp->is_directory before dealing with ACLs
Change set_nt_acl_no_snum() to correctly set up the fsp. This does a stat on a real fsp in set_nt_acl_no_snum. Reviewed by: Jeremy Allison <jra@samba.org>
-rw-r--r--source3/smbd/pysmbd.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c
index 6a6a8120f3..436e881b10 100644
--- a/source3/smbd/pysmbd.c
+++ b/source3/smbd/pysmbd.c
@@ -89,7 +89,7 @@ static NTSTATUS set_nt_acl_no_snum(const char *fname,
NTSTATUS status = NT_STATUS_OK;
files_struct *fsp;
struct smb_filename *smb_fname = NULL;
- int flags;
+ int flags, ret;
mode_t saved_umask;
if (!posix_locking_init(false)) {
@@ -160,6 +160,29 @@ static NTSTATUS set_nt_acl_no_snum(const char *fname,
return NT_STATUS_UNSUCCESSFUL;
}
+ ret = SMB_VFS_FSTAT(fsp, &smb_fname->st);
+ if (ret == -1) {
+ /* If we have an fd, this stat should succeed. */
+ DEBUG(0,("Error doing fstat on open file %s "
+ "(%s)\n",
+ smb_fname_str_dbg(smb_fname),
+ strerror(errno) ));
+ TALLOC_FREE(frame);
+ umask(saved_umask);
+ return map_nt_error_from_unix(errno);
+ }
+
+ fsp->file_id = vfs_file_id_from_sbuf(conn, &smb_fname->st);
+ fsp->vuid = UID_FIELD_INVALID;
+ fsp->file_pid = 0;
+ fsp->can_lock = True;
+ fsp->can_read = True;
+ fsp->can_write = True;
+ fsp->print_file = NULL;
+ fsp->modified = False;
+ fsp->sent_oplock_break = NO_BREAK_SENT;
+ fsp->is_directory = S_ISDIR(smb_fname->st.st_ex_mode);
+
status = SMB_VFS_FSET_NT_ACL( fsp, security_info_sent, sd);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("set_nt_acl_no_snum: fset_nt_acl returned %s.\n", nt_errstr(status)));