-
-#ifdef FORCE_USERID
- if (getuid() != client_uid)
- error("error [must be invoked by %s]", CLIENT_LOGIN);
-
- if (geteuid() != 0)
- error("error [must be setuid root]");
-#endif /* FORCE_USERID */
-
-#if !defined (DONT_SUID_ROOT)
- setuid(0);
+ dbprintf(_("version %s\n"), version());
+ dbprintf(_("config: %s\n"), argv[1]);
+ if (strcmp(argv[1], "NOCONFIG") != 0)
+ dbrename(argv[1], DBG_SUBDIR_CLIENT);
+
+#ifdef WANT_SETUID_CLIENT
+ check_running_as(RUNNING_AS_CLIENT_LOGIN | RUNNING_AS_UID_ONLY);
+ if (!become_root()) {
+ error(_("error [%s could not become root (is the setuid bit set?)]\n"), get_pname());
+ /*NOTREACHED*/
+ }
+#else
+ check_running_as(RUNNING_AS_CLIENT_LOGIN);