summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>2000-02-29 18:04:51 +0000
committerLuke Leighton <lkcl@samba.org>2000-02-29 18:04:51 +0000
commit9c37b6e754a9192251188803aeb013cff52daec6 (patch)
treef15767ffc7085ba1b1a0c8f0952b33905f831639
parent30e0201a9e61f36c42af51126526eeafb5519ded (diff)
downloadsamba-9c37b6e754a9192251188803aeb013cff52daec6.tar.gz
allow nested become_root() calls. this is a hack.
-rw-r--r--source/lib/set_uid.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/lib/set_uid.c b/source/lib/set_uid.c
index b42e4e08692..48eb5ecdd66 100644
--- a/source/lib/set_uid.c
+++ b/source/lib/set_uid.c
@@ -330,14 +330,15 @@ Set save_dir if you also need to save/restore the CWD
****************************************************************************/
void become_root(BOOL save_dir)
{
- if (become_root_depth) {
- DEBUG(0,("ERROR: become root depth is non zero\n"));
+ if (become_root_depth < 0)
+ {
+ DEBUG(0,("ERROR: become root depth is negative!\n"));
}
if (save_dir)
dos_GetWd(become_root_dir);
current_user_saved = current_user;
- become_root_depth = 1;
+ become_root_depth++;
become_uid(0);
become_gid(0);
@@ -350,7 +351,8 @@ Set save_dir if you also need to save/restore the CWD
****************************************************************************/
void unbecome_root(BOOL restore_dir)
{
- if (become_root_depth != 1) {
+ if (become_root_depth <= 0)
+ {
DEBUG(0,("ERROR: unbecome root depth is %d\n",
become_root_depth));
}
@@ -387,5 +389,5 @@ void unbecome_root(BOOL restore_dir)
current_user = current_user_saved;
- become_root_depth = 0;
+ become_root_depth--;
}