Skip to content

Commit fce45b2

Browse files
committed
Make ignore_dot the default
Add --disable-ignore-dot to disable it and deprecate --with-ignore-dot.
1 parent ff3c218 commit fce45b2

File tree

5 files changed

+54
-40
lines changed

5 files changed

+54
-40
lines changed

INSTALL.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,14 @@ Defaults are listed in brackets after the description.
736736
of the "env_reset" Defaults option in sudoers to false.
737737
Sudoers option: !env_reset
738738

739+
--disable-ignore-dot
740+
By default, sudo will not search for a command in the current
741+
working directory, even if "." or "" in present in the PATH
742+
environment variable. If this option is disabled, sudo
743+
will check the current directory last if it appears anywhere
744+
in PATH. The PATH variable itself is not modified.
745+
Sudoers option: ignore_dot
746+
739747
--disable-path-info
740748
Normally, sudo will tell the user when a command could not be found
741749
in their $PATH. Some sites may wish to disable this as it could
@@ -876,11 +884,6 @@ Defaults are listed in brackets after the description.
876884
You must either specify --with-insults or enable insults in the
877885
sudoers file for this to have any effect.
878886

879-
--with-ignore-dot
880-
If set, sudo will ignore "." or "" (current dir) in $PATH.
881-
The $PATH itself is not modified.
882-
Sudoers option: ignore_dot
883-
884887
--with-insults
885888
Define this if you want to be insulted by default for typing
886889
an incorrect password just like the original sudo(8).

config.h.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
/* Configure script arguments used to build sudo. */
77
#undef CONFIGURE_ARGS
88

9+
/* Define to 1 if you want sudo to honor '.' and "" in the PATH. */
10+
#undef ALLOW_DOT_PATH
11+
912
/* Define to 1 if you want the insults from the "classic" version sudo. */
1013
#undef CLASSIC_INSULTS
1114

@@ -1138,9 +1141,6 @@
11381141
/* Define to 1 if you want the hostname to be entered into the log file. */
11391142
#undef HOST_IN_LOG
11401143

1141-
/* Define to 1 if you want to ignore '.' and empty PATH elements. */
1142-
#undef IGNORE_DOT_PATH
1143-
11441144
/* The message given when a bad password is entered. */
11451145
#undef INCORRECT_PASSWORD
11461146

configure

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,7 @@ enable_noargs_shell
10251025
enable_shell_sets_home
10261026
enable_path_info
10271027
enable_env_debug
1028+
enable_ignore_dot
10281029
enable_postinstall
10291030
enable_zlib
10301031
enable_env_reset
@@ -1737,6 +1738,7 @@ Optional Features:
17371738
Set $HOME to target user in shell mode
17381739
--disable-path-info Print 'command not allowed' not 'command not found'
17391740
--enable-env-debug Whether to enable environment debugging.
1741+
--disable-ignore-dot allow '.' and "" in the PATH
17401742
--enable-postinstall Script to run after the install phase
17411743
--enable-zlib[=PATH] Whether to enable or disable zlib
17421744
--enable-env-reset Whether to enable environment resetting by default.
@@ -1843,7 +1845,7 @@ Optional Packages:
18431845
--with-badpri syslog priority for failures (def is "alert")
18441846
--with-logpath path to the sudo log file
18451847
--with-loglen maximum length of a log file line (default is 80)
1846-
--with-ignore-dot ignore '.' in the PATH
1848+
--with-ignore-dot deprecated, use --disable-ignore-dot
18471849
--without-mail-if-no-user
18481850
do not send mail if user not in sudoers
18491851
--with-mail-if-no-host send mail if user in sudoers but not for this host
@@ -3715,7 +3717,7 @@ logfac=auth
37153717
goodpri=notice
37163718
badpri=alert
37173719
loglen=80
3718-
ignore_dot=off
3720+
ignore_dot=on
37193721
mail_no_user=on
37203722
mail_no_host=off
37213723
mail_no_perms=off
@@ -5310,9 +5312,7 @@ then :
53105312
yes) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: adding CSOps standard options" >&5
53115313
printf "%s\n" "$as_me: adding CSOps standard options" >&6;}
53125314
CHECKSIA=false
5313-
with_ignore_dot=yes
53145315
insults=on
5315-
with_env_editor=yes
53165316
: ${mansectsu='8'}
53175317
: ${mansectform='5'}
53185318
: ${mansectmisc='7'}
@@ -5664,16 +5664,7 @@ printf "%s\n" "#define MAXLOGFILELEN $loglen" >>confdefs.h
56645664
# Check whether --with-ignore-dot was given.
56655665
if test ${with_ignore_dot+y}
56665666
then :
5667-
withval=$with_ignore_dot; case $with_ignore_dot in
5668-
yes) ignore_dot=on
5669-
printf "%s\n" "#define IGNORE_DOT_PATH 1" >>confdefs.h
5670-
5671-
;;
5672-
no) ignore_dot=off
5673-
;;
5674-
*) as_fn_error $? "--with-ignore-dot does not take an argument." "$LINENO" 5
5675-
;;
5676-
esac
5667+
withval=$with_ignore_dot; enable_ignore_dot="$with_ignore_dot"
56775668
fi
56785669

