diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-03-05 17:52:35 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-03-05 23:07:31 +1100 |
commit | ace6d75ae6f953b76fa9709857af4744020cd6fb (patch) | |
tree | f125e6a22e60284437b55eb915ab62ccbe979a7c /source4 | |
parent | 034bcaf14d1bc651c8b51b489aebcfa392158f2c (diff) | |
download | samba-ace6d75ae6f953b76fa9709857af4744020cd6fb.tar.gz samba-ace6d75ae6f953b76fa9709857af4744020cd6fb.tar.bz2 samba-ace6d75ae6f953b76fa9709857af4744020cd6fb.zip |
s4-pvfs: use pvfs_sys_*() functions to wrap posix calls
This allows for root override, which fixes many problems with
mismatches between NT ACL permissions and unix permissions.
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/ntvfs/posix/pvfs_mkdir.c | 12 | ||||
-rw-r--r-- | source4/ntvfs/posix/pvfs_open.c | 14 | ||||
-rw-r--r-- | source4/ntvfs/posix/pvfs_rename.c | 2 | ||||
-rw-r--r-- | source4/ntvfs/posix/pvfs_unlink.c | 2 | ||||
-rw-r--r-- | source4/ntvfs/posix/pvfs_util.c | 10 |
5 files changed, 20 insertions, 20 deletions
diff --git a/source4/ntvfs/posix/pvfs_mkdir.c b/source4/ntvfs/posix/pvfs_mkdir.c index 6ec9e60955..10de1d6d5c 100644 --- a/source4/ntvfs/posix/pvfs_mkdir.c +++ b/source4/ntvfs/posix/pvfs_mkdir.c @@ -51,7 +51,7 @@ static NTSTATUS pvfs_t2mkdir(struct pvfs_state *pvfs, mode = pvfs_fileperms(pvfs, FILE_ATTRIBUTE_DIRECTORY); - if (mkdir(name->full_name, mode) == -1) { + if (pvfs_sys_mkdir(pvfs, name->full_name, mode) == -1) { return pvfs_map_errno(pvfs, errno); } @@ -69,7 +69,7 @@ static NTSTATUS pvfs_t2mkdir(struct pvfs_state *pvfs, /* setup an inherited acl from the parent */ status = pvfs_acl_inherit(pvfs, req, name, -1); if (!NT_STATUS_IS_OK(status)) { - rmdir(name->full_name); + pvfs_sys_rmdir(pvfs, name->full_name); return status; } @@ -78,7 +78,7 @@ static NTSTATUS pvfs_t2mkdir(struct pvfs_state *pvfs, md->t2mkdir.in.num_eas, md->t2mkdir.in.eas); if (!NT_STATUS_IS_OK(status)) { - rmdir(name->full_name); + pvfs_sys_rmdir(pvfs, name->full_name); return status; } @@ -127,7 +127,7 @@ NTSTATUS pvfs_mkdir(struct ntvfs_module_context *ntvfs, mode = pvfs_fileperms(pvfs, FILE_ATTRIBUTE_DIRECTORY); - if (mkdir(name->full_name, mode) == -1) { + if (pvfs_sys_mkdir(pvfs, name->full_name, mode) == -1) { return pvfs_map_errno(pvfs, errno); } @@ -136,7 +136,7 @@ NTSTATUS pvfs_mkdir(struct ntvfs_module_context *ntvfs, /* setup an inherited acl from the parent */ status = pvfs_acl_inherit(pvfs, req, name, -1); if (!NT_STATUS_IS_OK(status)) { - rmdir(name->full_name); + pvfs_sys_rmdir(pvfs, name->full_name); return status; } @@ -179,7 +179,7 @@ NTSTATUS pvfs_rmdir(struct ntvfs_module_context *ntvfs, return status; } - if (rmdir(name->full_name) == -1) { + if (pvfs_sys_rmdir(pvfs, name->full_name) == -1) { /* some olders systems don't return ENOTEMPTY to rmdir() */ if (errno == EEXIST) { return NT_STATUS_DIRECTORY_NOT_EMPTY; diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c index d9d0d2178a..f88e21e738 100644 --- a/source4/ntvfs/posix/pvfs_open.c +++ b/source4/ntvfs/posix/pvfs_open.c @@ -73,7 +73,7 @@ static int pvfs_dir_handle_destructor(struct pvfs_file_handle *h) DEBUG(0,("Warning: xattr unlink hook failed for '%s' - %s\n", delete_path, nt_errstr(status))); } - if (rmdir(delete_path) != 0) { + if (pvfs_sys_rmdir(h->pvfs, delete_path) != 0) { DEBUG(0,("pvfs_dir_handle_destructor: failed to rmdir '%s' - %s\n", delete_path, strerror(errno))); } @@ -344,7 +344,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs, uint32_t attrib = io->generic.in.file_attr | FILE_ATTRIBUTE_DIRECTORY; mode_t mode = pvfs_fileperms(pvfs, attrib); - if (mkdir(name->full_name, mode) == -1) { + if (pvfs_sys_mkdir(pvfs, name->full_name, mode) == -1) { return pvfs_map_errno(pvfs,errno); } @@ -432,7 +432,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs, return NT_STATUS_OK; cleanup_delete: - rmdir(name->full_name); + pvfs_sys_rmdir(pvfs, name->full_name); return status; } @@ -514,7 +514,7 @@ static int pvfs_handle_destructor(struct pvfs_file_handle *h) DEBUG(0,("Warning: xattr unlink hook failed for '%s' - %s\n", delete_path, nt_errstr(status))); } - if (unlink(delete_path) != 0) { + if (pvfs_sys_unlink(h->pvfs, delete_path) != 0) { DEBUG(0,("pvfs_close: failed to delete '%s' - %s\n", delete_path, strerror(errno))); } else { @@ -677,7 +677,7 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs, mode = pvfs_fileperms(pvfs, attrib); /* create the file */ - fd = open(name->full_name, flags | O_CREAT | O_EXCL| O_NONBLOCK, mode); + fd = pvfs_sys_open(pvfs, name->full_name, flags | O_CREAT | O_EXCL| O_NONBLOCK, mode); if (fd == -1) { return pvfs_map_errno(pvfs, errno); } @@ -856,7 +856,7 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs, cleanup_delete: close(fd); - unlink(name->full_name); + pvfs_sys_unlink(pvfs, name->full_name); return status; } @@ -1549,7 +1549,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs, } /* do the actual open */ - fd = open(f->handle->name->full_name, flags | O_NONBLOCK); + fd = pvfs_sys_open(pvfs, f->handle->name->full_name, flags | O_NONBLOCK, 0); if (fd == -1) { status = pvfs_map_errno(f->pvfs, errno); diff --git a/source4/ntvfs/posix/pvfs_rename.c b/source4/ntvfs/posix/pvfs_rename.c index 66c1427a11..e4448d3442 100644 --- a/source4/ntvfs/posix/pvfs_rename.c +++ b/source4/ntvfs/posix/pvfs_rename.c @@ -37,7 +37,7 @@ NTSTATUS pvfs_do_rename(struct pvfs_state *pvfs, uint32_t mask; NTSTATUS status; - if (rename(name1->full_name, name2) == -1) { + if (pvfs_sys_rename(pvfs, name1->full_name, name2) == -1) { return pvfs_map_errno(pvfs, errno); } diff --git a/source4/ntvfs/posix/pvfs_unlink.c b/source4/ntvfs/posix/pvfs_unlink.c index 67e7d76b47..be2ba53148 100644 --- a/source4/ntvfs/posix/pvfs_unlink.c +++ b/source4/ntvfs/posix/pvfs_unlink.c @@ -123,7 +123,7 @@ static NTSTATUS pvfs_unlink_file(struct pvfs_state *pvfs, } /* finally try the actual unlink */ - if (unlink(name->full_name) == -1) { + if (pvfs_sys_unlink(pvfs, name->full_name) == -1) { status = pvfs_map_errno(pvfs, errno); } diff --git a/source4/ntvfs/posix/pvfs_util.c b/source4/ntvfs/posix/pvfs_util.c index b1b0a64789..63651c203a 100644 --- a/source4/ntvfs/posix/pvfs_util.c +++ b/source4/ntvfs/posix/pvfs_util.c @@ -102,13 +102,13 @@ NTSTATUS pvfs_copy_file(struct pvfs_state *pvfs, return NT_STATUS_NO_MEMORY; } - fd1 = open(name1->full_name, O_RDONLY); + fd1 = pvfs_sys_open(pvfs, name1->full_name, O_RDONLY, 0); if (fd1 == -1) { talloc_free(buf); return pvfs_map_errno(pvfs, errno); } - fd2 = open(name2->full_name, O_CREAT|O_EXCL|O_WRONLY, 0); + fd2 = pvfs_sys_open(pvfs, name2->full_name, O_CREAT|O_EXCL|O_WRONLY, 0); if (fd2 == -1) { close(fd1); talloc_free(buf); @@ -133,7 +133,7 @@ NTSTATUS pvfs_copy_file(struct pvfs_state *pvfs, close(fd1); close(fd2); talloc_free(buf); - unlink(name2->full_name); + pvfs_sys_unlink(pvfs, name2->full_name); if (ret2 == -1) { return pvfs_map_errno(pvfs, errno); } @@ -148,7 +148,7 @@ NTSTATUS pvfs_copy_file(struct pvfs_state *pvfs, if (fchmod(fd2, mode) == -1) { status = pvfs_map_errno(pvfs, errno); close(fd2); - unlink(name2->full_name); + pvfs_sys_unlink(pvfs, name2->full_name); return status; } @@ -158,7 +158,7 @@ NTSTATUS pvfs_copy_file(struct pvfs_state *pvfs, status = pvfs_dosattrib_save(pvfs, name2, fd2); if (!NT_STATUS_IS_OK(status)) { close(fd2); - unlink(name2->full_name); + pvfs_sys_unlink(pvfs, name2->full_name); return status; } |