Commit graph

86 commits

Author SHA1 Message Date
sw1tchbl4d3
4ed6a6d75a Fix memory leak in getconf()
As getline() calls malloc() to allocate new memory
for our usage, we have to free() it after.
2021-07-18 23:34:31 +02:00
sw1tchbl4d3
1bb71b46cc Build debug build with fsanitize=leak,address
This option warns us if something leaks memory
or other errors in memory occur.
2021-07-18 23:31:53 +02:00
sw1tchbl4d3
10147b324d Merge pull request 'Command line options' (#6) from remoof/rdo:main into main
Reviewed-on: https://codeberg.org/sw1tchbl4d3/rdo/pulls/6
2021-07-18 23:07:28 +02:00
remoof
f2137dc28d Add version and usage if no arguments are given. 2021-07-18 23:04:45 +02:00
sw1tchbl4d3
7df91d5f0b Merge pull request 'Restructured ensuredir and other small fixes' (#5) from remoof/rdo:main into main
Reviewed-on: https://codeberg.org/sw1tchbl4d3/rdo/pulls/5
2021-07-17 15:58:11 +02:00
remoof
df1cb0d70c Avoid closing on bad file descriptors 2021-07-17 15:54:39 +02:00
remoof
d44301d8fa Close file descriptors earlier 2021-07-17 15:31:18 +02:00
remoof
66e2cb0c42 Restructured ensuredir and other small fixes 2021-07-16 23:55:59 +02:00
sw1tchbl4d3
ea15c5631a Close directory fd + openat -> open 2021-07-16 08:13:59 +02:00
sw1tchbl4d3
5ba40256a0 Fix some more whitespaces...
I should probably switch IDEs
2021-07-16 00:47:53 +02:00
sw1tchbl4d3
6cabebefed Add some explanations for the config to the README 2021-07-16 00:43:18 +02:00
sw1tchbl4d3
95b3581737 Normalize the way we check for errors 2021-07-16 00:38:50 +02:00
sw1tchbl4d3
7f10e354de Fix whitespaces 2021-07-16 00:37:13 +02:00
sw1tchbl4d3
a23bb67985 Null-terminate read data 2021-07-16 00:35:02 +02:00
sw1tchbl4d3
e1147f4c7c Don't multiply session_ttl by 100 2021-07-16 00:15:04 +02:00
sw1tchbl4d3
c80be89ef9 Remove debug printf & use strlen() at write
In sessions.h, now line 95, we used sizeof(ts_str) to
determine how much to write, but as ts_str can be longer
than the actual string written, it wrote random data
after the actual timestamp.
2021-07-16 00:12:12 +02:00
sw1tchbl4d3
24638bc999 Add sessions feature
This is by far the heaviest feature of rdo, justifying
its own file for its 140loc.

It creates sessions, inspired by the way doas does it.
We use the /run/rdo temporary folder to store files in the
format of /run/rdo/pid-ts, pid being the PID of the process
that executed rdo, and ts being the timestamp at which said
process started.

As no 2 processes can have the exact same PID and startup time
(startup time is measured in the milliseconds), this seems secure.

Closes #4.
2021-07-15 23:47:27 +02:00
sw1tchbl4d3
2f4ff0812a Move type declerations to start of main 2021-07-15 16:17:54 +02:00
sw1tchbl4d3
225e6b0d6b Merge pull request 'Small fixes' (#3) from remoof/rdo:patch2 into main
Reviewed-on: https://codeberg.org/sw1tchbl4d3/rdo/pulls/3
2021-07-15 15:51:13 +02:00
remoof
9948bd3fc7 Check uid before opening file 2021-07-15 15:43:06 +02:00
sw1tchbl4d3
c5469393ab Merge pull request 'Add dependencies and fixed whitespace' (#2) from remoof/rdo:patch into main
Reviewed-on: https://codeberg.org/sw1tchbl4d3/rdo/pulls/2
2021-07-15 14:54:15 +02:00
remoof
a9fcfe3be9 Changed dependencies to list format 2021-07-15 14:45:21 +02:00
remoof
a657d0c2f5 Removed extra whitespace 2021-07-15 12:46:27 +02:00
remoof
f443a37f12 Add dependencies 2021-07-15 12:44:44 +02:00
sw1tchbl4d3
567899b1a1 Add AUR badge and instructions in README.md 2021-07-14 15:13:36 +02:00
sw1tchbl4d3
5443db5502 Various Makefile additions
We now have a normal and a debug build, both of which
have full RELRO, appropriate handling of warnings and
the default build has D_FORTIFY_SOURCE set to 2.
2021-07-14 06:13:34 +02:00
sw1tchbl4d3
61ebaafd0a Check return values of setuid() and setgid() 2021-07-14 06:12:50 +02:00
sw1tchbl4d3
9fa1190f7d Add sleep between wrong password attempts
This is required for #1
2021-07-13 23:42:11 +02:00
sw1tchbl4d3
a12c72a26a Add error message for faulty config 2021-07-13 23:31:23 +02:00
sw1tchbl4d3
f5bfafe269 Add config for rdo
This is needed for #1.
2021-07-13 23:21:34 +02:00
sw1tchbl4d3
3e4ffde3a4 Fix formatting in rdo.c 2021-07-13 22:46:57 +02:00
sw1tchbl4d3
604f5e7fdd Improve error messages
This commit makes rdo make use of the err.h header
for more pleasant and convenient error logging.
2021-07-13 22:39:28 +02:00
sw1tchbl4d3
336221e5e2 Get passphrase from TTY
This is required for #1.
2021-07-13 22:23:27 +02:00
sw1tchbl4d3
dcd1e4061c Fix various formatting mistakes in rdo.c 2021-07-13 22:14:46 +02:00
sw1tchbl4d3
16ab33147d Remove obsolete reference to Github 2021-07-13 21:34:38 +02:00
sw1tchbl4d3
f63e1b660a First Commit 2021-07-13 21:33:12 +02:00