*.*::
Repeat previous command.
+== SECURITY
+
+When either MORESECURE or PAGERSECURE is set, *more* will run in "secure" mode and effectively disable the following commands:
+
+*!command* or *:!command*::
+Execute _command_ in a subshell.
+
+*v*::
+Start up an editor.
+
== ENVIRONMENT
The *more* command respects the following environment variables, if they exist:
*POSIXLY_CORRECT*::
Disable exit-on-eof (see option *-e* for more details).
+*MORESECURE*::
+Run *more* in "secure" mode. See SECURITY for details.
+
+*PAGERSECURE*::
+Equivalent to MORESECURE.
+
== HISTORY
The *more* command appeared in 3.0BSD. This man page documents *more* version 5.19 (Berkeley 6/29/88), which is currently in use in the Linux community. Documentation was produced using several other versions of the man page, and extensive inspection of the source code.
Modified by John Foderaro, UCB to add -c and MORE environment variable.
+Modified by Christian Goeschel Ndjomouo to add MORESECURE and PAGERSECURE environment variables, and a SECURITY section
+
== SEE ALSO
*less*(1),
* present curses can still be used.
* 2010-10-21 Davidlohr Bueso <dave@gnu.org>
* modified mem allocation handling for util-linux
+ * 2025-04-03 Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
+ * modified to add MORESECURE and PAGERSECURE environment variables
*/
#include <stdio.h>
leading_colon, /* key command has leading ':' character */
is_eof, /* EOF detected */
is_paused, /* is output paused */
+ is_secure, /* is running in secure mode */
no_quit_dialog, /* suppress quit dialog */
no_scroll, /* do not scroll, clear the screen and then display text */
no_tty_in, /* is input in interactive mode */
done = 1;
break;
case more_kc_run_shell:
- run_shell(ctl, filename);
- break;
+ if (ctl->is_secure == 1) {
+ more_error(ctl, _("Command not available in secure mode"));
+ break;
+ } else {
+ run_shell(ctl, filename);
+ break;
+ }
case more_kc_help:
if (ctl->no_scroll)
more_clear_screen(ctl);
done = 1;
break;
case more_kc_run_editor: /* This case should go right before default */
- if (!ctl->no_tty_in) {
+ if (ctl->is_secure == 1) {
+ more_error(ctl, _("Command not available in secure mode"));
+ break;
+ }
+ if (!ctl->no_tty_in) {
execute_editor(ctl, cmdbuf, sizeof(cmdbuf), filename);
break;
}
ctl.exit_on_eof = getenv("POSIXLY_CORRECT") ? 0 : 1;
+ if (getenv("MORESECURE") || getenv("PAGERSECURE"))
+ ctl.is_secure = 1;
+
if ((s = getenv("MORE")) != NULL)
env_argscan(&ctl, s);