Server: always drop privileges, even in foreground mode.
authorKp <kp@valhallalegends.com>
Sun, 13 Jul 2008 16:47:07 +0000 (11:47 -0500)
committerKp <kp@valhallalegends.com>
Mon, 1 Sep 2008 19:44:47 +0000 (14:44 -0500)
Foreground mode is often used as a debugging aid for live
configurations, so the server may be started with root privileges to let
it bind to its native port.  Since the server already has the ability to
drop root privileges, use that ability to make foreground mode a little
safer.

apps/silcd/silcd.c

index 19ba9193c4c14235d7a9aa99759f4f8aef0036f6..d367328c6578fdb15942f922e108a2fc7525e4de 100644 (file)
@@ -745,8 +745,8 @@ int main(int argc, char **argv)
       silc_file_writefile(pidfile, buf, strlen(buf));
     }
 
-    silc_server_drop_privs(silcd);
   }
+  silc_server_drop_privs(silcd);
 
   /* Run the server. When this returns the server has been stopped
      and we will exit. */