aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1996-12-18 20:07:49 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1996-12-18 20:07:49 +0000
commita49b39f8d4db2d4927296b134435d018e87f7eb3 (patch)
treeda921bfef97584cc8e4cfb9357517e04dd9cdc5a /gnu
parent64919fdd33d1bf27bb6e925512e7b7852e706c33 (diff)
Notes
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/man/man/man.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/gnu/usr.bin/man/man/man.c b/gnu/usr.bin/man/man/man.c
index d079604968fe..4a88c3231283 100644
--- a/gnu/usr.bin/man/man/man.c
+++ b/gnu/usr.bin/man/man/man.c
@@ -1066,7 +1066,7 @@ restore_sigs()
* 1 for success and 0 for failure.
*/
int
-make_cat_file (path, man_file, cat_file)
+make_cat_file (path, man_file, cat_file, manid)
register char *path;
register char *man_file;
register char *cat_file;
@@ -1109,8 +1109,10 @@ make_cat_file (path, man_file, cat_file)
else {
#ifdef SETREUID
- setreuid(-1, ruid);
- setregid(-1, rgid);
+ if (manid) {
+ setreuid(-1, ruid);
+ setregid(-1, rgid);
+ }
#endif
if ((pp = popen(command, "r")) == NULL) {
s = errno;
@@ -1118,8 +1120,10 @@ make_cat_file (path, man_file, cat_file)
errno = s;
perror("popen");
#ifdef SETREUID
- setreuid(-1, euid);
- setregid(-1, egid);
+ if (manid) {
+ setreuid(-1, euid);
+ setregid(-1, egid);
+ }
#endif
unlink(temp);
restore_sigs();
@@ -1127,8 +1131,10 @@ make_cat_file (path, man_file, cat_file)
return 0;
}
#ifdef SETREUID
- setreuid(-1, euid);
- setregid(-1, egid);
+ if (manid) {
+ setreuid(-1, euid);
+ setregid(-1, egid);
+ }
#endif
while ((s = getc(pp)) != EOF)
@@ -1267,10 +1273,10 @@ format_and_display (path, man_file, cat_file)
#ifdef SETREUID
setreuid(-1, euid);
setregid(-1, egid);
+ found = make_cat_file (path, man_file, cat_file, 1);
+#else
+ found = make_cat_file (path, man_file, cat_file, 0);
#endif
-
- found = make_cat_file (path, man_file, cat_file);
-
#ifdef SETREUID
setreuid(-1, ruid);
setregid(-1, rgid);
@@ -1282,7 +1288,7 @@ format_and_display (path, man_file, cat_file)
effective group (user) ID == real group (user) ID
except for the call above, I believe the problems
of reading private man pages is avoided. */
- found = make_cat_file (path, man_file, cat_file);
+ found = make_cat_file (path, man_file, cat_file, 0);
}
#endif
#ifdef SECURE_MAN_UID
@@ -1301,7 +1307,7 @@ format_and_display (path, man_file, cat_file)
*/
setuid (getuid ());
- found = make_cat_file (path, man_file, cat_file);
+ found = make_cat_file (path, man_file, cat_file, 0);
}
#endif
if (found)