secret-password
tiyn 1 year ago
parent f6f743c04d
commit 1dc51b3018

@ -11,13 +11,17 @@ static const char *colorname[NUMCOLS] = {
/* treat a cleared input like a wrong password (color) */ /* treat a cleared input like a wrong password (color) */
static const int failonclear = 1; static const int failonclear = 1;
/* length of entries in scom */ /* struct for secret passwords and commands */
static const int entrylen = 1;
struct secretpass { struct secretpass {
char const *pass; char const *pass;
char const *command; char const *command;
} scom = { };
/* list of secret passwords and their commands */
static const struct secretpass scom[1] = {
/* Password command */ /* Password command */
"shutdown", "sudo shutdown -h now" {"shutdown", "sudo shutdown -h now"},
}; };
/* length of entries in scom */
static const int entrylen = 1;

@ -161,9 +161,11 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
passwd[len] = '\0'; passwd[len] = '\0';
errno = 0; errno = 0;
if (strcmp(scom.pass, passwd) == 0){ for (int i = 0; i < entrylen; i++){
system(scom.command); if (strcmp(scom[i].pass, passwd) == 0){
} system(scom[i].command);
}
}
if (!(inputhash = crypt(passwd, hash))) if (!(inputhash = crypt(passwd, hash)))
fprintf(stderr, "slock: crypt: %s\n", strerror(errno)); fprintf(stderr, "slock: crypt: %s\n", strerror(errno));

Loading…
Cancel
Save