2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 09:57:41 +00:00

Go back to using a Warning/Error prefix in the message printed to

stderr for alias problems.  Requested by Tomas Sykora.
This commit is contained in:
Todd C. Miller 2017-02-22 06:38:33 -07:00
parent 143620bb25
commit daa728fd88
6 changed files with 30 additions and 24 deletions

View File

@ -147,7 +147,7 @@ DDIIAAGGNNOOSSTTIICCSS
you do not exist in the passwd database you do not exist in the passwd database
Your user ID does not appear in the system passwd database. Your user ID does not appear in the system passwd database.
{User,Runas,Host,Cmnd}_Alias referenced but not defined Warning: {User,Runas,Host,Cmnd}_Alias referenced but not defined
Either you are trying to use an undeclared Either you are trying to use an undeclared
{User,Runas,Host,Cmnd}_Alias or you have a user or host name listed {User,Runas,Host,Cmnd}_Alias or you have a user or host name listed
that consists solely of uppercase letters, digits, and the that consists solely of uppercase letters, digits, and the
@ -157,13 +157,13 @@ DDIIAAGGNNOOSSTTIICCSS
undefined alias was used. In --ss (strict) mode these are errors, undefined alias was used. In --ss (strict) mode these are errors,
not warnings. not warnings.
unused {User,Runas,Host,Cmnd}_Alias Warning: unused {User,Runas,Host,Cmnd}_Alias
The specified {User,Runas,Host,Cmnd}_Alias was defined but never The specified {User,Runas,Host,Cmnd}_Alias was defined but never
used. The message is prefixed with the path name of the _s_u_d_o_e_r_s used. The message is prefixed with the path name of the _s_u_d_o_e_r_s
file and the line number where the unused alias was defined. You file and the line number where the unused alias was defined. You
may wish to comment out or remove the unused alias. may wish to comment out or remove the unused alias.
cycle in {User,Runas,Host,Cmnd}_Alias Warning: cycle in {User,Runas,Host,Cmnd}_Alias
The specified {User,Runas,Host,Cmnd}_Alias includes a reference to The specified {User,Runas,Host,Cmnd}_Alias includes a reference to
itself, either directly or through an alias it includes. The itself, either directly or through an alias it includes. The
message is prefixed with the path name of the _s_u_d_o_e_r_s file and the message is prefixed with the path name of the _s_u_d_o_e_r_s file and the
@ -172,7 +172,7 @@ DDIIAAGGNNOOSSTTIICCSS
when parsing the _s_u_d_o_e_r_s file. when parsing the _s_u_d_o_e_r_s file.
unknown defaults entry "name" unknown defaults entry "name"
The _s_u_d_o_e_r_s file contains a Defaults variable not recognized by The _s_u_d_o_e_r_s file contains a Defaults setting not recognized by
vviissuuddoo. vviissuuddoo.
/etc/sudoers: input and output files must be different /etc/sudoers: input and output files must be different
@ -212,4 +212,4 @@ DDIISSCCLLAAIIMMEERR
file distributed with ssuuddoo or https://www.sudo.ws/license.html for file distributed with ssuuddoo or https://www.sudo.ws/license.html for
complete details. complete details.
Sudo 1.8.20 November 12, 2016 Sudo 1.8.20 Sudo 1.8.20 February 22, 2017 Sudo 1.8.20

View File

