2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-28 21:07:55 +00:00

Try to be clearer about which are the input and output files in

export mode.
This commit is contained in:
Todd C. Miller 2014-05-13 15:00:43 -06:00
parent 372e30851f
commit b0e6977c35
4 changed files with 69 additions and 30 deletions

View File

@ -4,7 +4,7 @@ NNAAMMEE
vviissuuddoo - edit the sudoers file vviissuuddoo - edit the sudoers file
SSYYNNOOPPSSIISS SSYYNNOOPPSSIISS
vviissuuddoo [--cchhqqssVV] [--ff _s_u_d_o_e_r_s] [--xx _f_i_l_e] vviissuuddoo [--cchhqqssVV] [--ff _s_u_d_o_e_r_s] [--xx _o_u_t_p_u_t___f_i_l_e]
DDEESSCCRRIIPPTTIIOONN DDEESSCCRRIIPPTTIIOONN
vviissuuddoo edits the _s_u_d_o_e_r_s file in a safe fashion, analogous to vipw(1m). vviissuuddoo edits the _s_u_d_o_e_r_s file in a safe fashion, analogous to vipw(1m).
@ -72,14 +72,16 @@ DDEESSCCRRIIPPTTIIOONN
--VV, ----vveerrssiioonn --VV, ----vveerrssiioonn
Print the vviissuuddoo and _s_u_d_o_e_r_s grammar versions and exit. Print the vviissuuddoo and _s_u_d_o_e_r_s grammar versions and exit.
--xx _f_i_l_e, ----eexxppoorrtt=_f_i_l_e --xx _o_u_t_p_u_t___f_i_l_e, ----eexxppoorrtt=_o_u_t_p_u_t___f_i_l_e
Export _s_u_d_o_e_r_s in JSON format and write it to _f_i_l_e. If _f_i_l_e Export a _s_u_d_o_e_r_s in JSON format and write it to _o_u_t_p_u_t___f_i_l_e.
is `-', the exported _s_u_d_o_e_r_s policy will be written to the If _o_u_t_p_u_t___f_i_l_e is `-', the exported _s_u_d_o_e_r_s policy will be
standard output. The exported format is intended to be written to the standard output. By default, _/_e_t_c_/_s_u_d_o_e_r_s
easier for third-party applications to parse than the (and any files it includes) will be exported. The --ff option
traditional _s_u_d_o_e_r_s format. The various values have explicit can be used to specify a different _s_u_d_o_e_r_s file to export.
types which removes much of the ambiguity of the _s_u_d_o_e_r_s The exported format is intended to be easier for third-party
format. applications to parse than the traditional _s_u_d_o_e_r_s format.
The various values have explicit types which removes much of
the ambiguity of the _s_u_d_o_e_r_s format.
EENNVVIIRROONNMMEENNTT EENNVVIIRROONNMMEENNTT
The following environment variables may be consulted depending on the The following environment variables may be consulted depending on the
@ -123,6 +125,10 @@ DDIIAAGGNNOOSSTTIICCSS
only a warning by default as ssuuddoo will ignore cycles when parsing only a warning by default as ssuuddoo will ignore cycles when parsing
the _s_u_d_o_e_r_s file. the _s_u_d_o_e_r_s file.
visudo: /etc/sudoers: input and output files must be different
The --xx flag was used and the specified _o_u_t_p_u_t___f_i_l_e has the same
path name as the _s_u_d_o_e_r_s file to export.
SSEEEE AALLSSOO SSEEEE AALLSSOO
vi(1), sudoers(4), sudo(1m), vipw(1m) vi(1), sudoers(4), sudo(1m), vipw(1m)
@ -156,4 +162,4 @@ DDIISSCCLLAAIIMMEERR
file distributed with ssuuddoo or http://www.sudo.ws/sudo/license.html for file distributed with ssuuddoo or http://www.sudo.ws/sudo/license.html for
complete details. complete details.
Sudo 1.8.10 February 15, 2014 Sudo 1.8.10 Sudo 1.8.10 May 13, 2014 Sudo 1.8.10

View File

