From 523f0eeeab4f2c3c7a9192b514e0b0cae8640363 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 17 Apr 2018 07:10:43 -0600 Subject: [PATCH] Monty Python insults from Philip Hudson --- INSTALL | 5 +++++ MANIFEST | 1 + NEWS | 2 ++ config.h.in | 3 +++ configure | 20 +++++++++++++++++++ configure.ac | 12 ++++++++++++ plugins/sudoers/Makefile.in | 1 + plugins/sudoers/ins_python.h | 37 ++++++++++++++++++++++++++++++++++++ plugins/sudoers/insults.h | 8 ++++++-- 9 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 plugins/sudoers/ins_python.h diff --git a/INSTALL b/INSTALL index 0d7298fc9..ea3e8b678 100644 --- a/INSTALL +++ b/INSTALL @@ -705,6 +705,11 @@ Options that set runtime-changeable default values: and warning. Sudoers option: syslog_goodpri + --with-python-insults + Insults the user with lines from "Monty Python's Flying Circus" when an + incorrect password is entered. You must either specify --with-insults or + enable insults in the sudoers file for this to have any effect. + --with-goons-insults Insults the user with lines from the "Goon Show" when an incorrect password is entered. You must either specify --with-insults or diff --git a/MANIFEST b/MANIFEST index ac88d4e5b..54f886963 100644 --- a/MANIFEST +++ b/MANIFEST @@ -299,6 +299,7 @@ plugins/sudoers/ins_2001.h plugins/sudoers/ins_classic.h plugins/sudoers/ins_csops.h plugins/sudoers/ins_goons.h +plugins/sudoers/ins_python.h plugins/sudoers/insults.h plugins/sudoers/interfaces.c plugins/sudoers/interfaces.h diff --git a/NEWS b/NEWS index fdb626454..adced0276 100644 --- a/NEWS +++ b/NEWS @@ -39,6 +39,8 @@ What's new in Sudo 1.8.23 checks the directory for writability before using it. Previously, sudoedit only performed an existence check. Bug #827. + * Sudo now includes an optional set of Monty Python-inspired insults. + What's new in Sudo 1.8.22 * Commands run in the background from a script run via sudo will diff --git a/config.h.in b/config.h.in index e728a3d72..fcd73d587 100644 --- a/config.h.in +++ b/config.h.in @@ -1014,6 +1014,9 @@ /* Define to const if the `putenv' takes a const argument. */ #undef PUTENV_CONST +/* Define to 1 if you want insults from "Monty Python's Flying Circus". */ +#undef PYTHON_INSULTS + /* The default value of preloaded objects (if any). */ #undef RTLD_PRELOAD_DEFAULT diff --git a/configure b/configure index aad6822cf..e8abf6643 100755 --- a/configure +++ b/configure @@ -922,6 +922,7 @@ with_classic_insults with_csops_insults with_hal_insults with_goons_insults +with_python_insults with_nsswitch with_ldap with_ldap_conf_file @@ -1752,6 +1753,8 @@ Optional Packages: --with-csops-insults include CSOps insults --with-hal-insults include 2001-like insults --with-goons-insults include the insults from the "Goon Show" + --with-python-insults include the insults from "Monty Python's Flying + Circus" --with-nsswitch[=PATH] path to nsswitch.conf --with-ldap[=DIR] enable LDAP support --with-ldap-conf-file path to LDAP configuration file @@ -5771,6 +5774,7 @@ if test "${with_all_insults+set}" = set; then : with_csops_insults=yes with_hal_insults=yes with_goons_insults=yes + with_python_insults=yes ;; no) ;; *) as_fn_error $? "\"--with-all-insults does not take an argument.\"" "$LINENO" 5 @@ -5836,6 +5840,20 @@ fi +# Check whether --with-python-insults was given. +if test "${with_python_insults+set}" = set; then : + withval=$with_python_insults; case $with_python_insults in + yes) $as_echo "#define PYTHON_INSULTS 1" >>confdefs.h + + ;; + no) ;; + *) as_fn_error $? "\"--with-python-insults does not take an argument.\"" "$LINENO" 5 + ;; +esac +fi + + + # Check whether --with-nsswitch was given. if test "${with_nsswitch+set}" = set; then : withval=$with_nsswitch; case $with_nsswitch in @@ -5891,6 +5909,7 @@ if test "$insults" = "on"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking which insult sets to include" >&5 $as_echo_n "checking which insult sets to include... " >&6; } i="" + test "$with_python_insults" = "yes" && i="python ${i}" test "$with_goons_insults" = "yes" && i="goons ${i}" test "$with_hal_insults" = "yes" && i="hal ${i}" test "$with_csops_insults" = "yes" && i="csops ${i}" @@ -28781,5 +28800,6 @@ fi + diff --git a/configure.ac b/configure.ac index 310bb206a..1d28321ef 100644 --- a/configure.ac +++ b/configure.ac @@ -1089,6 +1089,7 @@ AC_ARG_WITH(all-insults, [AS_HELP_STRING([--with-all-insults], [include all the with_csops_insults=yes with_hal_insults=yes with_goons_insults=yes + with_python_insults=yes ;; no) ;; *) AC_MSG_ERROR(["--with-all-insults does not take an argument."]) @@ -1131,6 +1132,15 @@ AC_ARG_WITH(goons-insults, [AS_HELP_STRING([--with-goons-insults], [include the ;; esac]) +AC_ARG_WITH(python-insults, [AS_HELP_STRING([--with-python-insults], [include the insults from "Monty Python's Flying Circus"])], +[case $with_python_insults in + yes) AC_DEFINE(PYTHON_INSULTS) + ;; + no) ;; + *) AC_MSG_ERROR(["--with-python-insults does not take an argument."]) + ;; +esac]) + AC_ARG_WITH(nsswitch, [AS_HELP_STRING([--with-nsswitch[[=PATH]]], [path to nsswitch.conf])], [case $with_nsswitch in no) ;; @@ -1160,6 +1170,7 @@ dnl include all insult sets on one line if test "$insults" = "on"; then AC_MSG_CHECKING(which insult sets to include) i="" + test "$with_python_insults" = "yes" && i="python ${i}" test "$with_goons_insults" = "yes" && i="goons ${i}" test "$with_hal_insults" = "yes" && i="hal ${i}" test "$with_csops_insults" = "yes" && i="csops ${i}" @@ -4408,6 +4419,7 @@ AH_TEMPLATE(ENV_DEBUG, [Define to 1 to enable environment function debugging.]) AH_TEMPLATE(ENV_EDITOR, [Define to 1 if you want visudo to honor the EDITOR and VISUAL env variables.]) AH_TEMPLATE(FQDN, [Define to 1 if you want to require fully qualified hosts in sudoers.]) AH_TEMPLATE(ENV_RESET, [Define to 1 to enable environment resetting by default.]) +AH_TEMPLATE(PYTHON_INSULTS, [Define to 1 if you want insults from "Monty Python's Flying Circus".]) AH_TEMPLATE(GOONS_INSULTS, [Define to 1 if you want insults from the "Goon Show".]) AH_TEMPLATE(HAL_INSULTS, [Define to 1 if you want 2001-like insults.]) AH_TEMPLATE(HAVE_AFS, [Define to 1 if you use AFS.]) diff --git a/plugins/sudoers/Makefile.in b/plugins/sudoers/Makefile.in index a095a8d64..15ca1f9e7 100644 --- a/plugins/sudoers/Makefile.in +++ b/plugins/sudoers/Makefile.in @@ -1283,6 +1283,7 @@ sudo_auth.lo: $(authdir)/sudo_auth.c $(devdir)/def_data.h \ $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/ins_2001.h \ $(srcdir)/ins_classic.h $(srcdir)/ins_csops.h \ $(srcdir)/ins_goons.h $(srcdir)/insults.h $(srcdir)/logging.h \ + $(srcdir)/ins_python.h $(srcdir)/insults.h $(srcdir)/logging.h \ $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h diff --git a/plugins/sudoers/ins_python.h b/plugins/sudoers/ins_python.h new file mode 100644 index 000000000..28f53d228 --- /dev/null +++ b/plugins/sudoers/ins_python.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2018 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef SUDOERS_INS_PYTHON_H +#define SUDOERS_INS_PYTHON_H + + /* + * Insults from "Monty Python's Flying Circus" and family. + */ + + "That is no basis for supreme executive power!", + "You empty-headed animal food trough wiper!", + "I fart in your general direction!", + "Your mother was a hamster and your father smelt of elderberries!", + "You must cut down the mightiest tree in the forest... with... a herring!", + "I wave my private parts at your aunties!", + "He's not the Messiah, he's a very naughty boy!", + "I wish to make a complaint.", + "When you're walking home tonight, and some homicidal maniac comes after you with a bunch of loganberries, don't come crying to me!", + "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.", + +#endif /* SUDOERS_INS_PYTHON_H */ diff --git a/plugins/sudoers/insults.h b/plugins/sudoers/insults.h index 2114cc2b9..58d7f9d21 100644 --- a/plugins/sudoers/insults.h +++ b/plugins/sudoers/insults.h @@ -18,7 +18,7 @@ #ifndef SUDOERS_INSULTS_H #define SUDOERS_INSULTS_H -#if defined(HAL_INSULTS) || defined(GOONS_INSULTS) || defined(CLASSIC_INSULTS) || defined(CSOPS_INSULTS) +#if defined(HAL_INSULTS) || defined(GOONS_INSULTS) || defined(CLASSIC_INSULTS) || defined(CSOPS_INSULTS) || defined(PYTHON_INSULTS) /* * Use one or more set of insults as determined by configure @@ -40,6 +40,10 @@ char *insults[] = { # ifdef CSOPS_INSULTS # include "ins_csops.h" +# endif + +# ifdef PYTHON_INSULTS +# include "ins_python.h" # endif NULL @@ -56,6 +60,6 @@ char *insults[] = { */ #define INSULT (insults[time(NULL) % NOFINSULTS]) -#endif /* HAL_INSULTS || GOONS_INSULTS || CLASSIC_INSULTS || CSOPS_INSULTS */ +#endif /* HAL_INSULTS || GOONS_INSULTS || CLASSIC_INSULTS || CSOPS_INSULTS || PYTHON_INSULTS */ #endif /* SUDOERS_INSULTS_H */ -- 2.40.0