@ -1,7 +1,7 @@
.\" DO NOT EDIT THIS FILE, IT IS NOT THE MASTER! .\" DO NOT EDIT THIS FILE, IT IS NOT THE MASTER!
.\" IT IS GENERATED AUTOMATICALLY FROM visudo.mdoc.in .\" IT IS GENERATED AUTOMATICALLY FROM visudo.mdoc.in
.\" .\"
.\" Copyright (c) 1996,1998-2005, 2007-2015 .\" Copyright (c) 1996,1998-2005, 2007-2017
.\" Todd C. Miller <Todd.Miller@courtesan.com> .\" Todd C. Miller <Todd.Miller@courtesan.com>
.\" .\"
.\" Permission to use, copy, modify, and distribute this software for any .\" Permission to use, copy, modify, and distribute this software for any
@ -21,7 +21,7 @@
.\" Agency (DARPA) and Air Force Research Laboratory, Air Force .\" Agency (DARPA) and Air Force Research Laboratory, Air Force
.\" Materiel Command, USAF, under agreement number F39502-99-1-0512. .\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
.\" .\"
.TH "VISUDO" "8" "November 12, 2016" "Sudo @PACKAGE_VERSION@" "System Manager's Manual" .TH "VISUDO" "8" "February 22, 2017" "Sudo @PACKAGE_VERSION@" "System Manager's Manual"
.nh .nh
.if n .ad l .if n .ad l
.SH "NAME" .SH "NAME"
@ -343,7 +343,7 @@ as root.
\fRyou do not exist in the passwd database\fR \fRyou do not exist in the passwd database\fR
Your user ID does not appear in the system passwd database. Your user ID does not appear in the system passwd database.
.TP 6n .TP 6n
\fR{User,Runas,Host,Cmnd}_Alias referenced but not defined\fR \fRWarning: {User,Runas,Host,Cmnd}_Alias referenced but not defined\fR
Either you are trying to use an undeclared {User,Runas,Host,Cmnd}_Alias Either you are trying to use an undeclared {User,Runas,Host,Cmnd}_Alias
or you have a user or host name listed that consists solely of or you have a user or host name listed that consists solely of
uppercase letters, digits, and the underscore uppercase letters, digits, and the underscore
@ -360,7 +360,7 @@ In
\fB\-s\fR \fB\-s\fR
(strict) mode these are errors, not warnings. (strict) mode these are errors, not warnings.
.TP 6n .TP 6n
\fRunused {User,Runas,Host,Cmnd}_Alias\fR \fRWarning: unused {User,Runas,Host,Cmnd}_Alias\fR
The specified {User,Runas,Host,Cmnd}_Alias was defined but never The specified {User,Runas,Host,Cmnd}_Alias was defined but never
used. used.
The message is prefixed with the path name of the The message is prefixed with the path name of the
@ -368,7 +368,7 @@ The message is prefixed with the path name of the
file and the line number where the unused alias was defined. file and the line number where the unused alias was defined.
You may wish to comment out or remove the unused alias. You may wish to comment out or remove the unused alias.
.TP 6n .TP 6n
\fRcycle in {User,Runas,Host,Cmnd}_Alias\fR \fRWarning: cycle in {User,Runas,Host,Cmnd}_Alias\fR
The specified {User,Runas,Host,Cmnd}_Alias includes a reference to The specified {User,Runas,Host,Cmnd}_Alias includes a reference to
itself, either directly or through an alias it includes. itself, either directly or through an alias it includes.
The message is prefixed with the path name of the The message is prefixed with the path name of the
@ -390,7 +390,7 @@ The
\fIsudoers\fR \fIsudoers\fR
file contains a file contains a
\fRDefaults\fR \fRDefaults\fR
variable not recognized by setting not recognized by
\fBvisudo\fR. \fBvisudo\fR.
.TP 6n .TP 6n
\fR@sysconfdir@/sudoers: input and output files must be different\fR \fR@sysconfdir@/sudoers: input and output files must be different\fR

View File

