mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-25 22:29:42 +03:00
files: with --rectrict, prevent invoking the browser and toggling backups
Prevent also the toggling of Append and Prepend. All four functions should not be available in restricted mode, and are absent from the WriteOut menu in that mode, but using {browser}, {backup}, {append} or {prepend} in a string bind allowed to bypass the menu checks. This fixes https://savannah.gnu.org/bugs/?65819. Problem existed since version 7.0, since braced function names were introduced.
This commit is contained in:
parent
ea07eb6aa3
commit
689748843c
@ -2196,7 +2196,7 @@ int write_it_out(bool exiting, bool withprompt)
|
||||
given = mallocstrcpy(given, answer);
|
||||
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (function == to_files) {
|
||||
if (function == to_files && !ISSET(RESTRICTED)) {
|
||||
char *chosen = browse_in(answer);
|
||||
|
||||
if (chosen == NULL)
|
||||
@ -2213,10 +2213,10 @@ int write_it_out(bool exiting, bool withprompt)
|
||||
} else if (function == mac_format) {
|
||||
openfile->fmt = (openfile->fmt == MAC_FILE) ? NIX_FILE : MAC_FILE;
|
||||
continue;
|
||||
} else if (function == back_it_up) {
|
||||
} else if (function == back_it_up && !ISSET(RESTRICTED)) {
|
||||
TOGGLE(MAKE_BACKUP);
|
||||
continue;
|
||||
} else if (function == prepend_it || function == append_it) {
|
||||
} else if ((function == prepend_it || function == append_it) && !ISSET(RESTRICTED)) {
|
||||
if (function == prepend_it)
|
||||
method = (method == PREPEND) ? OVERWRITE : PREPEND;
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user