View | Details | Raw Unified | Return to bug 185551
Collapse All | Expand All

(-)b/lib/libc/net/rcmd.c (-1 / +3 lines)
Lines 447-452 Link Here
447
	FILE *hostf;
447
	FILE *hostf;
448
	uid_t uid;
448
	uid_t uid;
449
	int first;
449
	int first;
450
	int hostlstat;
450
	char pbuf[MAXPATHLEN];
451
	char pbuf[MAXPATHLEN];
451
	const struct sockaddr *raddr;
452
	const struct sockaddr *raddr;
452
	struct sockaddr_storage ss;
453
	struct sockaddr_storage ss;
Lines 482-487 Link Here
482
		uid = geteuid();
483
		uid = geteuid();
483
		(void)seteuid(pwd->pw_uid);
484
		(void)seteuid(pwd->pw_uid);
484
		hostf = fopen(pbuf, "r");
485
		hostf = fopen(pbuf, "r");
486
		hostlstat = lstat(pbuf, &sbuf);
485
		(void)seteuid(uid);
487
		(void)seteuid(uid);
486
488
487
		if (hostf == NULL)
489
		if (hostf == NULL)
Lines 491-497 Link Here
491
		 * user or root or if writeable by anyone but the owner, quit.
493
		 * user or root or if writeable by anyone but the owner, quit.
492
		 */
494
		 */
493
		cp = NULL;
495
		cp = NULL;
494
		if (lstat(pbuf, &sbuf) < 0)
496
		if (hostlstat < 0)
495
			cp = ".rhosts lstat failed";
497
			cp = ".rhosts lstat failed";
496
		else if (!S_ISREG(sbuf.st_mode))
498
		else if (!S_ISREG(sbuf.st_mode))
497
			cp = ".rhosts not regular file";
499
			cp = ".rhosts not regular file";

Return to bug 185551