rcmd.c (165903) | rcmd.c (254700) |
---|---|
1/* 2 * Copyright (c) 1983, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#if defined(LIBC_SCCS) && !defined(lint) 31static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; 32#endif /* LIBC_SCCS and not lint */ 33#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1983, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#if defined(LIBC_SCCS) && !defined(lint) 31static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; 32#endif /* LIBC_SCCS and not lint */ 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/lib/libc/net/rcmd.c 165903 2007-01-09 00:28:16Z imp $"); | 34__FBSDID("$FreeBSD: head/lib/libc/net/rcmd.c 254700 2013-08-23 13:59:47Z jilles $"); |
35 36#include "namespace.h" 37#include <sys/param.h> 38#include <sys/socket.h> 39#include <sys/stat.h> 40 41#include <netinet/in.h> 42#include <arpa/inet.h> --- 410 unchanged lines hidden (view full) --- 453 454 /* avoid alignment issue */ 455 if (rlen > sizeof(ss)) 456 return(-1); 457 memcpy(&ss, ra, rlen); 458 raddr = (struct sockaddr *)&ss; 459 460 first = 1; | 35 36#include "namespace.h" 37#include <sys/param.h> 38#include <sys/socket.h> 39#include <sys/stat.h> 40 41#include <netinet/in.h> 42#include <arpa/inet.h> --- 410 unchanged lines hidden (view full) --- 453 454 /* avoid alignment issue */ 455 if (rlen > sizeof(ss)) 456 return(-1); 457 memcpy(&ss, ra, rlen); 458 raddr = (struct sockaddr *)&ss; 459 460 first = 1; |
461 hostf = superuser ? NULL : fopen(_PATH_HEQUIV, "r"); | 461 hostf = superuser ? NULL : fopen(_PATH_HEQUIV, "re"); |
462again: 463 if (hostf) { 464 if (__ivaliduser_sa(hostf, raddr, rlen, luser, ruser) == 0) { 465 (void)fclose(hostf); 466 return (0); 467 } 468 (void)fclose(hostf); 469 } --- 6 unchanged lines hidden (view full) --- 476 477 /* 478 * Change effective uid while opening .rhosts. If root and 479 * reading an NFS mounted file system, can't read files that 480 * are protected read/write owner only. 481 */ 482 uid = geteuid(); 483 (void)seteuid(pwd->pw_uid); | 462again: 463 if (hostf) { 464 if (__ivaliduser_sa(hostf, raddr, rlen, luser, ruser) == 0) { 465 (void)fclose(hostf); 466 return (0); 467 } 468 (void)fclose(hostf); 469 } --- 6 unchanged lines hidden (view full) --- 476 477 /* 478 * Change effective uid while opening .rhosts. If root and 479 * reading an NFS mounted file system, can't read files that 480 * are protected read/write owner only. 481 */ 482 uid = geteuid(); 483 (void)seteuid(pwd->pw_uid); |
484 hostf = fopen(pbuf, "r"); | 484 hostf = fopen(pbuf, "re"); |
485 (void)seteuid(uid); 486 487 if (hostf == NULL) 488 return (-1); 489 /* 490 * If not a regular file, or is owned by someone other than 491 * user or root or if writeable by anyone but the owner, quit. 492 */ --- 269 unchanged lines hidden --- | 485 (void)seteuid(uid); 486 487 if (hostf == NULL) 488 return (-1); 489 /* 490 * If not a regular file, or is owned by someone other than 491 * user or root or if writeable by anyone but the owner, quit. 492 */ --- 269 unchanged lines hidden --- |