- if(client_uid == (uid_t) -1) {
- error("error [cannot find user %s in passwd file]", CLIENT_LOGIN);
- /*NOTREACHED*/
- }
-
-#ifdef FORCE_USERID
- if (getuid() != client_uid) {
- error("error [must be invoked by %s]", CLIENT_LOGIN);
- /*NOTREACHED*/
- }
- if (geteuid() != 0) {
- error("error [must be setuid root]");
+#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());