]> git.armaanb.net Git - opendoas.git/commitdiff
Change the way insults are enabled
authorArmaan Bhojwani <me@armaanb.net>
Sun, 4 Apr 2021 14:57:02 +0000 (10:57 -0400)
committerArmaan Bhojwani <me@armaanb.net>
Sun, 4 Apr 2021 14:57:02 +0000 (10:57 -0400)
Now they are configured entirely with the configure script.

Will be working on a config file option as well.

configure
doas.c
insults.c

index 55dabdfc0dc1cdee7342aaa17d77d9ec42334666..b337e6a832f060c1ce0bd55a0965ecf0f806e48b 100755 (executable)
--- a/configure
+++ b/configure
@@ -28,7 +28,7 @@ usage: configure [options]
 
   --with-timestamp       enable timestamp support
 
 
   --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)
 
   --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
 
 # defaults
 WITHOUT_TIMESTAMP=yes
-WITHOUT_KISS_INSULTS=""
 UID_MAX=65535
 GID_MAX=65535
 
 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-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 ;;
        --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
 
 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
 }
        }
        return 0
 }
diff --git a/doas.c b/doas.c
index eb9c47a47b43a3c0bdc62a53e7219960087bf50a..4c2f07886d49223921dcfdecf5b807feb75c15f2 100644 (file)
--- a/doas.c
+++ b/doas.c
@@ -239,7 +239,11 @@ mygetpwuid_r(uid_t uid, struct passwd *pwd, struct passwd **result)
 void
 authfail(void)
 {
 void
 authfail(void)
 {
+
+#ifdef DOAS_INSULTS
        printf("%s\n", getinsult());
        printf("%s\n", getinsult());
+#endif
+
        errx(1, "Authentication failed");
 }
 
        errx(1, "Authentication failed");
 }
 
index 6c71ea29fc967a43a2bd2ad40d2c74ee1765315d..f4a27fa50cfee1b111b6fd4987c6b9d96c691d34 100644 (file)
--- a/insults.c
+++ b/insults.c
@@ -4,9 +4,8 @@
 #include "config.h"
 
 char *insults[] = {
 #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 <Todd.Miller@sudo.ws>
      * The copyright header on those files states:
      *     ISC license
      *     Copyright (c) 1996-2018Todd C. Miller <Todd.Miller@sudo.ws>
@@ -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.",
     "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 *
 };
 
 const char *