Skip to content

Commit

Permalink
musl: reenable utmp & wtmp paths.
Browse files Browse the repository at this point in the history
utmp and wtmp file paths defined by musl point to /dev/null.
This patch restores their normal paths.

Notes:
- musl does not have login() and logout() functions that write utmp and wtmp.
- musl has pututline() and related functions, but they are stubs.
- for a program to use utmp/wtmp, it needs to write those files directly.
- Busybox and Dropbear implement direct write to wtmp.
- Busybox implements direct write to utmp too. (Dropbear has a bug.)
- there might be concerns about the security and privacy:
  - OpenWrt is not usually an OS where many persons log into.
  - If an intruder gains access to wtmp/utmp, it probably already has access
    to the rest of the system too.

Signed-off-by: Marius Dinu <m95d+git@psihoexpert.ro>
  • Loading branch information
M95D committed May 2, 2024
1 parent 2190181 commit 2bba2a4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions toolchain/musl/patches/902-utmp-wtmp-paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- a/include/paths.h
+++ b/include/paths.h
@@ -18,9 +18,9 @@
#define _PATH_SHADOW "/etc/shadow"
#define _PATH_SHELLS "/etc/shells"
#define _PATH_TTY "/dev/tty"
-#define _PATH_UTMP "/dev/null/utmp"
+#define _PATH_UTMP "/var/run/utmp"
#define _PATH_VI "/usr/bin/vi"
-#define _PATH_WTMP "/dev/null/wtmp"
+#define _PATH_WTMP "/var/log/wtmp"

#define _PATH_DEV "/dev/"
#define _PATH_TMP "/tmp/"

0 comments on commit 2bba2a4

Please sign in to comment.