summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmaan Bhojwani <me@armaanb.net>2021-04-04 10:57:02 -0400
committerArmaan Bhojwani <me@armaanb.net>2021-04-04 10:57:02 -0400
commit71b759e2542878de5c75a7101f2400cf35ec6299 (patch)
treea37b3d6d6793421b8dd3e14f4ca41844db773d61
parentb3ac44f2a021d43aa82e237c2d5595620ba5f130 (diff)
downloadopendoas-71b759e2542878de5c75a7101f2400cf35ec6299.tar.gz
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.
-rwxr-xr-xconfigure9
-rw-r--r--doas.c4
-rw-r--r--insults.c15
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 <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.",
-
-#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 *