Skip to content

Commit cfa5b99

Browse files
committed
merge sudo 1.9.3p1 from tip
--HG-- branch : 1.9
2 parents e0f4194 + b2593b2 commit cfa5b99

File tree

8 files changed

+80
-36
lines changed

8 files changed

+80
-36
lines changed

NEWS

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
What's new in Sudo 1.9.3p1
2+
3+
* Fixed a regression introduced in sudo 1.9.3 where the configure
4+
script would not detect the crypt(3) function if it was present
5+
in the C library, not an additional library.
6+
7+
* Fixed a regression introduced in sudo 1.8.23 with shadow passwd
8+
file authentication on OpenBSD. BSD authentication was not
9+
affected.
10+
11+
* Sudo now logs when a user-specified command-line option is
12+
rejected by a sudoers rule. Previously, these conditions were
13+
written to the audit log, but the default sudo log file. Affected
14+
command line arguments include -C (--close-from), -D (--chdir),
15+
-R (--chroot), -g (--group) and -u (--user).
16+
117
What's new in Sudo 1.9.3
218

319
* sudoedit will now prompt the user before overwriting an existing
@@ -7,7 +23,7 @@ What's new in Sudo 1.9.3
723
doesn't support symbol hiding.
824

925
* Sudo now uses a linker script to hide symbols even when the
10-
compiler has native symbol hiding support. This should make is
26+
compiler has native symbol hiding support. This should make it
1127
easier to detect omissions in the symbol exports file, regardless
1228
of the platform.
1329

configure

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.69 for sudo 1.9.3.
3+
# Generated by GNU Autoconf 2.69 for sudo 1.9.3p1.
44
#
55
# Report bugs to <https://bugzilla.sudo.ws/>.
66
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
590590
# Identity of this package.
591591
PACKAGE_NAME='sudo'
592592
PACKAGE_TARNAME='sudo'
593-
PACKAGE_VERSION='1.9.3'
594-
PACKAGE_STRING='sudo 1.9.3'
593+
PACKAGE_VERSION='1.9.3p1'
594+
PACKAGE_STRING='sudo 1.9.3p1'
595595
PACKAGE_BUGREPORT='https://bugzilla.sudo.ws/'
596596
PACKAGE_URL=''
597597