56795670

@@ -6635,6 +6626,24 @@ printf "%s\n" "$as_me: WARNING: ignoring unknown argument to --enable-env-debug:
66356626
fi
66366627

66376628

6629+
# Check whether --enable-ignore-dot was given.
6630+
if test ${enable_ignore_dot+y}
6631+
then :
6632+
enableval=$enable_ignore_dot; case "$enableval" in
6633+
yes) ignore_dot=on
6634+
;;
6635+
no) ignore_dot=off
6636+
printf "%s\n" "#define ALLOW_DOT_PATH 1" >>confdefs.h
6637+
6638+
;;
6639+
*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: ignoring unknown argument to --enable-ignore-dot: $enableval" >&5
6640+
printf "%s\n" "$as_me: WARNING: ignoring unknown argument to --enable-ignore-dot: $enableval" >&2;}
6641+
;;
6642+
esac
6643+
6644+
fi
6645+
6646+
66386647
# Check whether --enable-postinstall was given.
66396648
if test ${enable_postinstall+y}
66406649
then :
@@ -6842,8 +6851,8 @@ then :
68426851
no) printf "%s\n" "#define NO_LEAKS 1" >>confdefs.h
68436852

68446853
;;
6845-
*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: ignoring unknown argument to --disable-leaks: $enableval" >&5
6846-
printf "%s\n" "$as_me: WARNING: ignoring unknown argument to --disable-leaks: $enableval" >&2;}
6854+
*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: ignoring unknown argument to --enable-leaks: $enableval" >&5
6855+
printf "%s\n" "$as_me: WARNING: ignoring unknown argument to --enable-leaks: $enableval" >&2;}
68476856
;;
68486857
esac
68496858

