Add -B option to ring the bell before the password prompt.
This commit is contained in:
14
doc/sudo.cat
14
doc/sudo.cat
@@ -5,13 +5,13 @@ NNAAMMEE
|
|||||||
|
|
||||||
SSYYNNOOPPSSIISS
|
SSYYNNOOPPSSIISS
|
||||||
ssuuddoo --hh | --KK | --kk | --VV
|
ssuuddoo --hh | --KK | --kk | --VV
|
||||||
ssuuddoo --vv [--AAkknnSS] [--aa _t_y_p_e] [--gg _g_r_o_u_p] [--hh _h_o_s_t] [--pp _p_r_o_m_p_t] [--uu _u_s_e_r]
|
ssuuddoo --vv [--AABBkknnSS] [--aa _t_y_p_e] [--gg _g_r_o_u_p] [--hh _h_o_s_t] [--pp _p_r_o_m_p_t] [--uu _u_s_e_r]
|
||||||
ssuuddoo --ll [--AAkknnSS] [--aa _t_y_p_e] [--gg _g_r_o_u_p] [--hh _h_o_s_t] [--pp _p_r_o_m_p_t] [--UU _u_s_e_r]
|
ssuuddoo --ll [--AABBkknnSS] [--aa _t_y_p_e] [--gg _g_r_o_u_p] [--hh _h_o_s_t] [--pp _p_r_o_m_p_t] [--UU _u_s_e_r]
|
||||||
[--uu _u_s_e_r] [_c_o_m_m_a_n_d]
|
[--uu _u_s_e_r] [_c_o_m_m_a_n_d]
|
||||||
ssuuddoo [--AAbbEEHHnnPPSS] [--aa _t_y_p_e] [--CC _n_u_m] [--cc _c_l_a_s_s] [--gg _g_r_o_u_p] [--hh _h_o_s_t]
|
ssuuddoo [--AABBbbEEHHnnPPSS] [--aa _t_y_p_e] [--CC _n_u_m] [--cc _c_l_a_s_s] [--gg _g_r_o_u_p] [--hh _h_o_s_t]
|
||||||
[--pp _p_r_o_m_p_t] [--rr _r_o_l_e] [--tt _t_y_p_e] [--TT _t_i_m_e_o_u_t] [--uu _u_s_e_r] [_V_A_R=_v_a_l_u_e]
|
[--pp _p_r_o_m_p_t] [--rr _r_o_l_e] [--tt _t_y_p_e] [--TT _t_i_m_e_o_u_t] [--uu _u_s_e_r] [_V_A_R=_v_a_l_u_e]
|
||||||
[--ii | --ss] [_c_o_m_m_a_n_d]
|
[--ii | --ss] [_c_o_m_m_a_n_d]
|
||||||
ssuuddooeeddiitt [--AAkknnSS] [--aa _t_y_p_e] [--CC _n_u_m] [--cc _c_l_a_s_s] [--gg _g_r_o_u_p] [--hh _h_o_s_t]
|
ssuuddooeeddiitt [--AABBkknnSS] [--aa _t_y_p_e] [--CC _n_u_m] [--cc _c_l_a_s_s] [--gg _g_r_o_u_p] [--hh _h_o_s_t]
|
||||||
[--pp _p_r_o_m_p_t] [--TT _t_i_m_e_o_u_t] [--uu _u_s_e_r] _f_i_l_e _._._.
|
[--pp _p_r_o_m_p_t] [--TT _t_i_m_e_o_u_t] [--uu _u_s_e_r] _f_i_l_e _._._.
|
||||||
|
|
||||||
DDEESSCCRRIIPPTTIIOONN
|
DDEESSCCRRIIPPTTIIOONN
|
||||||
@@ -72,6 +72,10 @@ DDEESSCCRRIIPPTTIIOONN
|
|||||||
_/_e_t_c_/_l_o_g_i_n_._c_o_n_f. This option is only available on systems
|
_/_e_t_c_/_l_o_g_i_n_._c_o_n_f. This option is only available on systems
|
||||||
that support BSD authentication.
|
that support BSD authentication.
|
||||||
|
|
||||||
|
--BB, ----bbeellll Ring the bell as part of the password promp when a terminal
|
||||||
|
is present. This option has no effect if an askpass program
|
||||||
|
is used.
|
||||||
|
|
||||||
--bb, ----bbaacckkggrroouunndd
|
--bb, ----bbaacckkggrroouunndd
|
||||||
Run the given command in the background. Note that it is not
|
Run the given command in the background. Note that it is not
|
||||||
possible to use shell job control to manipulate background
|
possible to use shell job control to manipulate background
|
||||||
@@ -738,4 +742,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.28 November 25, 2018 Sudo 1.8.28
|
Sudo 1.8.28 May 27, 2019 Sudo 1.8.28
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" SPDX-License-Identifier: ISC
|
.\" SPDX-License-Identifier: ISC
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1994-1996, 1998-2005, 2007-2018
|
.\" Copyright (c) 1994-1996, 1998-2005, 2007-2019
|
||||||
.\" Todd C. Miller <Todd.Miller@sudo.ws>
|
.\" Todd C. Miller <Todd.Miller@sudo.ws>
|
||||||
.\"
|
.\"
|
||||||
.\" Permission to use, copy, modify, and distribute this software for any
|
.\" Permission to use, copy, modify, and distribute this software for any
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
.nr BA @BAMAN@
|
.nr BA @BAMAN@
|
||||||
.nr LC @LCMAN@
|
.nr LC @LCMAN@
|
||||||
.nr PS @PSMAN@
|
.nr PS @PSMAN@
|
||||||
.TH "SUDO" "@mansectsu@" "November 25, 2018" "Sudo @PACKAGE_VERSION@" "System Manager's Manual"
|
.TH "SUDO" "@mansectsu@" "May 27, 2019" "Sudo @PACKAGE_VERSION@" "System Manager's Manual"
|
||||||
.nh
|
.nh
|
||||||
.if n .ad l
|
.if n .ad l
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
.HP 5n
|
.HP 5n
|
||||||
\fBsudo\fR
|
\fBsudo\fR
|
||||||
\fB\-v\fR
|
\fB\-v\fR
|
||||||
[\fB\-AknS\fR]
|
[\fB\-ABknS\fR]
|
||||||
.if \n(BA [\fB\-a\fR\ \fItype\fR]
|
.if \n(BA [\fB\-a\fR\ \fItype\fR]
|
||||||
[\fB\-g\fR\ \fIgroup\fR]
|
[\fB\-g\fR\ \fIgroup\fR]
|
||||||
[\fB\-h\fR\ \fIhost\fR]
|
[\fB\-h\fR\ \fIhost\fR]
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
.HP 5n
|
.HP 5n
|
||||||
\fBsudo\fR
|
\fBsudo\fR
|
||||||
\fB\-l\fR
|
\fB\-l\fR
|
||||||
[\fB\-AknS\fR]
|
[\fB\-ABknS\fR]
|
||||||
.if \n(BA [\fB\-a\fR\ \fItype\fR]
|
.if \n(BA [\fB\-a\fR\ \fItype\fR]
|
||||||
[\fB\-g\fR\ \fIgroup\fR]
|
[\fB\-g\fR\ \fIgroup\fR]
|
||||||
[\fB\-h\fR\ \fIhost\fR]
|
[\fB\-h\fR\ \fIhost\fR]
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
.br
|
.br
|
||||||
.HP 5n
|
.HP 5n
|
||||||
\fBsudo\fR
|
\fBsudo\fR
|
||||||
[\fB\-AbEHnPS\fR]
|
[\fB\-ABbEHnPS\fR]
|
||||||
.if \n(BA [\fB\-a\fR\ \fItype\fR]
|
.if \n(BA [\fB\-a\fR\ \fItype\fR]
|
||||||
[\fB\-C\fR\ \fInum\fR]
|
[\fB\-C\fR\ \fInum\fR]
|
||||||
.if \n(LC [\fB\-c\fR\ \fIclass\fR]
|
.if \n(LC [\fB\-c\fR\ \fIclass\fR]
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
.br
|
.br
|
||||||
.HP 9n
|
.HP 9n
|
||||||
\fBsudoedit\fR
|
\fBsudoedit\fR
|
||||||
[\fB\-AknS\fR]
|
[\fB\-ABknS\fR]
|
||||||
.if \n(BA [\fB\-a\fR\ \fItype\fR]
|
.if \n(BA [\fB\-a\fR\ \fItype\fR]
|
||||||
[\fB\-C\fR\ \fInum\fR]
|
[\fB\-C\fR\ \fInum\fR]
|
||||||
.if \n(LC [\fB\-c\fR\ \fIclass\fR]
|
.if \n(LC [\fB\-c\fR\ \fIclass\fR]
|
||||||
@@ -213,6 +213,10 @@ BSD
|
|||||||
authentication.
|
authentication.
|
||||||
.\}
|
.\}
|
||||||
.TP 12n
|
.TP 12n
|
||||||
|
\fB\-B\fR, \fB\--bell\fR
|
||||||
|
Ring the bell as part of the password promp when a terminal is present.
|
||||||
|
This option has no effect if an askpass program is used.
|
||||||
|
.TP 12n
|
||||||
\fB\-b\fR, \fB\--background\fR
|
\fB\-b\fR, \fB\--background\fR
|
||||||
Run the given command in the background.
|
Run the given command in the background.
|
||||||
Note that it is not possible to use shell job control to manipulate
|
Note that it is not possible to use shell job control to manipulate
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" SPDX-License-Identifier: ISC
|
.\" SPDX-License-Identifier: ISC
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1994-1996, 1998-2005, 2007-2018
|
.\" Copyright (c) 1994-1996, 1998-2005, 2007-2019
|
||||||
.\" Todd C. Miller <Todd.Miller@sudo.ws>
|
.\" Todd C. Miller <Todd.Miller@sudo.ws>
|
||||||
.\"
|
.\"
|
||||||
.\" Permission to use, copy, modify, and distribute this software for any
|
.\" Permission to use, copy, modify, and distribute this software for any
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
.nr BA @BAMAN@
|
.nr BA @BAMAN@
|
||||||
.nr LC @LCMAN@
|
.nr LC @LCMAN@
|
||||||
.nr PS @PSMAN@
|
.nr PS @PSMAN@
|
||||||
.Dd November 25, 2018
|
.Dd May 27, 2019
|
||||||
.Dt SUDO @mansectsu@
|
.Dt SUDO @mansectsu@
|
||||||
.Os Sudo @PACKAGE_VERSION@
|
.Os Sudo @PACKAGE_VERSION@
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
.Fl h | K | k | V
|
.Fl h | K | k | V
|
||||||
.Nm sudo
|
.Nm sudo
|
||||||
.Fl v
|
.Fl v
|
||||||
.Op Fl AknS
|
.Op Fl ABknS
|
||||||
.if \n(BA \{\
|
.if \n(BA \{\
|
||||||
.Op Fl a Ar type
|
.Op Fl a Ar type
|
||||||
.\}
|
.\}
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
.Op Fl u Ar user
|
.Op Fl u Ar user
|
||||||
.Nm sudo
|
.Nm sudo
|
||||||
.Fl l
|
.Fl l
|
||||||
.Op Fl AknS
|
.Op Fl ABknS
|
||||||
.if \n(BA \{\
|
.if \n(BA \{\
|
||||||
.Op Fl a Ar type
|
.Op Fl a Ar type
|
||||||
.\}
|
.\}
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
.Op Fl u Ar user
|
.Op Fl u Ar user
|
||||||
.Op Ar command
|
.Op Ar command
|
||||||
.Nm sudo
|
.Nm sudo
|
||||||
.Op Fl AbEHnPS
|
.Op Fl ABbEHnPS
|
||||||
.if \n(BA \{\
|
.if \n(BA \{\
|
||||||
.Op Fl a Ar type
|
.Op Fl a Ar type
|
||||||
.\}
|
.\}
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
.Op Fl i | s
|
.Op Fl i | s
|
||||||
.Op Ar command
|
.Op Ar command
|
||||||
.Nm sudoedit
|
.Nm sudoedit
|
||||||
.Op Fl AknS
|
.Op Fl ABknS
|
||||||
.if \n(BA \{\
|
.if \n(BA \{\
|
||||||
.Op Fl a Ar type
|
.Op Fl a Ar type
|
||||||
.\}
|
.\}
|
||||||
@@ -208,6 +208,9 @@ This option is only available on systems that support
|
|||||||
.Bx
|
.Bx
|
||||||
authentication.
|
authentication.
|
||||||
.\}
|
.\}
|
||||||
|
.It Fl B , -bell
|
||||||
|
Ring the bell as part of the password promp when a terminal is present.
|
||||||
|
This option has no effect if an askpass program is used.
|
||||||
.It Fl b , -background
|
.It Fl b , -background
|
||||||
Run the given command in the background.
|
Run the given command in the background.
|
||||||
Note that it is not possible to use shell job control to manipulate
|
Note that it is not possible to use shell job control to manipulate
|
||||||
|
@@ -133,11 +133,12 @@ struct environment {
|
|||||||
* Note that we must disable arg permutation to support setting environment
|
* Note that we must disable arg permutation to support setting environment
|
||||||
* variables and to better support the optional arg of the -h flag.
|
* variables and to better support the optional arg of the -h flag.
|
||||||
*/
|
*/
|
||||||
static const char short_opts[] = "+Aa:bC:c:D:Eeg:Hh::iKklnPp:r:SsT:t:U:u:Vv";
|
static const char short_opts[] = "+Aa:BbC:c:D:Eeg:Hh::iKklnPp:r:SsT:t:U:u:Vv";
|
||||||
static struct option long_opts[] = {
|
static struct option long_opts[] = {
|
||||||
{ "askpass", no_argument, NULL, 'A' },
|
{ "askpass", no_argument, NULL, 'A' },
|
||||||
{ "auth-type", required_argument, NULL, 'a' },
|
{ "auth-type", required_argument, NULL, 'a' },
|
||||||
{ "background", no_argument, NULL, 'b' },
|
{ "background", no_argument, NULL, 'b' },
|
||||||
|
{ "bell", no_argument, NULL, 'B' },
|
||||||
{ "close-from", required_argument, NULL, 'C' },
|
{ "close-from", required_argument, NULL, 'C' },
|
||||||
{ "login-class", required_argument, NULL, 'c' },
|
{ "login-class", required_argument, NULL, 'c' },
|
||||||
{ "preserve-env", optional_argument, NULL, 'E' },
|
{ "preserve-env", optional_argument, NULL, 'E' },
|
||||||
@@ -317,6 +318,9 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv,
|
|||||||
case 'b':
|
case 'b':
|
||||||
SET(flags, MODE_BACKGROUND);
|
SET(flags, MODE_BACKGROUND);
|
||||||
break;
|
break;
|
||||||
|
case 'B':
|
||||||
|
SET(tgetpass_flags, TGP_BELL);
|
||||||
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
if (strtonum(optarg, 3, INT_MAX, NULL) == 0) {
|
if (strtonum(optarg, 3, INT_MAX, NULL) == 0) {
|
||||||
sudo_warnx(U_("the argument to -C must be a number greater than or equal to 3"));
|
sudo_warnx(U_("the argument to -C must be a number greater than or equal to 3"));
|
||||||
@@ -711,6 +715,8 @@ help(void)
|
|||||||
#endif
|
#endif
|
||||||
sudo_lbuf_append(&lbuf, " -b, --background %s\n",
|
sudo_lbuf_append(&lbuf, " -b, --background %s\n",
|
||||||
_("run command in the background"));
|
_("run command in the background"));
|
||||||
|
sudo_lbuf_append(&lbuf, " -B, --bell %s\n",
|
||||||
|
_("ring bell when prompting"));
|
||||||
sudo_lbuf_append(&lbuf, " -C, --close-from=num %s\n",
|
sudo_lbuf_append(&lbuf, " -C, --close-from=num %s\n",
|
||||||
_("close all file descriptors >= num"));
|
_("close all file descriptors >= num"));
|
||||||
#ifdef HAVE_LOGIN_CAP_H
|
#ifdef HAVE_LOGIN_CAP_H
|
||||||
|
@@ -86,6 +86,7 @@
|
|||||||
#define TGP_ASKPASS 0x04 /* read from askpass helper program */
|
#define TGP_ASKPASS 0x04 /* read from askpass helper program */
|
||||||
#define TGP_MASK 0x08 /* mask user input when reading */
|
#define TGP_MASK 0x08 /* mask user input when reading */
|
||||||
#define TGP_NOECHO_TRY 0x10 /* turn off echo if possible */
|
#define TGP_NOECHO_TRY 0x10 /* turn off echo if possible */
|
||||||
|
#define TGP_BELL 0x20 /* bell on password prompt */
|
||||||
|
|
||||||
/* name/value pairs for command line settings. */
|
/* name/value pairs for command line settings. */
|
||||||
struct sudo_settings {
|
struct sudo_settings {
|
||||||
|
@@ -204,6 +204,11 @@ restart:
|
|||||||
(void) sigaction(SIGTTIN, &sa, &savettin);
|
(void) sigaction(SIGTTIN, &sa, &savettin);
|
||||||
(void) sigaction(SIGTTOU, &sa, &savettou);
|
(void) sigaction(SIGTTOU, &sa, &savettou);
|
||||||
|
|
||||||
|
if (ISSET(flags, TGP_BELL) && output != STDERR_FILENO) {
|
||||||
|
/* Ring the bell if requested and there is a tty. */
|
||||||
|
if (write(output, "\a", 1) == -1)
|
||||||
|
goto restore;
|
||||||
|
}
|
||||||
if (prompt) {
|
if (prompt) {
|
||||||
if (write(output, prompt, strlen(prompt)) == -1)
|
if (write(output, prompt, strlen(prompt)) == -1)
|
||||||
goto restore;
|
goto restore;
|
||||||
|
Reference in New Issue
Block a user