15 #include <sys/types.h>
22 #include "lirc/lirc_log.h"
34 user = getenv(
"SUDO_USER");
39 logperror(LIRC_ERROR,
"Can't run getpwnam() for %s", user);
42 r = set_some_uid(pw->pw_uid);
44 logperror(LOG_WARNING,
"Cannot change UID to %d", pw->pw_uid);
47 setenv(
"HOME", pw->pw_dir, 1);
48 logprintf(LOG_NOTICE,
"Running as user %s", pw->pw_name);
58 if (strcmp(
"root", new_user) == 0)
59 puts(
"Warning: Running as root.");
60 else if (strlen(new_user) == 0)
61 puts(
"Warning: Cannot change uid.");
63 printf(
"Running as regular user %s\n", new_user);
void drop_root_cli(int(*set_some_uid)(uid_t))
const char * drop_sudo_root(int(*set_some_uid)(uid_t))
void logperror(loglevel_t prio, const char *fmt,...)