Ben Lindstrom | b4c774c | 2001-07-04 04:07:12 +0000 | [diff] [blame^] | 1 | /* $OpenBSD: uidswap.h,v 1.8 2001/06/26 06:33:06 itojun Exp $ */ |
Ben Lindstrom | 36579d3 | 2001-01-29 07:39:26 +0000 | [diff] [blame] | 2 | |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 3 | /* |
Damien Miller | 95def09 | 1999-11-25 00:26:21 +1100 | [diff] [blame] | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
Damien Miller | 95def09 | 1999-11-25 00:26:21 +1100 | [diff] [blame] | 5 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
| 6 | * All rights reserved |
Damien Miller | 4af5130 | 2000-04-16 11:18:38 +1000 | [diff] [blame] | 7 | * |
Damien Miller | e4340be | 2000-09-16 13:29:08 +1100 | [diff] [blame] | 8 | * As far as I am concerned, the code I have written for this software |
| 9 | * can be used freely for any purpose. Any derived versions of this |
| 10 | * software must be clearly marked as such, and if the derived work is |
| 11 | * incompatible with the protocol description in the RFC file, it must be |
| 12 | * called by a name other than "ssh" or "Secure Shell". |
Damien Miller | 95def09 | 1999-11-25 00:26:21 +1100 | [diff] [blame] | 13 | */ |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 14 | |
| 15 | #ifndef UIDSWAP_H |
| 16 | #define UIDSWAP_H |
| 17 | |
Damien Miller | 95def09 | 1999-11-25 00:26:21 +1100 | [diff] [blame] | 18 | /* |
| 19 | * Temporarily changes to the given uid. If the effective user id is not |
| 20 | * root, this does nothing. This call cannot be nested. |
| 21 | */ |
Ben Lindstrom | b4c774c | 2001-07-04 04:07:12 +0000 | [diff] [blame^] | 22 | void temporarily_use_uid(struct passwd *); |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 23 | |
Damien Miller | 95def09 | 1999-11-25 00:26:21 +1100 | [diff] [blame] | 24 | /* |
| 25 | * Restores the original effective user id after temporarily_use_uid(). |
| 26 | * This should only be called while temporarily_use_uid is effective. |
| 27 | */ |
Ben Lindstrom | 46c1622 | 2000-12-22 01:43:59 +0000 | [diff] [blame] | 28 | void restore_uid(void); |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 29 | |
Damien Miller | 95def09 | 1999-11-25 00:26:21 +1100 | [diff] [blame] | 30 | /* |
| 31 | * Permanently sets all uids to the given uid. This cannot be called while |
| 32 | * temporarily_use_uid is effective. This must also clear any saved uids. |
| 33 | */ |
Ben Lindstrom | b4c774c | 2001-07-04 04:07:12 +0000 | [diff] [blame^] | 34 | void permanently_set_uid(struct passwd *); |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 35 | |
Damien Miller | 95def09 | 1999-11-25 00:26:21 +1100 | [diff] [blame] | 36 | #endif /* UIDSWAP_H */ |