diff --git a/rdo.c b/rdo.c index f1196a1..00c39e0 100644 --- a/rdo.c +++ b/rdo.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -40,6 +41,10 @@ void runprog(int argc, char** argv) { } int main(int argc, char** argv) { + char username[64]; + char wrong_pw_sleep[64]; + unsigned int sleep_ms; + if (argc < 2) errx(1, "Please specify a program to run"); @@ -54,9 +59,10 @@ int main(int argc, char** argv) { runprog(argc, argv); return 0; } - - char username[64]; + getconf(fp, "username", username, sizeof(username)); + getconf(fp, "wrong_pw_sleep", wrong_pw_sleep, sizeof(wrong_pw_sleep)); + sleep_ms = atoi(wrong_pw_sleep) * 1000; struct passwd* p = getpwnam(username); if (!p) @@ -82,6 +88,7 @@ int main(int argc, char** argv) { return 0; } + usleep(sleep_ms); fprintf(stderr, "Wrong password.\n"); tries++; } diff --git a/rdo_sample.conf b/rdo_sample.conf index 8ba8716..3c00c78 100644 --- a/rdo_sample.conf +++ b/rdo_sample.conf @@ -1 +1,2 @@ username=sw1tchbl4d3 +wrong_pw_sleep=1000