about summary refs log tree commit diff
path: root/src/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-12-02T14·34+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-12-02T14·34+0000
commit9c9cdb06d095ea91e10be8dae3a85f06a99c51bf (patch)
tree0fc5fdc4fdc0d1493dca1681147bab6a8f5e3f86 /src/libutil
parent626f8ee42f0b984ebc1cbf0b39938bcb3edf3bd7 (diff)
* Remove SwitchToOriginalUser, we're not going to need it anymore.
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/util.cc31
-rw-r--r--src/libutil/util.hh6
2 files changed, 0 insertions, 37 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 9727a3173f1a..375e0e1df892 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -909,37 +909,6 @@ static gid_t savedGid, nixGid;
 #endif
 
 
-SwitchToOriginalUser::SwitchToOriginalUser()
-{
-#if HAVE_SETRESUID
-    /* Temporarily switch the effective uid/gid back to the saved
-       uid/gid (which is the uid/gid of the user that executed the Nix
-       program; it's *not* the real uid/gid, since we changed that to
-       the Nix user in switchToNixUser()). */
-    if (haveSwitched) {
-        if (setuid(savedUid) == -1)
-            throw SysError(format("temporarily restoring uid to `%1%'") % savedUid); 
-        if (setgid(savedGid) == -1)
-            throw SysError(format("temporarily restoring gid to `%1%'") % savedGid); 
-    }
-#endif
-}
-
-
-SwitchToOriginalUser::~SwitchToOriginalUser()
-{
-#if HAVE_SETRESUID
-    /* Switch the effective uid/gid back to the Nix user. */
-    if (haveSwitched) {
-        if (setuid(nixUid) == -1)
-            throw SysError(format("restoring uid to `%1%'") % nixUid); 
-        if (setgid(nixGid) == -1)
-            throw SysError(format("restoring gid to `%1%'") % nixGid); 
-    }
-#endif
-}
-
-
 void switchToNixUser()
 {
 #if 0
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index 7f3d41e76ef3..d1fb5b6e24f8 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -250,12 +250,6 @@ bool string2Int(const string & s, int & n);
 
 
 /* Setuid support. */
-struct SwitchToOriginalUser
-{
-    SwitchToOriginalUser();
-    ~SwitchToOriginalUser();
-};
-
 void switchToNixUser();