From 71b759e2542878de5c75a7101f2400cf35ec6299 Mon Sep 17 00:00:00 2001 From: Armaan Bhojwani Date: Sun, 4 Apr 2021 10:57:02 -0400 Subject: [PATCH] Change the way insults are enabled Now they are configured entirely with the configure script. Will be working on a config file option as well. --- configure | 9 ++++----- doas.c | 4 ++++ insults.c | 15 ++++----------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/configure b/configure index 55dabdf..b337e6a 100755 --- a/configure +++ b/configure @@ -28,7 +28,7 @@ usage: configure [options] --with-timestamp enable timestamp support - --with-kiss-insults enable kiss insults + --without-insults disable insults --uid-max=NUM set UID_MAX (default 65535) --gid-max=NUM set GID_MAX (default 65535) @@ -40,7 +40,6 @@ EOF # defaults WITHOUT_TIMESTAMP=yes -WITHOUT_KISS_INSULTS="" UID_MAX=65535 GID_MAX=65535 @@ -63,7 +62,7 @@ for x; do --with-shadow) WITHOUT_SHADOW=; WITHOUT_PAM=yes ;; --without-pam) WITHOUT_PAM=yes ;; --without-shadow) WITHOUT_SHADOW=yes ;; - --with-kiss-insults) WITH_KISS_INSULTS=yes ;; + --without-insults) WITHOUT_INSULTS=yes ;; --with-timestamp) WITHOUT_TIMESTAMP= ;; --without-timestamp) WITHOUT_TIMESTAMP=yes ;; --uid-max) UID_MAX=$var ;; @@ -227,8 +226,8 @@ int main(void) { definsults() { printf 'SRCS += insults.c\n' >>$CONFIG_MK - [ -n "$WITH_KISS_INSULTS" ] && { - printf '#define DOAS_INSULTS_KISS\n' >>$CONFIG_H + [ -z "$WITHOUT_INSULTS" ] && { + printf '#define DOAS_INSULTS\n' >>$CONFIG_H } return 0 } diff --git a/doas.c b/doas.c index eb9c47a..4c2f078 100644 --- a/doas.c +++ b/doas.c @@ -239,7 +239,11 @@ mygetpwuid_r(uid_t uid, struct passwd *pwd, struct passwd **result) void authfail(void) { + +#ifdef DOAS_INSULTS printf("%s\n", getinsult()); +#endif + errx(1, "Authentication failed"); } diff --git a/insults.c b/insults.c index 6c71ea2..f4a27fa 100644 --- a/insults.c +++ b/insults.c @@ -4,9 +4,8 @@ #include "config.h" char *insults[] = { - /* - * These insults were stolen from the Sudo project. + * These insults were stolen from the Sudo project, with some additions. * The copyright header on those files states: * ISC license * Copyright (c) 1996-2018Todd C. Miller @@ -73,15 +72,9 @@ char *insults[] = { "This man, he doesn't know when he's beaten! He doesn't know when he's winning, either. He has no... sort of... sensory apparatus...", "There's nothing wrong with you that an expensive operation can't prolong.", "I'm very sorry, but I'm not allowed to argue unless you've paid.", - -#ifdef DOAS_INSULTS_KISS - /* - * Insults from the KISS Linux community - */ - - "", - -#endif + "You are being naughty this year.", + "A new shipment of coal is on it's way.", + "Santa is not amused", }; const char * -- 2.39.2