version 1.5, 1999/11/24 19:53:54 |
version 1.6, 2000/04/14 10:30:34 |
|
|
* Temporarily changes to the given uid. If the effective user |
* Temporarily changes to the given uid. If the effective user |
* id is not root, this does nothing. This call cannot be nested. |
* 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) |
{ |
{ |
#ifdef SAVED_IDS_WORK_WITH_SETEUID |
#ifdef SAVED_IDS_WORK_WITH_SETEUID |
|
|
/* |
/* |
* Restores to the original uid. |
* Restores to the original uid. |
*/ |
*/ |
void |
void |
restore_uid() |
restore_uid() |
{ |
{ |
#ifdef SAVED_IDS_WORK_WITH_SETEUID |
#ifdef SAVED_IDS_WORK_WITH_SETEUID |
|
|
* Permanently sets all uids to the given uid. This cannot be |
* Permanently sets all uids to the given uid. This cannot be |
* called while temporarily_use_uid is effective. |
* called while temporarily_use_uid is effective. |
*/ |
*/ |
void |
void |
permanently_set_uid(uid_t uid) |
permanently_set_uid(uid_t uid) |
{ |
{ |
if (setuid(uid) < 0) |
if (setuid(uid) < 0) |