mirror of
https://github.com/tiyn/slock.git
synced 2025-04-01 15:47:47 +02:00
cleanup
This commit is contained in:
parent
f6f743c04d
commit
1dc51b3018
16
config.def.h
16
config.def.h
@ -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;
|
||||
|
8
slock.c
8
slock.c
@ -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…
x
Reference in New Issue
Block a user