summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-09-17 13:44:29 -0700
committerJeremy Allison <jra@samba.org>2008-09-17 13:44:29 -0700
commit0379d9c151359f0f74cbe7883e73a87b7d96d48d (patch)
treeecbaeb0eb49f5222855f1cddb3931da9f430ef3e
parent21ca0c31b99c8d5a135ddcde731175bb80d6207a (diff)
downloadsamba-0379d9c151359f0f74cbe7883e73a87b7d96d48d.tar.gz
samba-0379d9c151359f0f74cbe7883e73a87b7d96d48d.tar.bz2
samba-0379d9c151359f0f74cbe7883e73a87b7d96d48d.zip
Correctly get+set the NT ACL on a file. Now to make us check it on open..
Jeremy.
-rw-r--r--source3/modules/vfs_acl_xattr.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/source3/modules/vfs_acl_xattr.c b/source3/modules/vfs_acl_xattr.c
index ff0c2cbc89..fd59310755 100644
--- a/source3/modules/vfs_acl_xattr.c
+++ b/source3/modules/vfs_acl_xattr.c
@@ -103,7 +103,7 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
val = tmp;
become_root();
- if (fsp) {
+ if (fsp && fsp->fh->fd != -1) {
sizeret = SMB_VFS_FGETXATTR(fsp, XATTR_NTACL_NAME, val, size);
} else {
sizeret = SMB_VFS_GETXATTR(handle->conn, name,
@@ -263,16 +263,25 @@ static NTSTATUS store_acl_blob(files_struct *fsp,
int ret;
int saved_errno;
+ DEBUG(10,("store_acl_blob: storing blob length %u on file %s\n",
+ (unsigned int)pblob->length, fsp->fsp_name));
+
become_root();
- ret = SMB_VFS_FSETXATTR(fsp, XATTR_NTACL_NAME,
+ if (fsp->fh->fd != -1) {
+ ret = SMB_VFS_FSETXATTR(fsp, XATTR_NTACL_NAME,
pblob->data, pblob->length, 0);
+ } else {
+ ret = SMB_VFS_SETXATTR(fsp->conn, fsp->fsp_name,
+ XATTR_NTACL_NAME,
+ pblob->data, pblob->length, 0);
+ }
if (ret) {
saved_errno = errno;
}
unbecome_root();
if (ret) {
errno = saved_errno;
- DEBUG(5, ("store_acl_blob: fsetxattr failed for file %s "
+ DEBUG(5, ("store_acl_blob: setting attr failed for file %s"
"with error %s\n",
fsp->fsp_name,
strerror(errno) ));