diff options
author | Dmitry Bogatov <KAction@gnu.org> | 2017-09-01 04:11:07 +0300 |
---|---|---|
committer | Dmitry Bogatov <KAction@gnu.org> | 2018-02-14 19:28:06 +0300 |
commit | e9d67d805b5d6285d370eb63a073617bd727d9c7 (patch) | |
tree | c9ee8967b91e709a244532791d8e8d455dbcf846 | |
parent | 39087416da44ca4a27131d5d7ddb71343581b6c8 (diff) |
[PATCH] Link checkpassword with gnu libc, not diet libc
Unfortunately, crypt(3) from diet libc does not recognize $6$ prefix
of hash in /etc/shadow and as such, no login was possible at all.
Author of diet libc proposed to either contribute apporiate code
to diet libc, or link with other libc. There was choice to statically
link with musl libc or dynamically gnu libc. Static linking with
musl libc results in 76Kb binary (aganist 15Kb with diet libc) and
as I found it unreasonable.
Also, with dynamic linking, if new hashing method would ever reach gnu libc,
checkpassword would catch it without my interaction.
Unfortunately, this patch can't be forwarded, since upstream is not interested.
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | checkpassword.c | 2 |
2 files changed, 5 insertions, 3 deletions
@@ -7,7 +7,6 @@ all: fgetty login login2 checkpassword DIET=diet -Os #CROSS=arm-linux- CROSS= -LDFLAGS= %.o: %.c # gcc -march=i386 -mcpu=i386 -pipe -Os -fomit-frame-pointer -I../dietlibc/include -c $^ -DTEST @@ -15,13 +14,14 @@ LDFLAGS= # gcc -march=i386 -mcpu=i386 -pipe -g -I../dietlibc/include -DTEST -c $^ %: %.o - $(DIET) $(CROSS)$(CC) -o $@ $^ $(LDFLAGS) + $(DIET) $(CROSS)$(CC) -o $@ $^ fgetty: fgetty.o fmt_ulong.o login: login.o login2: login2.o -checkpassword: checkpassword.o +checkpassword: checkpassword.c + gcc -Os $(CFLAGS) $(CPPFLAGS) $^ -lcrypt $(LDFLAGS) -o $@ checkpassword-pam: checkpassword-pam.o checkpassword-pam2.o $(CROSS)$(CC) -o $@ $^ -lmisc $(LDFLAGS) diff --git a/checkpassword.c b/checkpassword.c index b7bbe85..655668a 100644 --- a/checkpassword.c +++ b/checkpassword.c @@ -1,8 +1,10 @@ +#define _XOPEN_SOURCE #include <string.h> #include <unistd.h> #include <pwd.h> #include <shadow.h> #include <stdio.h> +#include <alloca.h> #ifdef __dietlibc__ #include <write12.h> #else |