Merge pull request 'Command line options' (#6) from remoof/rdo:main into main

Reviewed-on: https://codeberg.org/sw1tchbl4d3/rdo/pulls/6
This commit is contained in:
sw1tchbl4d3 2021-07-18 23:07:28 +02:00
commit 10147b324d

9
rdo.c
View file

@ -9,6 +9,8 @@
#include <bsd/readpassphrase.h>
#include "sessions.h"
#define VERSION "1.2"
void getconf(FILE* fp, const char* entry, char* result, size_t len_result) {
char* line = NULL;
size_t len = 0;
@ -49,8 +51,11 @@ int main(int argc, char** argv) {
char username[64], wrong_pw_sleep[64], session_ttl[64], password[128];
unsigned int sleep_ms, tries, ts_ttl;
if (argc < 2)
errx(1, "Please specify a program to run");
if (argc == 1) {
printf("RootDO version: %s\n\n", VERSION);
printf("Usage: %s [command]\n", argv[0]);
return 0;
}
int ruid = getuid();
if (ruid == 0)