@ -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" "@mansectsu@" "February 15, 2014" "Sudo @PACKAGE_VERSION@" "System Manager's Manual" .TH "VISUDO" "@mansectsu@" "May 13, 2014" "Sudo @PACKAGE_VERSION@" "System Manager's Manual"
.nh .nh
.if n .ad l .if n .ad l
.SH "NAME" .SH "NAME"
@ -32,7 +32,7 @@
\fBvisudo\fR \fBvisudo\fR
[\fB\-chqsV\fR] [\fB\-chqsV\fR]
[\fB\-f\fR\ \fIsudoers\fR] [\fB\-f\fR\ \fIsudoers\fR]
[\fB\-x\fR\ \fIfile\fR] [\fB\-x\fR\ \fIoutput_file\fR]
.SH "DESCRIPTION" .SH "DESCRIPTION"
\fBvisudo\fR \fBvisudo\fR
edits the edits the
@ -205,18 +205,26 @@ and
\fIsudoers\fR \fIsudoers\fR
grammar versions and exit. grammar versions and exit.
.TP 12n .TP 12n
\fB\-x\fR \fIfile\fR, \fB\--export\fR=\fIfile\fR \fB\-x\fR \fIoutput_file\fR, \fB\--export\fR=\fIoutput_file\fR
Export Export a
\fIsudoers\fR \fIsudoers\fR
in JSON format and write it to in JSON format and write it to
\fIfile\fR. \fIoutput_file\fR.
If If
\fIfile\fR \fIoutput_file\fR
is is
\(oq-\(cq, \(oq-\(cq,
the exported the exported
\fIsudoers\fR \fIsudoers\fR
policy will be written to the standard output. policy will be written to the standard output.
By default,
\fI@sysconfdir@/sudoers\fR
(and any files it includes) will be exported.
The
\fB\-f\fR
option can be used to specify a different
\fIsudoers\fR
file to export.
The exported format is intended to be easier for third-party The exported format is intended to be easier for third-party
applications to parse than the traditional applications to parse than the traditional
\fIsudoers\fR \fIsudoers\fR
@ -298,6 +306,15 @@ will ignore cycles when parsing
the the
\fIsudoers\fR \fIsudoers\fR
file. file.
.TP 6n
\fRvisudo: @sysconfdir@/sudoers: input and output files must be different\fR
The
\fB\-x\fR
flag was used and the specified
\fIoutput_file\fR
has the same path name as the
\fIsudoers\fR
file to export.
.SH "SEE ALSO" .SH "SEE ALSO"
vi(1), vi(1),
sudoers(@mansectform@), sudoers(@mansectform@),

View File

@ -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 February 15, 2014 .Dd May 13, 2014
.Dt VISUDO @mansectsu@ .Dt VISUDO @mansectsu@
.Os Sudo @PACKAGE_VERSION@ .Os Sudo @PACKAGE_VERSION@
.Sh NAME .Sh NAME
@ -29,7 +29,7 @@
.Nm visudo .Nm visudo
.Op Fl chqsV .Op Fl chqsV
.Op Fl f Ar sudoers .Op Fl f Ar sudoers
.Op Fl x Ar file .Op Fl x Ar output_file
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm visudo .Nm visudo
edits the edits the
@ -196,18 +196,26 @@ Print the
and and
.Em sudoers .Em sudoers
grammar versions and exit. grammar versions and exit.
.It Fl x Ar file , Fl -export Ns = Ns Ar file .It Fl x Ar output_file , Fl -export Ns = Ns Ar output_file
Export Export a
.Em sudoers .Em sudoers
in JSON format and write it to in JSON format and write it to
.Ar file . .Ar output_file .
If If
.Ar file .Ar output_file
is is
.Ql - , .Ql - ,
the exported the exported
.Em sudoers .Em sudoers
policy will be written to the standard output. policy will be written to the standard output.
By default,
.Pa @sysconfdir@/sudoers
(and any files it includes) will be exported.
The
.Fl f
option can be used to specify a different
.Em sudoers
file to export.
The exported format is intended to be easier for third-party The exported format is intended to be easier for third-party
applications to parse than the traditional applications to parse than the traditional
.Em sudoers .Em sudoers
@ -286,6 +294,14 @@ will ignore cycles when parsing
the the
.Em sudoers .Em sudoers
file. file.
.It Li visudo: @sysconfdir@/sudoers: input and output files must be different
The
.Fl x
flag was used and the specified
.Ar output_file
has the same path name as the
.Em sudoers
file to export.
.El .El
.Sh SEE ALSO .Sh SEE ALSO
.Xr vi 1 , .Xr vi 1 ,

View File

@ -1318,7 +1318,7 @@ static void
usage(int fatal) usage(int fatal)
{ {
(void) fprintf(fatal ? stderr : stdout, (void) fprintf(fatal ? stderr : stdout,
"usage: %s [-chqsV] [-f sudoers] [-x file]\n", getprogname()); "usage: %s [-chqsV] [-f sudoers] [-x output_file]\n", getprogname());
if (fatal) if (fatal)
exit(1); exit(1);
} }
@ -1329,12 +1329,12 @@ help(void)
(void) printf(_("%s - safely edit the sudoers file\n\n"), getprogname()); (void) printf(_("%s - safely edit the sudoers file\n\n"), getprogname());
usage(0); usage(0);
(void) puts(_("\nOptions:\n" (void) puts(_("\nOptions:\n"
" -c, --check check-only mode\n" " -c, --check check-only mode\n"
" -f, --file=file specify sudoers file location\n" " -f, --file=sudoers specify sudoers file location\n"
" -h, --help display help message and exit\n" " -h, --help display help message and exit\n"
" -q, --quiet less verbose (quiet) syntax error messages\n" " -q, --quiet less verbose (quiet) syntax error messages\n"
" -s, --strict strict syntax checking\n" " -s, --strict strict syntax checking\n"
" -V, --version display version information and exit\n" " -V, --version display version information and exit\n"
" -x, --export=file export sudoers in JSON format")); " -x, --export=output_file write sudoers in JSON format to output_file"));
exit(0); exit(0);
} }