forked from soccera/rdo
Merge pull request 'Add dependencies and fixed whitespace' (#2) from remoof/rdo:patch into main
Reviewed-on: https://codeberg.org/sw1tchbl4d3/rdo/pulls/2
This commit is contained in:
commit
c5469393ab
2 changed files with 7 additions and 4 deletions
|
@ -30,3 +30,6 @@ sudo make uninstall
|
||||||
```sh
|
```sh
|
||||||
rdo [command]
|
rdo [command]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
- `libbsd`
|
||||||
|
|
8
rdo.c
8
rdo.c
|
@ -38,7 +38,7 @@ void runprog(int argc, char** argv) {
|
||||||
if (setgid(0) == -1)
|
if (setgid(0) == -1)
|
||||||
err(1, "Could not setgid");
|
err(1, "Could not setgid");
|
||||||
|
|
||||||
if (execvp(argv[0], argv) != 0)
|
if (execvp(argv[0], argv) != 0)
|
||||||
perror(argv[0]);
|
perror(argv[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ int main(int argc, char** argv) {
|
||||||
errx(1, "Please specify a program to run");
|
errx(1, "Please specify a program to run");
|
||||||
|
|
||||||
FILE* fp = fopen("/etc/rdo.conf", "r");
|
FILE* fp = fopen("/etc/rdo.conf", "r");
|
||||||
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
err(1, "Could not open /etc/rdo.conf");
|
err(1, "Could not open /etc/rdo.conf");
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ int main(int argc, char** argv) {
|
||||||
runprog(argc, argv);
|
runprog(argc, argv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
getconf(fp, "username", username, sizeof(username));
|
getconf(fp, "username", username, sizeof(username));
|
||||||
getconf(fp, "wrong_pw_sleep", wrong_pw_sleep, sizeof(wrong_pw_sleep));
|
getconf(fp, "wrong_pw_sleep", wrong_pw_sleep, sizeof(wrong_pw_sleep));
|
||||||
sleep_ms = atoi(wrong_pw_sleep) * 1000;
|
sleep_ms = atoi(wrong_pw_sleep) * 1000;
|
||||||
|
@ -89,7 +89,7 @@ int main(int argc, char** argv) {
|
||||||
runprog(argc, argv);
|
runprog(argc, argv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep(sleep_ms);
|
usleep(sleep_ms);
|
||||||
fprintf(stderr, "Wrong password.\n");
|
fprintf(stderr, "Wrong password.\n");
|
||||||
tries++;
|
tries++;
|
||||||
|
|
Loading…
Add table
Reference in a new issue