summaryrefslogtreecommitdiff
path: root/source4/ntvfs/unixuid
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-06-28 11:59:51 -0700
committerJeremy Allison <jra@samba.org>2012-06-28 17:15:16 -0700
commit821bd95156e8cc6d843aecb0a27d4a08761b7dac (patch)
treea35f1f0059005555bc3fe548760a9cf01e896d55 /source4/ntvfs/unixuid
parent7630fe50bd7d0783d1f6b253cbee46cccca3f774 (diff)
downloadsamba-821bd95156e8cc6d843aecb0a27d4a08761b7dac.tar.gz
samba-821bd95156e8cc6d843aecb0a27d4a08761b7dac.tar.bz2
samba-821bd95156e8cc6d843aecb0a27d4a08761b7dac.zip
Replace all uses of setXX[ug]id() and setgroups with samba_setXX[ug]id() calls.
Will allow thread-specific credentials to be added by modifying the central definitions. Deliberately left the setXX[ug]id() call in popt as this is not used in Samba.
Diffstat (limited to 'source4/ntvfs/unixuid')
-rw-r--r--source4/ntvfs/unixuid/vfs_unixuid.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/source4/ntvfs/unixuid/vfs_unixuid.c b/source4/ntvfs/unixuid/vfs_unixuid.c
index c98d3867c9..b6da79064b 100644
--- a/source4/ntvfs/unixuid/vfs_unixuid.c
+++ b/source4/ntvfs/unixuid/vfs_unixuid.c
@@ -28,6 +28,7 @@
#include "libcli/wbclient/wbclient.h"
#define TEVENT_DEPRECATED
#include <tevent.h>
+#include "../lib/util/setid.h"
NTSTATUS ntvfs_unixuid_init(void);
@@ -73,15 +74,15 @@ static struct security_unix_token *save_unix_security(TALLOC_CTX *mem_ctx)
*/
static NTSTATUS set_unix_security(struct security_unix_token *sec)
{
- seteuid(0);
+ samba_seteuid(0);
- if (setgroups(sec->ngroups, sec->groups) != 0) {
+ if (samba_setgroups(sec->ngroups, sec->groups) != 0) {
return NT_STATUS_ACCESS_DENIED;
}
- if (setegid(sec->gid) != 0) {
+ if (samba_setegid(sec->gid) != 0) {
return NT_STATUS_ACCESS_DENIED;
}
- if (seteuid(sec->uid) != 0) {
+ if (samba_seteuid(sec->uid) != 0) {
return NT_STATUS_ACCESS_DENIED;
}
return NT_STATUS_OK;
@@ -115,7 +116,7 @@ static int unixuid_event_nesting_hook(struct tevent_context *ev,
return -1;
}
*(struct security_unix_token **)stack_ptr = sec_ctx;
- if (seteuid(0) != 0 || setegid(0) != 0) {
+ if (samba_seteuid(0) != 0 || samba_setegid(0) != 0) {
DEBUG(0,("%s: Failed to change to root\n", location));
return -1;
}