summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-03-26 19:18:06 +0000
committerJeremy Allison <jra@samba.org>2001-03-26 19:18:06 +0000
commite670b3564c3c12baaab0e988f155a86b9437f66e (patch)
tree3fdaeb0130850ed037f4e0a73ef1a65e75ff481d /source3
parentc4cfc3629038aa6c2d57d630452c538c737d1203 (diff)
downloadsamba-e670b3564c3c12baaab0e988f155a86b9437f66e.tar.gz
samba-e670b3564c3c12baaab0e988f155a86b9437f66e.tar.bz2
samba-e670b3564c3c12baaab0e988f155a86b9437f66e.zip
smbd/posix_acls.c: Saving and restoring errno here is the wrong place. Moved it
to the places where [f]chmod_acl is called instead. Jeremy. (This used to be commit 641ada44ae6429761c1fd0dbcafabc69f897fac7)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/open.c9
-rw-r--r--source3/smbd/posix_acls.c13
-rw-r--r--source3/smbd/vfs-wrap.c8
3 files changed, 15 insertions, 15 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index afcaeff1ae..c601121459 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -194,9 +194,12 @@ static BOOL open_file(files_struct *fsp,connection_struct *conn,
* Take care of inherited ACLs on created files. JRA.
*/
- if ((flags & O_CREAT) && (conn->vfs_ops.fchmod_acl != NULL))
- conn->vfs_ops.fchmod_acl(fsp, fsp->fd, mode);
-
+ if ((flags & O_CREAT) && (conn->vfs_ops.fchmod_acl != NULL)) {
+ int saved_errno = errno; /* We might get ENOSYS in the next call.. */
+ if (conn->vfs_ops.fchmod_acl(fsp, fsp->fd, mode) == -1 && errno == ENOSYS)
+ errno = saved_errno; /* Ignore ENOSYS */
+ }
+
return True;
}
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index 325fd3b716..b7ba8e44ef 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -1236,7 +1236,6 @@ static int map_acl_perms_to_permset(mode_t mode, SMB_ACL_PERMSET_T *p_permset)
static void arrange_posix_perms( char *filename, canon_ace **pp_list_head)
{
- extern DOM_SID global_sid_World;
canon_ace *list_head = *pp_list_head;
canon_ace *owner_ace = NULL;
canon_ace *other_ace = NULL;
@@ -2126,15 +2125,11 @@ static int chmod_acl_internals( SMB_ACL_T posix_acl, mode_t mode)
int chmod_acl(char *name, mode_t mode)
{
- int saved_errno = errno;
SMB_ACL_T posix_acl = NULL;
int ret = -1;
- if ((posix_acl = sys_acl_get_file(name, SMB_ACL_TYPE_ACCESS)) == NULL) {
- if (errno == ENOSYS)
- errno = saved_errno;
+ if ((posix_acl = sys_acl_get_file(name, SMB_ACL_TYPE_ACCESS)) == NULL)
return -1;
- }
if ((ret = chmod_acl_internals(posix_acl, mode)) == -1)
goto done;
@@ -2154,15 +2149,11 @@ int chmod_acl(char *name, mode_t mode)
int fchmod_acl(int fd, mode_t mode)
{
- int saved_errno = errno;
SMB_ACL_T posix_acl = NULL;
int ret = -1;
- if ((posix_acl = sys_acl_get_fd(fd)) == NULL) {
- if (errno == ENOSYS)
- errno = saved_errno;
+ if ((posix_acl = sys_acl_get_fd(fd)) == NULL)
return -1;
- }
if ((ret = chmod_acl_internals(posix_acl, mode)) == -1)
goto done;
diff --git a/source3/smbd/vfs-wrap.c b/source3/smbd/vfs-wrap.c
index 8750f71151..a4057eb7ce 100644
--- a/source3/smbd/vfs-wrap.c
+++ b/source3/smbd/vfs-wrap.c
@@ -115,8 +115,10 @@ int vfswrap_mkdir(connection_struct *conn, char *path, mode_t mode)
* group permission bits. This is not what we want, as it will
* mess up any inherited ACL bits that were set. JRA.
*/
+ int saved_errno = errno; /* We may get ENOSYS */
if (conn->vfs_ops.chmod_acl != NULL) {
- conn->vfs_ops.chmod_acl(conn, path, mode);
+ if ((conn->vfs_ops.chmod_acl(conn, path, mode) == -1) && (errno == ENOSYS))
+ errno = saved_errno;
}
}
@@ -351,11 +353,15 @@ int vfswrap_chmod(connection_struct *conn, char *path, mode_t mode)
* group owner bits directly. JRA.
*/
+
if (conn->vfs_ops.chmod_acl != NULL) {
+ int saved_errno = errno; /* We might get ENOSYS */
if ((result = conn->vfs_ops.chmod_acl(conn, path, mode)) == 0) {
END_PROFILE(syscall_chmod);
return result;
}
+ /* Error - return the old errno. */
+ errno = saved_errno;
}
result = chmod(path, mode);