about summary refs log tree commit diff
path: root/inet/rcmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'inet/rcmd.c')
-rw-r--r--inet/rcmd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/inet/rcmd.c b/inet/rcmd.c
index 0ee0c5d17f..342c1c909e 100644
--- a/inet/rcmd.c
+++ b/inet/rcmd.c
@@ -306,7 +306,6 @@ iruserok(raddr, superuser, ruser, luser)
 	struct stat sbuf;
 	struct passwd pwdbuf, *pwd;
 	FILE *hostf;
-	uid_t uid;
 	int first;
 
 	first = 1;
@@ -342,7 +341,12 @@ again:
 		if (__euidaccess (pbuf, R_OK) != 0)
 		  hostf = NULL;
 		else
-		  hostf = fopen(pbuf, "r");
+		  {
+		    uid_t uid = geteuid ();
+		    seteuid (pwd->pw_uid);
+		    hostf = fopen (pbuf, "r");
+		    seteuid (uid);
+		  }
 
 		if (hostf == NULL)
 			return (-1);