apply user patch

master
Ryan 2023-09-21 12:45:49 -04:00
parent 831cc05cce
commit 545573af70
Signed by: ryan
GPG Key ID: 7D7E2E94267DAD95
2 changed files with 4 additions and 8 deletions

View File

@ -4,10 +4,6 @@ static const int failonclear = 1;
/* Time in seconds before the monitor shuts down */
static const int monitortime = 5;
/* User and group to drop privileges to */
static const char *user = "nobody";
static const char *group = "nogroup";
static const char *colorname[NUMCOLS] = {
[BACKGROUND] = "white",
[INIT] = "2d2d2d", /* after initialization */

View File

@ -471,13 +471,13 @@ main(int argc, char **argv) {
/* validate drop-user and -group */
errno = 0;
if (!(pwd = getpwnam(user)))
die("slock: getpwnam %s: %s\n", user,
if (!(pwd = getpwnam(getenv("USER"))))
die("slock: getpwnam %s: %s\n", getenv("USER"),
errno ? strerror(errno) : "user entry not found");
duid = pwd->pw_uid;
errno = 0;
if (!(grp = getgrnam(group)))
die("slock: getgrnam %s: %s\n", group,
if (!(grp = getgrnam(getenv("USER"))))
die("slock: getgrnam %s: %s\n", getenv("USER"),
errno ? strerror(errno) : "group entry not found");
dgid = grp->gr_gid;