@ -1,5 +1,5 @@
.\" .\"
.\" Copyright (c) 1996,1998-2005, 2007-2015 .\" Copyright (c) 1996,1998-2005, 2007-2017
.\" Todd C. Miller <Todd.Miller@courtesan.com> .\" Todd C. Miller <Todd.Miller@courtesan.com>
.\" .\"
.\" Permission to use, copy, modify, and distribute this software for any .\" Permission to use, copy, modify, and distribute this software for any
@ -19,7 +19,7 @@
.\" Agency (DARPA) and Air Force Research Laboratory, Air Force .\" Agency (DARPA) and Air Force Research Laboratory, Air Force
.\" Materiel Command, USAF, under agreement number F39502-99-1-0512. .\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
.\" .\"
.Dd November 12, 2016 .Dd February 22, 2017
.Dt VISUDO @mansectsu@ .Dt VISUDO @mansectsu@
.Os Sudo @PACKAGE_VERSION@ .Os Sudo @PACKAGE_VERSION@
.Sh NAME .Sh NAME
@ -326,7 +326,7 @@ You didn't run
as root. as root.
.It Li you do not exist in the passwd database .It Li you do not exist in the passwd database
Your user ID does not appear in the system passwd database. Your user ID does not appear in the system passwd database.
.It Li {User,Runas,Host,Cmnd}_Alias referenced but not defined .It Li Warning: {User,Runas,Host,Cmnd}_Alias referenced but not defined
Either you are trying to use an undeclared {User,Runas,Host,Cmnd}_Alias Either you are trying to use an undeclared {User,Runas,Host,Cmnd}_Alias
or you have a user or host name listed that consists solely of or you have a user or host name listed that consists solely of
uppercase letters, digits, and the underscore uppercase letters, digits, and the underscore
@ -343,14 +343,14 @@ file and the line number where the undefined alias was used.
In In
.Fl s .Fl s
(strict) mode these are errors, not warnings. (strict) mode these are errors, not warnings.
.It Li unused {User,Runas,Host,Cmnd}_Alias .It Li Warning: unused {User,Runas,Host,Cmnd}_Alias
The specified {User,Runas,Host,Cmnd}_Alias was defined but never The specified {User,Runas,Host,Cmnd}_Alias was defined but never
used. used.
The message is prefixed with the path name of the The message is prefixed with the path name of the
.Em sudoers .Em sudoers
file and the line number where the unused alias was defined. file and the line number where the unused alias was defined.
You may wish to comment out or remove the unused alias. You may wish to comment out or remove the unused alias.
.It Li cycle in {User,Runas,Host,Cmnd}_Alias .It Li Warning: cycle in {User,Runas,Host,Cmnd}_Alias
The specified {User,Runas,Host,Cmnd}_Alias includes a reference to The specified {User,Runas,Host,Cmnd}_Alias includes a reference to
itself, either directly or through an alias it includes. itself, either directly or through an alias it includes.
The message is prefixed with the path name of the The message is prefixed with the path name of the
@ -371,7 +371,7 @@ The
.Em sudoers .Em sudoers
file contains a file contains a
.Li Defaults .Li Defaults
variable not recognized by setting not recognized by
.Nm . .Nm .
.It Li @sysconfdir@/sudoers: input and output files must be different .It Li @sysconfdir@/sudoers: input and output files must be different
The The

View File

@ -1 +1 @@
visudo: stdin:1 cycle in User_Alias "FOO" Error: stdin:1 cycle in User_Alias "FOO"

View File

@ -1,2 +1,2 @@
visudo: stdin:1 unused User_Alias "A" Warning: stdin:1 unused User_Alias "A"
visudo: stdin:2 unused User_Alias "B" Warning: stdin:2 unused User_Alias "B"

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 1998-2005, 2007-2016 * Copyright (c) 1996, 1998-2005, 2007-2017
* Todd C. Miller <Todd.Miller@courtesan.com> * Todd C. Miller <Todd.Miller@courtesan.com>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -1137,12 +1137,17 @@ check_alias(char *name, int type, char *file, int lineno, bool strict, bool quie
} else { } else {
if (!quiet) { if (!quiet) {
if (errno == ELOOP) { if (errno == ELOOP) {
sudo_warnx(U_("%s:%d cycle in %s \"%s\""), fprintf(stderr, strict ?
U_("Error: %s:%d cycle in %s \"%s\"") :
U_("Warning: %s:%d cycle in %s \"%s\""),
file, lineno, alias_type_to_string(type), name); file, lineno, alias_type_to_string(type), name);
} else { } else {
sudo_warnx(U_("%s:%d %s \"%s\" referenced but not defined"), fprintf(stderr, strict ?
U_("Error: %s:%d %s \"%s\" referenced but not defined") :
U_("Warning: %s:%d %s \"%s\" referenced but not defined"),
file, lineno, alias_type_to_string(type), name); file, lineno, alias_type_to_string(type), name);
} }
fputc('\n', stderr);
if (strict && errorfile == NULL) { if (strict && errorfile == NULL) {
errorfile = rcstr_addref(file); errorfile = rcstr_addref(file);
errorlineno = lineno; errorlineno = lineno;
@ -1292,8 +1297,9 @@ print_unused(void *v1, void *v2)
{ {
struct alias *a = (struct alias *)v1; struct alias *a = (struct alias *)v1;
sudo_warnx_nodebug(U_("%s:%d unused %s \"%s\""), fprintf(stderr, U_("Warning: %s:%d unused %s \"%s\""),
a->file, a->lineno, alias_type_to_string(a->type), a->name); a->file, a->lineno, alias_type_to_string(a->type), a->name);
fputc('\n', stderr);
return 0; return 0;
} }