summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/ruserok.c
diff options
context:
space:
mode:
authorguenther <>2014-09-15 06:15:48 +0000
committerguenther <>2014-09-15 06:15:48 +0000
commit6fa5c415aa0acdbeb8a8b9beba390518489304ab (patch)
treead712f134771158fecd87a78b6c147ee2b1a2261 /src/lib/libc/net/ruserok.c
parent942d3f7f21b3d5906968b93cbb26de97a8979084 (diff)
downloadopenbsd-6fa5c415aa0acdbeb8a8b9beba390518489304ab.tar.gz
openbsd-6fa5c415aa0acdbeb8a8b9beba390518489304ab.tar.bz2
openbsd-6fa5c415aa0acdbeb8a8b9beba390518489304ab.zip
When fopen()ing internal to libc (the API doesn't support the use
of the resulting FILE *), then pass fopen() the 'e' mode letter to mark it close-on-exec. ok miod@
Diffstat (limited to 'src/lib/libc/net/ruserok.c')
-rw-r--r--src/lib/libc/net/ruserok.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libc/net/ruserok.c b/src/lib/libc/net/ruserok.c
index 21646c156b..4d0adfbe4e 100644
--- a/src/lib/libc/net/ruserok.c
+++ b/src/lib/libc/net/ruserok.c
@@ -118,7 +118,7 @@ iruserok_sa(const void *raddr, int rlen, int superuser, const char *ruser,
118 118
119 sa = (struct sockaddr *)raddr; 119 sa = (struct sockaddr *)raddr;
120 first = 1; 120 first = 1;
121 hostf = superuser ? NULL : fopen(_PATH_HEQUIV, "r"); 121 hostf = superuser ? NULL : fopen(_PATH_HEQUIV, "re");
122again: 122again:
123 if (hostf) { 123 if (hostf) {
124 if (__ivaliduser_sa(hostf, sa, rlen, luser, ruser) == 0) { 124 if (__ivaliduser_sa(hostf, sa, rlen, luser, ruser) == 0) {
@@ -144,7 +144,7 @@ again:
144 */ 144 */
145 uid = geteuid(); 145 uid = geteuid();
146 (void)seteuid(pwd->pw_uid); 146 (void)seteuid(pwd->pw_uid);
147 hostf = fopen(pbuf, "r"); 147 hostf = fopen(pbuf, "re");
148 (void)seteuid(uid); 148 (void)seteuid(uid);
149 149
150 if (hostf == NULL) 150 if (hostf == NULL)