.SH "SYNOPSIS"
.HP 5n
\fBsudo\fR
-\fB\-h\fR\ |\ \fB\-K\fR\ |\ \fB\-k\fR\ |\ \fB\-V\fR
+\fB\-h\fR | \fB\-K\fR | \fB\-k\fR | \fB\-V\fR
.PD 0
.HP 5n
\fBsudo\fR
contains a line specifying the askpass program, that value will be
used.
For example:
+.RS
.nf
.sp
-.RS 16n
+.RS 4n
# Path to askpass helper program
Path askpass /usr/X11R6/bin/ssh-askpass
.RE
.fi
-.RS 12n
.sp
If no askpass program is available,
\fBsudo\fR
will exit with an error.
+.PP
.RE
+.PD 0
.TP 12n
\fB\-a\fR, \fB\--auth-type\fR \fIauth_type\fR
The
\fI/etc/login.conf\fR.
The system administrator may specify a list of sudo-specific
authentication methods by adding an
-\(lqauth-sudo\(rq
+``auth-sudo''
entry in
\fI/etc/login.conf\fR.
This option is only available on systems that support BSD authentication.
+.PD
.TP 12n
\fB\-b\fR, \fB\--background\fR
The
argument can be either a class name as defined in
\fI/etc/login.conf\fR,
or a single
-\(oq\-\(cq
+`\-'
character.
Specifying a
\fIclass\fR
the security policy.
If the user is authorized by the policy, the following steps are
taken:
-.RS 13n
+.RS
.TP 5n
1.
Temporary copies are made of the files to be edited with the owner
3.
If they have been modified, the temporary files are copied back to
their original location and the temporary versions are removed.
-.RE
-.RS 12n
-.sp
+.PP
If the specified file does not exist, it will be created.
Note that unlike most commands run by
\fIsudo\fR,
is unable to update a file with its edited version, the user will
receive a warning and the edited copy will remain in a temporary
file.
+.PP
.RE
+.PD 0
.TP 12n
\fB\-g\fR, \fB\--group\fR \fIgroup\fR
Normally,
instead of a group name, use
\fI#gid\fR.
When running commands as a gid, many shells require that the
-\(oq#\(cq
+`#'
be escaped with a backslash
-(\(oq\e\(cq).
+(`\e').
If no
\fB\-u\fR
option is specified, the command will be run as the invoking user
(not root).
In either case, the primary group will be set to
\fIgroup\fR.
+.PD
.TP 12n
\fB\-H\fR, \fB\--set-home\fR
The
option allows you to override the default password prompt and use
a custom one.
The following percent
-(\(oq%\(cq)
+(`%')
escapes are supported by the
\fIsudoers\fR
policy:
-.PP
-.RS 12n
-.PD 0
+.RS
.TP 4n
\fR%H\fR
expanded to the host name including the domain name (on if the
\fIfqdn\fR
option is set in
sudoers(@mansectform@))
-.PD
.TP 4n
\fR%h\fR
expanded to the local host name without the domain name
.TP 4n
\fR%%\fR
two consecutive
-\(oq%\(cq
+`%'
characters are collapsed into a single
-\(oq%\(cq
+`%'
character
.PP
The prompt specified by the
\fIpassprompt_override\fR
flag is disabled in
\fIsudoers\fR.
+.PP
.RE
+.PD 0
.TP 12n
\fB\-r\fR, \fB\--role\fR \fIrole\fR
The
option causes the new SELinux security context to have the role
specified by
\fIrole\fR.
+.PD
.TP 12n
\fB\-S\fR, \fB\--stdin\fR
The
instead of a user name, use
\fI#uid\fR.
When running commands as a uid, many shells require that the
-\(oq#\(cq
+`#'
be escaped with a backslash
-(\(oq\e\(cq).
+(`\e').
Some security policies may restrict uids
to those listed in the password database.
The
command's exit status to the security policy's close function and exits.
If an I/O logging plugin is configured or if the security policy
explicitly requests it, a new pseudo-terminal
-(\(lqpty\(rq)
+(``pty'')
is created and a second
\fBsudo\fR
process is used to relay job control signals between the user's
This extra process makes it possible to, for example, suspend
and resume the command.
Without it, the command would be in what POSIX terms an
-\(lqorphaned process group\(rq
+``orphaned process group''
and it would not receive any job control signals.
As a special case, if the policy plugin does not define a close
function and no pty is required,
The most common reason for
stat(2)
to return
-\(lqpermission denied\(rq
+``permission denied''
is if you are running an automounter and one of the directories in
your
\fRPATH\fR
To aid in debugging
\fBsudo\fR
crashes, you may wish to re-enable core dumps by setting
-\(lqdisable_coredump\(rq
+``disable_coredump''
to false in the
sudo.conf(@mansectform@)
file as follows:
.SH "DISCLAIMER"
\fBsudo\fR
is provided
-\(lqAS IS\(rq
+``AS IS''
and any express or implied warranties, including, but not limited
to, the implied warranties of merchantability and fitness for a
particular purpose are disclaimed.
The options are as follows:
- -\b-d\bd _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by Use _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by to for the session logs instead of the
+ -\b-d\bd, -\b--\b-d\bdi\bir\bre\bec\bct\bto\bor\bry\by _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by
+ Use _\bd_\bi_\br_\be_\bc_\bt_\bo_\br_\by to for the session logs instead of the
default, _\b/_\bv_\ba_\br_\b/_\bl_\bo_\bg_\b/_\bs_\bu_\bd_\bo_\b-_\bi_\bo.
- -\b-f\bf _\bf_\bi_\bl_\bt_\be_\br By default, s\bsu\bud\bdo\bor\bre\bep\bpl\bla\bay\by will play back the command's
+ -\b-f\bf, -\b--\b-f\bfi\bil\blt\bte\ber\br _\bf_\bi_\bl_\bt_\be_\br
+ By default, s\bsu\bud\bdo\bor\bre\bep\bpl\bla\bay\by will play back the command's
standard output, standard error and tty output. The -\b-f\bf
option can be used to select which of these to output. The
_\bf_\bi_\bl_\bt_\be_\br argument is a comma-separated list, consisting of
one or more of following: _\bs_\bt_\bd_\bo_\bu_\bt, _\bs_\bt_\bd_\be_\br_\br, and _\bt_\bt_\by_\bo_\bu_\bt.
- -\b-h\bh The -\b-h\bh (_\bh_\be_\bl_\bp) option causes s\bsu\bud\bdo\bor\bre\bep\bpl\bla\bay\by to print a short
+ -\b-h\bh, -\b--\b-h\bhe\bel\blp\bp The -\b-h\bh (_\bh_\be_\bl_\bp) option causes s\bsu\bud\bdo\bor\bre\bep\bpl\bla\bay\by to print a short
help message to the standard output and exit.
- -\b-l\bl [_\bs_\be_\ba_\br_\bc_\bh _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn]
+ -\b-l\bl, -\b--\b-l\bli\bis\bst\bt [_\bs_\be_\ba_\br_\bc_\bh _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn]
Enable ``list mode''. In this mode, s\bsu\bud\bdo\bor\bre\bep\bpl\bla\bay\by will list
available sessions in a format similar to the s\bsu\bud\bdo\bo log file
format, sorted by file name (or sequence number). If a
optional, adjacent predicates have an implied _\ba_\bn_\bd unless
separated by an _\bo_\br.
- -\b-m\bm _\bm_\ba_\bx_\b__\bw_\ba_\bi_\bt Specify an upper bound on how long to wait between key
+ -\b-m\bm, -\b--\b-m\bma\bax\bx-\b-w\bwa\bai\bit\bt _\bm_\ba_\bx_\b__\bw_\ba_\bi_\bt
+ Specify an upper bound on how long to wait between key
presses or output data. By default, s\bsu\bud\bdo\bor\bre\bep\bpl\bla\bay\by will
accurately reproduce the delays between key presses or
program output. However, this can be tedious when the
_\bm_\ba_\bx_\b__\bw_\ba_\bi_\bt seconds. The value may be specified as a floating
point number, e.g. _\b2_\b._\b5.
- -\b-s\bs _\bs_\bp_\be_\be_\bd_\b__\bf_\ba_\bc_\bt_\bo_\br
+ -\b-s\bs, -\b--\b-s\bsp\bpe\bee\bed\bd _\bs_\bp_\be_\be_\bd_\b__\bf_\ba_\bc_\bt_\bo_\br
This option causes s\bsu\bud\bdo\bor\bre\bep\bpl\bla\bay\by to adjust the number of
seconds it will wait between key presses or program output.
This can be used to slow down or speed up the display. For
fast whereas a _\bs_\bp_\be_\be_\bd_\b__\bf_\ba_\bc_\bt_\bo_\br of _\b._\b5 would make the output
twice as slow.
- -\b-V\bV The -\b-V\bV (_\bv_\be_\br_\bs_\bi_\bo_\bn) option causes s\bsu\bud\bdo\bor\bre\bep\bpl\bla\bay\by to print its
+ -\b-V\bV, -\b--\b-v\bve\ber\brs\bsi\bio\bon\bn
+ The -\b-V\bV (_\bv_\be_\br_\bs_\bi_\bo_\bn) option causes s\bsu\bud\bdo\bor\bre\bep\bpl\bla\bay\by to print its
version number and exit.
D\bDa\bat\bte\be a\ban\bnd\bd t\bti\bim\bme\be f\bfo\bor\brm\bma\bat\bt
file distributed with s\bsu\bud\bdo\bo or http://www.sudo.ws/sudo/license.html for
complete details.
-Sudo 1.8.7 February 5, 2013 Sudo 1.8.7
+Sudo 1.8.8 July 7, 2013 Sudo 1.8.8
.\" DO NOT EDIT THIS FILE, IT IS NOT THE MASTER!
.\" IT IS GENERATED AUTOMATICALLY FROM sudoreplay.mdoc.in
.\"
-.\" Copyright (c) 2009-2012 Todd C. Miller <Todd.Miller@courtesan.com>
+.\" Copyright (c) 2009-2013 Todd C. Miller <Todd.Miller@courtesan.com>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "SUDOREPLAY" "@mansectsu@" "February 5, 2013" "Sudo @PACKAGE_VERSION@" "System Manager's Manual"
+.TH "SUDOREPLAY" "@mansectsu@" "July 7, 2013" "Sudo @PACKAGE_VERSION@" "System Manager's Manual"
.nh
.if n .ad l
.SH "NAME"
.PP
The options are as follows:
.TP 14n
-\fB\-d\fR \fIdirectory\fR
-.br
+\fB\-d\fR, \fB\--directory\fR \fIdirectory\fR
Use
\fIdirectory\fR
to for the session logs instead of the default,
\fI@iolog_dir@\fR.
.TP 14n
-\fB\-f\fR \fIfilter\fR
+\fB\-f\fR, \fB\--filter\fR \fIfilter\fR
By default,
\fBsudoreplay\fR
will play back the command's standard output, standard error and tty output.
and
\fIttyout\fR.
.TP 14n
-\fB\-h\fR
+\fB\-h\fR, \fB\--help\fR
The
\fB\-h\fR (\fIhelp\fR)
option causes
\fBsudoreplay\fR
to print a short help message to the standard output and exit.
.TP 14n
-\fB\-l\fR [\fIsearch expression\fR]
+\fB\-l\fR, \fB\--list\fR [\fIsearch expression\fR]
Enable
``list mode''.
In this mode,
.RE
.PD 0
.TP 14n
-\fB\-m\fR \fImax_wait\fR
+\fB\-m\fR, \fB\--max-wait\fR \fImax_wait\fR
Specify an upper bound on how long to wait between key presses or output data.
By default,
\fBsudoreplay\fR
\fI2.5\fR.
.PD
.TP 14n
-\fB\-s\fR \fIspeed_factor\fR
+\fB\-s\fR, \fB\--speed\fR \fIspeed_factor\fR
This option causes
\fBsudoreplay\fR
to adjust the number of seconds it will wait between key presses or
\fI.5\fR
would make the output twice as slow.
.TP 14n
-\fB\-V\fR
+\fB\-V\fR, \fB\--version\fR
The
\fB\-V\fR (\fIversion\fR)
option causes
.\"
-.\" Copyright (c) 2009-2012 Todd C. Miller <Todd.Miller@courtesan.com>
+.\" Copyright (c) 2009-2013 Todd C. Miller <Todd.Miller@courtesan.com>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd February 5, 2013
+.Dd July 7, 2013
.Dt SUDOREPLAY @mansectsu@
.Os Sudo @PACKAGE_VERSION@
.Sh NAME
.Pp
The options are as follows:
.Bl -tag -width 12n
-.It Fl d Ar directory
+.It Fl d , -directory Ar directory
Use
.Ar directory
to for the session logs instead of the default,
.Pa @iolog_dir@ .
-.It Fl f Ar filter
+.It Fl f , -filter Ar filter
By default,
.Nm sudoreplay
will play back the command's standard output, standard error and tty output.
.Em stderr ,
and
.Em ttyout .
-.It Fl h
+.It Fl h , -help
The
.Fl h No ( Em help Ns No )
option causes
.Nm sudoreplay
to print a short help message to the standard output and exit.
-.It Fl l Op Ar search expression
+.It Fl l , -list Op Ar search expression
Enable
.Dq list mode .
In this mode,
.Em and
unless separated by an
.Em or .
-.It Fl m Ar max_wait
+.It Fl m , -max-wait Ar max_wait
Specify an upper bound on how long to wait between key presses or output data.
By default,
.Nm sudoreplay
seconds.
The value may be specified as a floating point number, e.g.\&
.Em 2.5 .
-.It Fl s Ar speed_factor
+.It Fl s , -speed Ar speed_factor
This option causes
.Nm sudoreplay
to adjust the number of seconds it will wait between key presses or
of
.Em .5
would make the output twice as slow.
-.It Fl V
+.It Fl V , -version
The
.Fl V No ( Em version Ns No )
option causes
The options are as follows:
- -\b-c\bc Enable _\bc_\bh_\be_\bc_\bk_\b-_\bo_\bn_\bl_\by mode. The existing _\bs_\bu_\bd_\bo_\be_\br_\bs file will be
+ -\b-c\bc, -\b--\b-c\bch\bhe\bec\bck\bk
+ Enable _\bc_\bh_\be_\bc_\bk_\b-_\bo_\bn_\bl_\by mode. The existing _\bs_\bu_\bd_\bo_\be_\br_\bs file will be
checked for syntax errors, owner and mode. A message will be
printed to the standard output describing the status of
_\bs_\bu_\bd_\bo_\be_\br_\bs unless the -\b-q\bq option was specified. If the check
If an error is encountered, v\bvi\bis\bsu\bud\bdo\bo will exit with a value of
1.
- -\b-f\bf _\bs_\bu_\bd_\bo_\be_\br_\bs Specify an alternate _\bs_\bu_\bd_\bo_\be_\br_\bs file location. With this option
+ -\b-f\bf, -\b--\b-f\bfi\bil\ble\be _\bs_\bu_\bd_\bo_\be_\br_\bs
+ Specify an alternate _\bs_\bu_\bd_\bo_\be_\br_\bs file location. With this option
v\bvi\bis\bsu\bud\bdo\bo will edit (or check) the _\bs_\bu_\bd_\bo_\be_\br_\bs file of your choice,
instead of the default, _\b/_\be_\bt_\bc_\b/_\bs_\bu_\bd_\bo_\be_\br_\bs. The lock file used is
the specified _\bs_\bu_\bd_\bo_\be_\br_\bs file with ``.tmp'' appended to it. In
_\bc_\bh_\be_\bc_\bk_\b-_\bo_\bn_\bl_\by mode only, the argument to -\b-f\bf may be `-',
indicating that _\bs_\bu_\bd_\bo_\be_\br_\bs will be read from the standard input.
- -\b-h\bh The -\b-h\bh (_\bh_\be_\bl_\bp) option causes v\bvi\bis\bsu\bud\bdo\bo to print a short help
+ -\b-h\bh, -\b--\b-h\bhe\bel\blp\bp The -\b-h\bh (_\bh_\be_\bl_\bp) option causes v\bvi\bis\bsu\bud\bdo\bo to print a short help
message to the standard output and exit.
- -\b-q\bq Enable _\bq_\bu_\bi_\be_\bt mode. In this mode details about syntax errors
+ -\b-q\bq, -\b--\b-q\bqu\bui\bie\bet\bt
+ Enable _\bq_\bu_\bi_\be_\bt mode. In this mode details about syntax errors
are not printed. This option is only useful when combined
with the -\b-c\bc option.
- -\b-s\bs Enable _\bs_\bt_\br_\bi_\bc_\bt checking of the _\bs_\bu_\bd_\bo_\be_\br_\bs file. If an alias is
+ -\b-s\bs, -\b--\b-s\bst\btr\bri\bic\bct\bt
+ Enable _\bs_\bt_\br_\bi_\bc_\bt checking of the _\bs_\bu_\bd_\bo_\be_\br_\bs file. If an alias is
used before it is defined, v\bvi\bis\bsu\bud\bdo\bo will consider this a parse
error. Note that it is not possible to differentiate between
an alias and a host name or user name that consists solely of
uppercase letters, digits, and the underscore (`_')
character.
- -\b-V\bV The -\b-V\bV (_\bv_\be_\br_\bs_\bi_\bo_\bn) option causes v\bvi\bis\bsu\bud\bdo\bo to print its version
+ -\b-V\bV, -\b--\b-v\bve\ber\brs\bsi\bio\bon\bn
+ The -\b-V\bV (_\bv_\be_\br_\bs_\bi_\bo_\bn) option causes v\bvi\bis\bsu\bud\bdo\bo to print its version
number and exit.
E\bEN\bNV\bVI\bIR\bRO\bON\bNM\bME\bEN\bNT\bT
file distributed with s\bsu\bud\bdo\bo or http://www.sudo.ws/sudo/license.html for
complete details.
-Sudo 1.8.7 June 12, 2013 Sudo 1.8.7
+Sudo 1.8.8 July 17, 2013 Sudo 1.8.8
.\" DO NOT EDIT THIS FILE, IT IS NOT THE MASTER!
.\" IT IS GENERATED AUTOMATICALLY FROM visudo.mdoc.in
.\"
-.\" Copyright (c) 1996,1998-2005, 2007-2012
+.\" Copyright (c) 1996,1998-2005, 2007-2013
.\" Todd C. Miller <Todd.Miller@courtesan.com>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" Agency (DARPA) and Air Force Research Laboratory, Air Force
.\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
.\"
-.TH "VISUDO" "@mansectsu@" "June 12, 2013" "Sudo @PACKAGE_VERSION@" "System Manager's Manual"
+.TH "VISUDO" "@mansectsu@" "July 17, 2013" "Sudo @PACKAGE_VERSION@" "System Manager's Manual"
.nh
.if n .ad l
.SH "NAME"
\fBvisudo\fR
will print a message stating the line number(s)
where the error occurred and the user will receive the
-\(lqWhat now?\(rq
+``What now?''
prompt.
At this point the user may enter
-\(oqe\(cq
+`e'
to re-edit the
\fIsudoers\fR
file,
-\(oqx\(cq
+`x'
to exit without saving the changes, or
-\(oqQ\(cq
+`Q'
to quit and save changes.
The
-\(oqQ\(cq
+`Q'
option should be used with extreme care because if
\fBvisudo\fR
believes there to be a parse error, so will
\fBsudo\fR
again until the error is fixed.
If
-\(oqe\(cq
+`e'
is typed to edit the
\fIsudoers\fR
file after a parse error has been detected, the cursor will be placed on
.PP
The options are as follows:
.TP 12n
-\fB\-c\fR
+\fB\-c\fR, \fB\--check\fR
Enable
\fIcheck-only\fR
mode.
\fBvisudo\fR
will exit with a value of 1.
.TP 12n
-\fB\-f\fR \fIsudoers\fR
-.br
+\fB\-f\fR, \fB\--file\fR \fIsudoers\fR
Specify an alternate
\fIsudoers\fR
file location.
The lock file used is the specified
\fIsudoers\fR
file with
-\(lq\.tmp\(rq
+``\.tmp''
appended to it.
In
\fIcheck-only\fR
mode only, the argument to
\fB\-f\fR
may be
-\(oq-\(cq,
+`-',
indicating that
\fIsudoers\fR
will be read from the standard input.
.TP 12n
-\fB\-h\fR
+\fB\-h\fR, \fB\--help\fR
The
\fB\-h\fR (\fIhelp\fR)
option causes
to print a short help message
to the standard output and exit.
.TP 12n
-\fB\-q\fR
+\fB\-q\fR, \fB\--quiet\fR
Enable
\fIquiet\fR
mode.
\fB\-c\fR
option.
.TP 12n
-\fB\-s\fR
+\fB\-s\fR, \fB\--strict\fR
Enable
\fIstrict\fR
checking of the
Note that it is not possible to differentiate between an
alias and a host name or user name that consists solely of uppercase
letters, digits, and the underscore
-(\(oq_\(cq)
+(`_')
character.
.TP 12n
-\fB\-V\fR
+\fB\-V\fR, \fB\--version\fR
The
\fB\-V\fR (\fIversion\fR)
option causes
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
uppercase letters, digits, and the underscore
-(\(oq_\(cq)
+(`_')
character.
In the latter case, you can ignore the warnings
(\fBsudo\fR
.SH "DISCLAIMER"
\fBvisudo\fR
is provided
-\(lqAS IS\(rq
+``AS IS''
and any express or implied warranties, including, but not limited
to, the implied warranties of merchantability and fitness for a
particular purpose are disclaimed.
.\"
-.\" Copyright (c) 1996,1998-2005, 2007-2012
+.\" Copyright (c) 1996,1998-2005, 2007-2013
.\" Todd C. Miller <Todd.Miller@courtesan.com>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" Agency (DARPA) and Air Force Research Laboratory, Air Force
.\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
.\"
-.Dd June 12, 2013
+.Dd July 17, 2013
.Dt VISUDO @mansectsu@
.Os Sudo @PACKAGE_VERSION@
.Sh NAME
.Pp
The options are as follows:
.Bl -tag -width Fl
-.It Fl c
+.It Fl c , -check
Enable
.Em check-only
mode.
If an error is encountered,
.Nm visudo
will exit with a value of 1.
-.It Fl f Ar sudoers
+.It Fl f , -file Ar sudoers
Specify an alternate
.Em sudoers
file location.
indicating that
.Em sudoers
will be read from the standard input.
-.It Fl h
+.It Fl h , -help
The
.Fl h No ( Em help Ns No )
option causes
.Nm visudo
to print a short help message
to the standard output and exit.
-.It Fl q
+.It Fl q , -quiet
Enable
.Em quiet
mode.
the
.Fl c
option.
-.It Fl s
+.It Fl s , -strict
Enable
.Em strict
checking of the
letters, digits, and the underscore
.Pq Ql _
character.
-.It Fl V
+.It Fl V , -version
The
.Fl V ( Em version Ns No )
option causes
#else
# include "compat/stdbool.h"
#endif /* HAVE_STDBOOL_H */
+#ifdef HAVE_GETOPT_LONG
+# include <getopt.h>
+# else
+# include "compat/getopt.h"
+#endif /* HAVE_GETOPT_LONG */
#include <pathnames.h>
unsigned int replay_filter = (1 << IOFD_STDOUT) | (1 << IOFD_STDERR) |
(1 << IOFD_TTYOUT);
-/* For getopt(3) */
-extern char *optarg;
-extern int optind;
-
union io_fd {
FILE *f;
#ifdef HAVE_ZLIB_H
* Handle expressions like:
* ( user millert or user root ) and tty console and command /bin/sh
*/
-struct search_node {
+static struct search_node {
struct search_node *next;
#define ST_EXPR 1
#define ST_TTY 2
"/timing"
};
+static const char short_opts[] = "d:f:hlm:s:V";
+static struct option long_opts[] = {
+ { "directory", required_argument, NULL, 'd' },
+ { "filter", required_argument, NULL, 'f' },
+ { "help", no_argument, NULL, 'h' },
+ { "list", no_argument, NULL, 'l' },
+ { "max-wait", required_argument, NULL, 'm' },
+ { "speed", required_argument, NULL, 's' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, no_argument, NULL, '\0' },
+};
+
extern time_t get_date(char *);
extern char *get_timestr(time_t, int);
extern int term_raw(int, int);
/* Read sudo.conf. */
sudo_conf_read(NULL);
- while ((ch = getopt(argc, argv, "d:f:hlm:s:V")) != -1) {
- switch(ch) {
+ while ((ch = getopt_long(argc, argv, short_opts, long_opts, NULL)) != -1) {
+ switch (ch) {
case 'd':
session_dir = optarg;
break;
(void) printf(_("%s - replay sudo session logs\n\n"), getprogname());
usage(0);
(void) puts(_("\nOptions:\n"
- " -d directory specify directory for session logs\n"
- " -f filter specify which I/O type to display\n"
- " -h display help message and exit\n"
- " -l [expression] list available session IDs that match expression\n"
- " -m max_wait max number of seconds to wait between events\n"
- " -s speed_factor speed up or slow down output\n"
- " -V display version information and exit"));
+ " -d, --directory directory specify directory for session logs\n"
+ " -f, --filter filter specify which I/O type to display\n"
+ " -h, --help display help message and exit\n"
+ " -l, --list [expression] list available session IDs that match expression\n"
+ " -m, --max-wait max_wait max number of seconds to wait between events\n"
+ " -s, --speed speed_factor speed up or slow down output\n"
+ " -V, --version display version information and exit"));
exit(0);
}
#if TIME_WITH_SYS_TIME
# include <time.h>
#endif
+#ifdef HAVE_GETOPT_LONG
+# include <getopt.h>
+# else
+# include "compat/getopt.h"
+#endif /* HAVE_GETOPT_LONG */
#include "sudoers.h"
#include "parse.h"
extern char *sudoers, *errorfile;
extern int errorlineno;
extern bool parse_error;
-/* For getopt(3) */
-extern char *optarg;
-extern int optind;
/*
* Globals
static struct sudoersfile_list sudoerslist;
static struct rbtree *alias_freelist;
static bool checkonly;
+static const char short_opts[] = "cf:hqsV";
+static struct option long_opts[] = {
+ { "check", no_argument, NULL, 'c' },
+ { "file", required_argument, NULL, 'f' },
+ { "help", no_argument, NULL, 'h' },
+ { "quiet", no_argument, NULL, 'q' },
+ { "strict", no_argument, NULL, 's' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, no_argument, NULL, '\0' },
+};
__dso_public int main(int argc, char *argv[]);
*/
checkonly = oldperms = quiet = strict = false;
sudoers_path = _PATH_SUDOERS;
- while ((ch = getopt(argc, argv, "Vcf:sq")) != -1) {
+ while ((ch = getopt_long(argc, argv, short_opts, long_opts, NULL)) != -1) {
switch (ch) {
case 'V':
- (void) printf(_("%s version %s\n"), getprogname(), PACKAGE_VERSION);
- (void) printf(_("%s grammar version %d\n"), getprogname(), SUDOERS_GRAMMAR_VERSION);
+ (void) printf(_("%s version %s\n"), getprogname(),
+ PACKAGE_VERSION);
+ (void) printf(_("%s grammar version %d\n"), getprogname(),
+ SUDOERS_GRAMMAR_VERSION);
goto done;
case 'c':
checkonly = true; /* check mode */
(void) printf(_("%s - safely edit the sudoers file\n\n"), getprogname());
usage(0);
(void) puts(_("\nOptions:\n"
- " -c check-only mode\n"
- " -f sudoers specify sudoers file location\n"
- " -h display help message and exit\n"
- " -q less verbose (quiet) syntax error messages\n"
- " -s strict syntax checking\n"
- " -V display version information and exit"));
+ " -c, --check check-only mode\n"
+ " -f, --file sudoers specify sudoers file location\n"
+ " -h, --help display help message and exit\n"
+ " -q, --quiet less verbose (quiet) syntax error messages\n"
+ " -s, --strict strict syntax checking\n"
+ " -V, --version display version information and exit"));
exit(0);
}