diff options
author | Steve Dickson <steved@redhat.com> | 2008-02-08 11:54:09 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2008-02-08 11:54:09 -0500 |
commit | 464d2aed4506a217aa53df9cf0e0144bab5bbfd9 (patch) | |
tree | daeae52d7b754cbede88b44b6a27fda46d0d1707 /src/rpcbind.c | |
parent | 37117c6984ea5c640a19e6206dfa4b97710b6f37 (diff) | |
download | rpcbind-464d2aed4506a217aa53df9cf0e0144bab5bbfd9.tar.gz |
Make sure the owner of the warm start files is the
same uid the running process; Not necessarily root.
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'src/rpcbind.c')
-rw-r--r-- | src/rpcbind.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/rpcbind.c b/src/rpcbind.c index 2a900d9..650cd29 100644 --- a/src/rpcbind.c +++ b/src/rpcbind.c @@ -85,6 +85,7 @@ char *rpcbinduser = RPCBIND_USER; #else char *rpcbinduser = NULL; #endif +uid_t rpc_uid; /* who to suid to if -s is given */ #define RUN_AS "daemon" @@ -193,11 +194,7 @@ main(int argc, char *argv[]) (void) signal(SIGHUP, SIG_IGN); (void) signal(SIGUSR1, SIG_IGN); (void) signal(SIGUSR2, SIG_IGN); -#ifdef WARMSTART - if (warmstart) { - read_warmstart(); - } -#endif + if (debugging) { #ifdef RPCBIND_DEBUG printf("rpcbind debugging enabled."); @@ -212,6 +209,7 @@ main(int argc, char *argv[]) err(1, "fork failed"); } + rpc_uid = 0; if (runasdaemon || rpcbinduser) { struct passwd *p; char *id = runasdaemon ? RUN_AS : rpcbinduser; @@ -224,8 +222,15 @@ main(int argc, char *argv[]) syslog(LOG_ERR, "setuid to '%s' failed: %m", id); exit(1); } + rpc_uid = p->pw_uid; } +#ifdef WARMSTART + if (warmstart) { + read_warmstart(); + } +#endif + network_init(); my_svc_run(); |