[BACK]Return to uidswap.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/uidswap.c between version 1.3 and 1.4

version 1.3, 1999/11/23 22:25:56 version 1.4, 1999/11/24 00:26:04
Line 1 
Line 1 
 /*  /*
    * 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.
    */
   
 uidswap.c  
   
 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.  
   
 */  
   
 #include "includes.h"  #include "includes.h"
 RCSID("$Id$");  RCSID("$Id$");
   
 #include "ssh.h"  #include "ssh.h"
 #include "uidswap.h"  #include "uidswap.h"
   
 /* Note: all these functions must work in all of the following cases:  /*
    * Note: all these functions must work in all of the following cases:
    *    1. euid=0, ruid=0
    *    2. euid=0, ruid!=0
    *    3. euid!=0, ruid!=0
    * Additionally, they must work regardless of whether the system has
    * POSIX saved uids or not.
    */
   
    1. euid=0, ruid=0  
    2. euid=0, ruid!=0  
    3. euid!=0, ruid!=0  
   
    Additionally, they must work regardless of whether the system has  
    POSIX saved uids or not. */  
   
 #ifdef _POSIX_SAVED_IDS  #ifdef _POSIX_SAVED_IDS
 /* Lets assume that posix saved ids also work with seteuid, even though that  /* Lets assume that posix saved ids also work with seteuid, even though that
    is not part of the posix specification. */     is not part of the posix specification. */
Line 37 
Line 30 
 /* Saved effective uid. */  /* Saved effective uid. */
 static uid_t saved_euid = 0;  static uid_t saved_euid = 0;
   
 /* Temporarily changes to the given uid.  If the effective user id is not  /*
    root, this does nothing.  This call cannot be nested. */   * Temporarily changes to the given uid.  If the effective user
    * id is not root, this does nothing.  This call cannot be nested.
    */
 void  void
 temporarily_use_uid(uid_t uid)  temporarily_use_uid(uid_t uid)
 {  {
Line 61 
Line 55 
 #endif /* SAVED_IDS_WORK_WITH_SETEUID */  #endif /* SAVED_IDS_WORK_WITH_SETEUID */
 }  }
   
 /* Restores to the original uid. */  /*
    * Restores to the original uid.
    */
 void  void
 restore_uid()  restore_uid()
 {  {
Line 79 
Line 74 
 #endif /* SAVED_IDS_WORK_WITH_SETEUID */  #endif /* SAVED_IDS_WORK_WITH_SETEUID */
 }  }
   
 /* Permanently sets all uids to the given uid.  This cannot be called while  /*
    temporarily_use_uid is effective. */   * Permanently sets all uids to the given uid.  This cannot be
    * called while temporarily_use_uid is effective.
    */
 void  void
 permanently_set_uid(uid_t uid)  permanently_set_uid(uid_t uid)
 {  {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4