diff -u -r1.35 -r1.36 --- src/files.c 2001/01/09 21:12:40 1.35 +++ src/files.c 2001/01/27 20:22:00 1.36 @@ -2297,7 +2297,7 @@ * * Allow the user to "save" the current file. XXX XXX XXX */ -bool show_file(cptr name, cptr what, int line, int mode) +static bool show_file_aux(cptr name, cptr what, int line, int mode) { int i, k, n; @@ -2687,7 +2687,7 @@ strcpy(ftmp, "help.hlp"); if (askfor_aux(ftmp, 80)) { - if (!show_file(ftmp, NULL, 0, mode)) ch = ESCAPE; + if (!show_file_aux(ftmp, NULL, 0, mode)) ch = ESCAPE; } } @@ -2735,7 +2735,7 @@ if (menu && isdigit(ch) && hook[D2I(ch)][0]) { /* Recurse on that file */ - if (!show_file(hook[D2I(ch)], NULL, 0, mode)) ch = ESCAPE; + if (!show_file_aux(hook[D2I(ch)], NULL, 0, mode)) ch = ESCAPE; } /* Exit on escape */ @@ -2747,6 +2747,27 @@ /* Done */ return (ch != ESCAPE); +} + + +/* + * Secure interface to show_file_aux() + */ +bool show_file(cptr name, cptr what, int line, int mode) +{ + bool result; + + /* Drop priv's */ + safe_setuid_drop(); + + /* Show the file */ + result = show_file_aux(name, what, line, mode); + + /* Grab priv's */ + safe_setuid_grab(); + + /* Done */ + return (result); }