diff options
author | Neil Brown <neilb@suse.de> | 2007-03-20 10:14:44 +1100 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2007-03-20 10:14:44 +1100 |
commit | 3482b1145c2c9a39f1dcaabc32e36eb234b91447 (patch) | |
tree | 42391657671e06436da3c2b0c9c9b63de3925532 /utils/statd | |
parent | 632127e335095b6053fa93b7b695d688918f36bb (diff) | |
download | nfs-utils-3482b1145c2c9a39f1dcaabc32e36eb234b91447.tar.gz nfs-utils-3482b1145c2c9a39f1dcaabc32e36eb234b91447.tar.xz nfs-utils-3482b1145c2c9a39f1dcaabc32e36eb234b91447.zip |
statd - delay drop-privs until sockets have been setup.
Registering sockets with portmap might require root privs,
so don't drop privs until that has been done.
Diffstat (limited to 'utils/statd')
-rw-r--r-- | utils/statd/statd.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/utils/statd/statd.c b/utils/statd/statd.c index 17e2947..157de85 100644 --- a/utils/statd/statd.c +++ b/utils/statd/statd.c @@ -251,6 +251,7 @@ int main (int argc, char **argv) int arg; int port = 0, out_port = 0; struct rlimit rlim; + int once = 1; int pipefds[2] = { -1, -1}; char status; @@ -474,7 +475,6 @@ int main (int argc, char **argv) waitpid(pid, NULL, 0); } - drop_privs(); for (;;) { pmap_unset (SM_PROG, SM_VERS); @@ -490,6 +490,10 @@ int main (int argc, char **argv) /* this registers both UDP and TCP services */ rpc_init("statd", SM_PROG, SM_VERS, sm_prog_1, port); + if (once) { + once = 0; + drop_privs(); + } /* * Handle incoming requests: SM_NOTIFY socket requests, as * well as callbacks from lockd. |