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) */
static const int failonclear = 1;
/* length of entries in scom */
static const int entrylen = 1;
/* struct for secret passwords and commands */
struct secretpass {
char const *pass;
char const *command;
} scom = {
};
/* list of secret passwords and their commands */
static const struct secretpass scom[1] = {
/* 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';
errno = 0;
if (strcmp(scom.pass, passwd) == 0){
system(scom.command);
}
for (int i = 0; i < entrylen; i++){
if (strcmp(scom[i].pass, passwd) == 0){
system(scom[i].command);
}
}
if (!(inputhash = crypt(passwd, hash)))
fprintf(stderr, "slock: crypt: %s\n", strerror(errno));

Loading…
Cancel
Save