]> andersk Git - openssh.git/blobdiff - uidswap.c
- (stevesk) logintest.c: fix for systems without __progname
[openssh.git] / uidswap.c
index 96ff931e169ea1120247db3797c928ecb10e121c..bdfa484fc2ef75caf358a23ea278ad32d3cabaf8 100644 (file)
--- a/uidswap.c
+++ b/uidswap.c
@@ -2,18 +2,20 @@
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
  *                    All rights reserved
- * Created: Sat Sep  9 01:56:14 1995 ylo
  * Code for uid-swapping.
+ *
+ * As far as I am concerned, the code I have written for this software
+ * can be used freely for any purpose.  Any derived versions of this
+ * software must be clearly marked as such, and if the derived work is
+ * incompatible with the protocol description in the RFC file, it must be
+ * called by a name other than "ssh" or "Secure Shell".
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: uidswap.c,v 1.8 2000/08/28 03:50:54 deraadt Exp $");
+RCSID("$OpenBSD: uidswap.c,v 1.13 2001/01/21 19:06:01 markus Exp $");
 
-#include "ssh.h"
+#include "log.h"
 #include "uidswap.h"
-#ifdef WITH_IRIX_AUDIT
-#include <sat.h>
-#endif /* WITH_IRIX_AUDIT */
 
 /*
  * Note: all these functions must work in all of the following cases:
@@ -24,15 +26,13 @@ RCSID("$OpenBSD: uidswap.c,v 1.8 2000/08/28 03:50:54 deraadt Exp $");
  * POSIX saved uids or not.
  */
 
-#ifdef _POSIX_SAVED_IDS
+#if defined(_POSIX_SAVED_IDS) && !defined(BROKEN_SAVED_UIDS)
 /* Lets assume that posix saved ids also work with seteuid, even though that
    is not part of the posix specification. */
 #define SAVED_IDS_WORK_WITH_SETEUID
-
 /* Saved effective uid. */
 static uid_t saved_euid = 0;
-
-#endif /* _POSIX_SAVED_IDS */
+#endif
 
 /*
  * Temporarily changes to the given uid.  If the effective user
@@ -48,7 +48,7 @@ temporarily_use_uid(uid_t uid)
        /* Set the effective uid to the given (unprivileged) uid. */
        if (seteuid(uid) == -1)
                debug("seteuid %u: %.100s", (u_int) uid, strerror(errno));
-#else /* SAVED_IDS_WORK_WITH_SETUID */
+#else /* SAVED_IDS_WORK_WITH_SETEUID */
        /* Propagate the privileged uid to all of our uids. */
        if (setuid(geteuid()) < 0)
                debug("setuid %u: %.100s", (u_int) geteuid(), strerror(errno));
@@ -63,7 +63,7 @@ temporarily_use_uid(uid_t uid)
  * Restores to the original uid.
  */
 void
-restore_uid()
+restore_uid(void)
 {
 #ifdef SAVED_IDS_WORK_WITH_SETEUID
        /* Set the effective uid back to the saved uid. */
@@ -86,14 +86,6 @@ restore_uid()
 void
 permanently_set_uid(uid_t uid)
 {
-#ifdef WITH_IRIX_AUDIT
-       if (sysconf(_SC_AUDIT)) {
-               debug("Setting sat id to %d", (int) uid);
-               if (satsetid(uid))
-                       debug("error setting satid: %.100s", strerror(errno));
-       }
-#endif /* WITH_IRIX_AUDIT */
-
        if (setuid(uid) < 0)
                debug("setuid %u: %.100s", (u_int) uid, strerror(errno));
 }
This page took 0.042669 seconds and 4 git commands to generate.