configure.ac

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ logfac=auth
205205
goodpri=notice
206206
badpri=alert
207207
loglen=80
208-
ignore_dot=off
208+
ignore_dot=on
209209
mail_no_user=on
210210
mail_no_host=off
211211
mail_no_perms=off
@@ -444,9 +444,7 @@ AC_ARG_WITH(csops, [AS_HELP_STRING([--with-csops], [add CSOps standard options])
444444
[case $with_csops in
445445
yes) AC_MSG_NOTICE([adding CSOps standard options])
446446
CHECKSIA=false
447-
with_ignore_dot=yes
448447
insults=on
449-
with_env_editor=yes
450448
: ${mansectsu='8'}
451449
: ${mansectform='5'}
452450
: ${mansectmisc='7'}
@@ -665,16 +663,7 @@ AC_ARG_WITH(loglen, [AS_HELP_STRING([--with-loglen], [maximum length of a log fi
665663
esac])
666664
AC_DEFINE_UNQUOTED(MAXLOGFILELEN, $loglen, [The max number of chars per log file line (for line wrapping).])
667665

668-
AC_ARG_WITH(ignore-dot, [AS_HELP_STRING([--with-ignore-dot], [ignore '.' in the PATH])],
669-
[case $with_ignore_dot in
670-
yes) ignore_dot=on
671-
AC_DEFINE(IGNORE_DOT_PATH)
672-
;;
673-
no) ignore_dot=off
674-
;;
675-
*) AC_MSG_ERROR([--with-ignore-dot does not take an argument.])
676-
;;
677-
esac])
666+
AC_ARG_WITH(ignore-dot, [AS_HELP_STRING([--with-ignore-dot], [deprecated, use --disable-ignore-dot])], [enable_ignore_dot="$with_ignore_dot"])
678667

679668
AC_ARG_WITH(mail-if-no-user, [AS_HELP_STRING([--without-mail-if-no-user], [do not send mail if user not in sudoers])],
680669
[case $with_mail_if_no_user in
@@ -1279,6 +1268,19 @@ AC_ARG_ENABLE(env_debug,
12791268
esac
12801269
])
12811270

1271+
AC_ARG_ENABLE(ignore-dot,
1272+
[AS_HELP_STRING([--disable-ignore-dot], [allow '.' and "" in the PATH])],
1273+
[ case "$enableval" in
1274+
yes) ignore_dot=on
1275+
;;
1276+
no) ignore_dot=off
1277+
AC_DEFINE(ALLOW_DOT_PATH)
1278+
;;
1279+
*) AC_MSG_WARN([ignoring unknown argument to --enable-ignore-dot: $enableval])
1280+
;;
1281+
esac
1282+
])
1283+
12821284
AC_ARG_ENABLE(postinstall,
12831285
[AS_HELP_STRING([--enable-postinstall], [Script to run after the install phase])],
12841286
[ case "$enableval" in
@@ -1384,7 +1386,7 @@ AC_ARG_ENABLE(leaks,
13841386
yes) ;;
13851387
no) AC_DEFINE(NO_LEAKS)
13861388
;;
1387-
*) AC_MSG_WARN([ignoring unknown argument to --disable-leaks: $enableval])
1389+
*) AC_MSG_WARN([ignoring unknown argument to --enable-leaks: $enableval])
13881390
;;
13891391
esac
13901392
])
@@ -4759,7 +4761,7 @@ AH_TEMPLATE(HAVE_ST_MTIMESPEC, [Define to 1 if your struct stat has an st_mtimes
47594761
AH_TEMPLATE(HAVE_ST_NMTIME, [Define to 1 if your struct stat has an st_nmtime member.])
47604762
AH_TEMPLATE(HAVE___PROGNAME, [Define to 1 if your crt0.o defines the __progname symbol for you.])
47614763
AH_TEMPLATE(HOST_IN_LOG, [Define to 1 if you want the hostname to be entered into the log file.])
4762-
AH_TEMPLATE(IGNORE_DOT_PATH, [Define to 1 if you want to ignore '.' and empty PATH elements.])
4764+
AH_TEMPLATE(ALLOW_DOT_PATH, [Define to 1 if you want sudo to honor '.' and "" in the PATH.])
47634765
AH_TEMPLATE(LOGGING, [Define to SLOG_SYSLOG, SLOG_FILE, or SLOG_BOTH.])
47644766
AH_TEMPLATE(LONG_OTP_PROMPT, [Define to 1 if you want a two line OTP (S/Key or OPIE) prompt.])
47654767
AH_TEMPLATE(NO_AUTHENTICATION, [Define to 1 if you don't want sudo to prompt for a password by default.])

plugins/sudoers/defaults.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ init_defaults(void)
483483
#ifdef LONG_OTP_PROMPT
484484
def_long_otp_prompt = true;
485485
#endif
486-
#ifdef IGNORE_DOT_PATH
486+
#ifndef ALLOW_DOT_PATH
487487
def_ignore_dot = true;
488488
#endif
489489
#ifdef ALWAYS_SEND_MAIL

0 commit comments

Comments
 (0)