mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 12:51:23 +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);
|
given = mallocstrcpy(given, answer);
|
||||||
|
|
||||||
#ifdef ENABLE_BROWSER
|
#ifdef ENABLE_BROWSER
|
||||||
if (function == to_files) {
|
if (function == to_files && !ISSET(RESTRICTED)) {
|
||||||
char *chosen = browse_in(answer);
|
char *chosen = browse_in(answer);
|
||||||
|
|
||||||
if (chosen == NULL)
|
if (chosen == NULL)
|
||||||
@ -2213,10 +2213,10 @@ int write_it_out(bool exiting, bool withprompt)
|
|||||||
} else if (function == mac_format) {
|
} else if (function == mac_format) {
|
||||||
openfile->fmt = (openfile->fmt == MAC_FILE) ? NIX_FILE : MAC_FILE;
|
openfile->fmt = (openfile->fmt == MAC_FILE) ? NIX_FILE : MAC_FILE;
|
||||||
continue;
|
continue;
|
||||||
} else if (function == back_it_up) {
|
} else if (function == back_it_up && !ISSET(RESTRICTED)) {
|
||||||
TOGGLE(MAKE_BACKUP);
|
TOGGLE(MAKE_BACKUP);
|
||||||
continue;
|
continue;
|
||||||
} else if (function == prepend_it || function == append_it) {
|
} else if ((function == prepend_it || function == append_it) && !ISSET(RESTRICTED)) {
|
||||||
if (function == prepend_it)
|
if (function == prepend_it)
|
||||||
method = (method == PREPEND) ? OVERWRITE : PREPEND;
|
method = (method == PREPEND) ? OVERWRITE : PREPEND;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user