1
0
mirror of https://github.com/tiyn/slock.git synced 2025-10-16 04:41:22 +02:00

1 Commits

Author SHA1 Message Date
1dc51b3018 cleanup 2023-10-29 03:08:13 +01:00
2 changed files with 15 additions and 9 deletions

View File

@@ -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 = {
/* Password command */
"shutdown", "sudo shutdown -h now"
};
/* list of secret passwords and their commands */
static const struct secretpass scom[1] = {
/* Password command */
{"shutdown", "sudo shutdown -h now"},
};
/* length of entries in scom */
static const int entrylen = 1;

View File

@@ -161,8 +161,10 @@ 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)))