@@ -1584,7 +1584,7 @@ if test "$ac_init_help" = "long"; then
15841584
# Omit some internal or obsolete options to make the list less imposing.
15851585
# This message is too long to be a string in the A/UX 3.1 sh.
15861586
cat <<_ACEOF
1587-
\`configure' configures sudo 1.9.3 to adapt to many kinds of systems.
1587+
\`configure' configures sudo 1.9.3p1 to adapt to many kinds of systems.
15881588

15891589
Usage: $0 [OPTION]... [VAR=VALUE]...
15901590

@@ -1650,7 +1650,7 @@ fi
16501650

16511651
if test -n "$ac_init_help"; then
16521652
case $ac_init_help in
1653-
short | recursive ) echo "Configuration of sudo 1.9.3:";;
1653+
short | recursive ) echo "Configuration of sudo 1.9.3p1:";;
16541654
esac
16551655
cat <<\_ACEOF
16561656

@@ -1924,7 +1924,7 @@ fi
19241924
test -n "$ac_init_help" && exit $ac_status
19251925
if $ac_init_version; then
19261926
cat <<\_ACEOF
1927-
sudo configure 1.9.3
1927+
sudo configure 1.9.3p1
19281928
generated by GNU Autoconf 2.69
19291929

19301930
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2633,7 +2633,7 @@ cat >config.log <<_ACEOF
26332633
This file contains any messages produced by compilers while
26342634
running configure, to aid debugging if configure makes a mistake.
26352635

2636-
It was created by sudo $as_me 1.9.3, which was
2636+
It was created by sudo $as_me 1.9.3p1, which was
26372637
generated by GNU Autoconf 2.69. Invocation command line was
26382638

26392639
$ $0 $@
@@ -25531,11 +25531,13 @@ if test "$ac_res" != no; then :
2553125531
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
2553225532

2553325533
test "${ac_cv_search_crypt}" != "none required" && shadow_libs="${shadow_libs} ${ac_cv_search_crypt}"
25534-
$as_echo "#define HAVE_CRYPT 1" >>confdefs.h
25535-
2553625534

2553725535
fi
2553825536

25537+
if test "${ac_cv_search_crypt}" != "no"; then
25538+
$as_echo "#define HAVE_CRYPT 1" >>confdefs.h
25539+
25540+
fi
2553925541
LIBS="$_LIBS"
2554025542

2554125543
if test "$CHECKSHADOW" = "true" -a -n "$shadow_funcs"; then
@@ -27917,7 +27919,7 @@ fi
2791727919
case "$with_passwd" in
2791827920
yes|maybe)
2791927921
AUTH_OBJS="$AUTH_OBJS getspwuid.lo passwd.lo"
27920-
if test test "${ac_cv_search_crypt}" = "no"; then
27922+
if test "${ac_cv_search_crypt}" = "no"; then
2792127923
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No crypt function found, assuming plaintext passwords" >&5
2792227924
$as_echo "$as_me: WARNING: No crypt function found, assuming plaintext passwords" >&2;}
2792327925
fi
@@ -28626,7 +28628,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
2862628628
# report actual input values of CONFIG_FILES etc. instead of their
2862728629
# values after options handling.
2862828630
ac_log="
28629-
This file was extended by sudo $as_me 1.9.3, which was
28631+
This file was extended by sudo $as_me 1.9.3p1, which was
2863028632
generated by GNU Autoconf 2.69. Invocation command line was
2863128633

2863228634
CONFIG_FILES = $CONFIG_FILES
@@ -28692,7 +28694,7 @@ _ACEOF
2869228694
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
2869328695
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
2869428696
ac_cs_version="\\
28695-
sudo config.status 1.9.3
28697+
sudo config.status 1.9.3p1
2869628698
configured by $0, generated by GNU Autoconf 2.69,
2869728699
with options \\"\$ac_cs_config\\"
2869828700

configure.ac

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1818
dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1919
dnl
2020
AC_PREREQ([2.59])
21-
AC_INIT([sudo], [1.9.3], [https://bugzilla.sudo.ws/], [sudo])
21+
AC_INIT([sudo], [1.9.3p1], [https://bugzilla.sudo.ws/], [sudo])
2222
AC_CONFIG_HEADERS([config.h pathnames.h])
2323
AC_CONFIG_SRCDIR([src/sudo.c])
2424
dnl
@@ -4011,8 +4011,10 @@ if test ${with_passwd-'no'} != "no"; then
40114011
_LIBS="$LIBS"
40124012
AC_SEARCH_LIBS([crypt], [crypt crypt_d ufc], [
40134013
test "${ac_cv_search_crypt}" != "none required" && shadow_libs="${shadow_libs} ${ac_cv_search_crypt}"
4014-
AC_DEFINE(HAVE_CRYPT)
40154014
])
4015+
if test "${ac_cv_search_crypt}" != "no"; then
4016+
AC_DEFINE(HAVE_CRYPT)
4017+
fi
40164018
LIBS="$_LIBS"
40174019

40184020
if test "$CHECKSHADOW" = "true" -a -n "$shadow_funcs"; then
@@ -4612,7 +4614,7 @@ dnl
46124614
case "$with_passwd" in
46134615
yes|maybe)
46144616
AUTH_OBJS="$AUTH_OBJS getspwuid.lo passwd.lo"
4615-
if test test "${ac_cv_search_crypt}" = "no"; then
4617+
if test "${ac_cv_search_crypt}" = "no"; then
46164618
AC_MSG_WARN([No crypt function found, assuming plaintext passwords])
46174619
fi
46184620
;;

plugins/sudoers/audit.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,17 @@ audit_failure_int(char *const argv[], const char *message)
9393
}
9494

9595
int
96-
audit_failure(char *const argv[], char const *const fmt, ...)
96+
vaudit_failure(char *const argv[], char const *const fmt, va_list ap)
9797
{
9898
int oldlocale, ret;
9999
char *message;
100-
va_list ap;
101-
debug_decl(audit_failure, SUDOERS_DEBUG_AUDIT);
100+
debug_decl(vaudit_failure, SUDOERS_DEBUG_AUDIT);
102101

103102
/* Audit messages should be in the sudoers locale. */
104103
sudoers_setlocale(SUDOERS_LOCALE_SUDOERS, &oldlocale);
105104

106-
va_start(ap, fmt);
107105
if ((ret = vasprintf(&message, _(fmt), ap)) == -1)
108106
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
109-
va_end(ap);
110107

111108
if (ret != -1) {
112109
/* Set audit_msg for audit plugins. */
@@ -121,6 +118,20 @@ audit_failure(char *const argv[], char const *const fmt, ...)
121118
debug_return_int(ret);
122119
}
123120

121+
int
122+
audit_failure(char *const argv[], char const *const fmt, ...)
123+
{
124+
va_list ap;
125+
int ret;
126+
debug_decl(audit_failure, SUDOERS_DEBUG_AUDIT);
127+
128+
va_start(ap, fmt);
129+
ret = vaudit_failure(argv, fmt, ap);
130+
va_end(ap);
131+
132+
debug_return_int(ret);
133+
}
134+
124135
static int
125136
sudoers_audit_open(unsigned int version, sudo_conv_t conversation,
126137
sudo_printf_t plugin_printf, char * const settings[],

plugins/sudoers/getspwuid.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,11 @@ sudo_getepw(const struct passwd *pw)
7575
{
7676
struct passwd *spw;
7777

78+
/* On OpenBSD we need to closed the non-shadow passwd db first. */
79+
endpwent();
7880
if ((spw = getpwnam_shadow(pw->pw_name)) != NULL)
7981
epw = spw->pw_passwd;
82+
setpassent(1);
8083
}
8184
#endif /* HAVE_GETPWNAM_SHADOW */
8285
#ifdef HAVE_GETPRPWNAM

plugins/sudoers/logging.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,13 @@ vlog_warning(int flags, int errnum, const char *fmt, va_list ap)
502502
int len;
503503
debug_decl(vlog_warning, SUDOERS_DEBUG_LOGGING);
504504

505+
/* Do auditing first (audit_failure() handles the locale itself). */
506+
if (ISSET(flags, SLOG_AUDIT)) {
507+
va_copy(ap2, ap);
508+
vaudit_failure(NewArgv, fmt, ap2);
509+
va_end(ap2);
510+
}
511+
505512
/* Need extra copy of ap for sudo_vwarn()/sudo_vwarnx() below. */
506513
va_copy(ap2, ap);
507514

plugins/sudoers/logging.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#define SLOG_SEND_MAIL 0x08 /* log via mail */
4545
#define SLOG_NO_STDERR 0x10 /* do not log via stderr */
4646
#define SLOG_NO_LOG 0x20 /* do not log via file or syslog */
47+
#define SLOG_AUDIT 0x40 /* send message to audit as well */
4748

4849
/*
4950
* Maximum number of characters to log per entry. The syslogger
@@ -74,6 +75,7 @@ bool sudoers_warn_setlocale(bool restore, int *cookie);
7475
bool sudoers_setlocale(int newlocale, int *prevlocale);
7576
int sudoers_getlocale(void);
7677
int audit_failure(char *const argv[], char const *const fmt, ...) __printflike(2, 3);
78+
int vaudit_failure(char *const argv[], char const *const fmt, va_list ap) __printflike(2, 0);
7779
bool log_allowed(int status);
7880
bool log_auth_failure(int status, unsigned int tries);
7981
bool log_denial(int status, bool inform_user);

plugins/sudoers/sudoers.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,12 @@ check_user_runchroot(void)
287287

288288
sudo_debug_printf(SUDO_DEBUG_INFO|SUDO_DEBUG_LINENO,
289289
"def_runchroot %s, user_runchroot %s",
290-
def_runchroot ? def_runchroot : "NULL", user_runchroot);
290+
def_runchroot ? def_runchroot : "none",
291+
user_runchroot ? user_runchroot : "none");
291292

292293
if (def_runchroot == NULL || (strcmp(def_runchroot, "*") != 0 &&
293294
strcmp(def_runchroot, user_runchroot) != 0)) {
294-
audit_failure(NewArgv,
295+
log_warningx(SLOG_NO_STDERR|SLOG_AUDIT,
295296
N_("user not allowed to change root directory to %s"),
296297
user_runchroot);
297298
sudo_warnx(U_("you are not permitted to use the -R option with %s"),
@@ -313,11 +314,12 @@ check_user_runcwd(void)
313314

314315
sudo_debug_printf(SUDO_DEBUG_INFO|SUDO_DEBUG_LINENO,
315316
"def_runcwd %s, user_runcwd %s, user_cwd %s",
316-
def_runcwd, user_runcwd, user_cwd);
317+
def_runcwd ? def_runcwd : "none", user_runcwd ? user_runcwd : "none",
318+
user_cwd ? user_cwd : "none");
317319

318320
if (strcmp(user_cwd, user_runcwd) != 0) {
319321
if (def_runcwd == NULL || strcmp(def_runcwd, "*") != 0) {
320-
audit_failure(NewArgv,
322+
log_warningx(SLOG_NO_STDERR|SLOG_AUDIT,
321323
N_("user not allowed to change directory to %s"), user_runcwd);
322324
sudo_warnx(U_("you are not permitted to use the -D option with %s"),
323325
user_cmnd);
@@ -409,7 +411,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
409411
/* Check for -C overriding def_closefrom. */
410412
if (user_closefrom >= 0 && user_closefrom != def_closefrom) {
411413
if (!def_closefrom_override) {
412-
audit_failure(NewArgv,
414+
log_warningx(SLOG_NO_STDERR|SLOG_AUDIT,
413415
N_("user not allowed to override closefrom limit"));
414416
sudo_warnx("%s", U_("you are not permitted to use the -C option"));
415417
goto bad;
@@ -439,14 +441,13 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
439441

440442
/* Defer uid/gid checks until after defaults have been updated. */
441443
if (unknown_runas_uid && !def_runas_allow_unknown_id) {
442-
audit_failure(NewArgv, N_("unknown user: %s"), runas_pw->pw_name);
443-
sudo_warnx(U_("unknown user: %s"), runas_pw->pw_name);
444+
log_warningx(SLOG_AUDIT, N_("unknown user: %s"), runas_pw->pw_name);
444445
goto done;
445446
}
446447
if (runas_gr != NULL) {
447448
if (unknown_runas_gid && !def_runas_allow_unknown_id) {
448-
audit_failure(NewArgv, N_("unknown group: %s"), runas_gr->gr_name);
449-
sudo_warnx(U_("unknown group: %s"), runas_gr->gr_name);
449+
log_warningx(SLOG_AUDIT, N_("unknown group: %s"),
450+
runas_gr->gr_name);
450451
goto done;
451452
}
452453
}
@@ -487,16 +488,15 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
487488

488489
/* Bail if a tty is required and we don't have one. */
489490
if (def_requiretty && !tty_present()) {
490-
audit_failure(NewArgv, N_("no tty"));
491+
log_warningx(SLOG_NO_STDERR|SLOG_AUDIT, N_("no tty"));
491492
sudo_warnx("%s", U_("sorry, you must have a tty to run sudo"));
492493
goto bad;
493494
}
494495

495496
/* Check runas user's shell. */
496497
if (!check_user_shell(runas_pw)) {
497-
audit_failure(NewArgv, N_("invalid shell for user %s: %s"),
498-
runas_pw->pw_name, runas_pw->pw_shell);
499-
log_warningx(SLOG_RAW_MSG, N_("invalid shell for user %s: %s"),
498+
log_warningx(SLOG_RAW_MSG|SLOG_AUDIT,
499+
N_("invalid shell for user %s: %s"),
500500
runas_pw->pw_name, runas_pw->pw_shell);
501501
goto bad;
502502
}
@@ -597,7 +597,8 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
597597

598598
/* If user specified a timeout make sure sudoers allows it. */
599599
if (!def_user_command_timeouts && user_timeout > 0) {
600-
audit_failure(NewArgv, N_("user not allowed to set a command timeout"));
600+
log_warningx(SLOG_NO_STDERR|SLOG_AUDIT,
601+
N_("user not allowed to set a command timeout"));
601602
sudo_warnx("%s",
602603
U_("sorry, you are not allowed set a command timeout"));
603604
goto bad;
@@ -606,7 +607,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
606607
/* If user specified env vars make sure sudoers allows it. */
607608
if (ISSET(sudo_mode, MODE_RUN) && !def_setenv) {
608609
if (ISSET(sudo_mode, MODE_PRESERVE_ENV)) {
609-
audit_failure(NewArgv,
610+
log_warningx(SLOG_NO_STDERR|SLOG_AUDIT,
610611
N_("user not allowed to preserve the environment"));
611612
sudo_warnx("%s",
612613
U_("sorry, you are not allowed to preserve the environment"));

0 commit comments

Comments
 (0)