mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-01 10:06:57 +03:00
update from main archive 961201
Mon Dec 2 03:59:38 1996 Ulrich Drepper <drepper@cygnus.com> * grp/initgroups.c: Update and reformat copyright. Use __getgrent_r instead of getgrent. * inet/rcmd.c: Update and reformat copyright. Use __gethostbyname_r instead of gethostbyname. * inet/rexec.c: Likewise. * intl/finddomain.c: Correct comment about CEN sponsor and revision. * locale/findlocale.c: Likewise. * intl/l10nflist.c: Correct handling of CEN sponsor and revision. * locale/Makefile (CPPFLAGS): Add definition of LOCALEDIR. * locale/setlocale.c (setlocale): Correctly split value of LOCALE_PATH. * locale/programs/localedef.c: Use LOCALEDIR not LOCALE_PATH to find output directory. * nss/getXXbyYY.c [NEED_H_ERRNO]: Before enlarging buffer test h_errno_tmp variable. Save error value from being changed during `free' call. * nss/getXXent.c: Likewise. * nss/nss_files/files-XXX.c: Set h_errno variable to NETDB_INTERNAL before returning ERANGE error. * posix/glob.c: Use getlogin_r and getpwnam_r function when available or in GNU libc. * pwd/getpw.c: Use getpwuid_r instead of getpwuid. * sunrpc/clnt_gen.c: Use gethostbyname_r and getprotobyname_r. * sunrpc/clnt_simp.c: Likewise. * sunrpc/getrpcport.c: Likewise. * sysdeps/unix/sysv/linux/gethostid.c: Likewise. * posix/getconf.c: Treat _SC_UNIT_MAX and _SC_ULONG_MAX separately since the value might be outsode the range of the `long int'. Print string `undefined' when a value is undefined. * stdlib/l64a.c: Return correct pointer. Patch by NIIBE Yutaka <gniibe@mri.co.jp>. * string/Makefile (routines): Add argz-addsep. * string/argz-addsep.c: New file. * string/argz.h: Add prototypes for argz_add_sep. * string/argz-ctsep.c: Prevent memory leak. * string/strcoll.c: Correct typo in comment. Sat Nov 30 02:53:59 1996 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/sys/serial.h: Removed again. The file is not general enough to be part of the libc. * sysdeps/unix/sysv/linux/Dist: Remove sys/serial.h. * sysdeps/unix/sysv/linux/Makefile: Don't install sys/serial.h. Thu Nov 28 20:04:41 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * login/Makefile: Fix typo. * nss/Makefile (generated): Filter out db-alias.c. Thu Nov 28 14:44:01 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * time/Makefile (echo-zonenames): Don't depend on non-existing target `zonenames'. Thu Nov 28 12:34:05 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * link.h: New file. * nss/nsswitch.c: Use it. * printf.h: Fix file name. * stdlib/strfmon.c: Use it.
This commit is contained in:
76
inet/rcmd.c
76
inet/rcmd.c
@ -42,6 +42,7 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94";
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <alloca.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <netdb.h>
|
||||
@ -63,20 +64,35 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
|
||||
const char *locuser, *remuser, *cmd;
|
||||
int *fd2p;
|
||||
{
|
||||
struct hostent *hp;
|
||||
struct hostent hostbuf, *hp;
|
||||
size_t hstbuflen;
|
||||
char *tmphstbuf;
|
||||
struct sockaddr_in sin, from;
|
||||
fd_set reads;
|
||||
int32_t oldmask;
|
||||
pid_t pid;
|
||||
int s, lport, timo;
|
||||
char c;
|
||||
int herr;
|
||||
|
||||
pid = getpid();
|
||||
hp = gethostbyname(*ahost);
|
||||
if (hp == NULL) {
|
||||
herror(*ahost);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
hstbuflen = 1024;
|
||||
tmphstbuf = __alloca (hstbuflen);
|
||||
while (__gethostbyname_r (*ahost, &hostbuf, tmphstbuf, hstbuflen,
|
||||
&hp, &herr) < 0)
|
||||
if (herr != NETDB_INTERNAL || errno != ERANGE)
|
||||
{
|
||||
herror(*ahost);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Enlarge the buffer. */
|
||||
hstbuflen *= 2;
|
||||
tmphstbuf = __alloca (hstbuflen);
|
||||
}
|
||||
|
||||
*ahost = hp->h_name;
|
||||
oldmask = sigblock(sigmask(SIGURG));
|
||||
for (timo = 1, lport = IPPORT_RESERVED - 1;;) {
|
||||
@ -244,12 +260,27 @@ ruserok(rhost, superuser, ruser, luser)
|
||||
const char *rhost, *ruser, *luser;
|
||||
int superuser;
|
||||
{
|
||||
struct hostent *hp;
|
||||
struct hostent hostbuf, *hp;
|
||||
size_t buflen;
|
||||
char *buffer;
|
||||
u_int32_t addr;
|
||||
char **ap;
|
||||
int herr;
|
||||
|
||||
buflen = 1024;
|
||||
buffer = __alloca (buflen);
|
||||
|
||||
while (__gethostbyname_r (rhost, &hostbuf, buffer, buflen, &hp, &herr)
|
||||
< 0)
|
||||
if (herr != NETDB_INTERNAL || errno != ERANGE)
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
/* Enlarge the buffer. */
|
||||
buflen *= 2;
|
||||
buffer = __alloca (buflen);
|
||||
}
|
||||
|
||||
if ((hp = gethostbyname(rhost)) == NULL)
|
||||
return (-1);
|
||||
for (ap = hp->h_addr_list; *ap; ++ap) {
|
||||
bcopy(*ap, &addr, sizeof(addr));
|
||||
if (iruserok(addr, superuser, ruser, luser) == 0)
|
||||
@ -275,7 +306,7 @@ iruserok(raddr, superuser, ruser, luser)
|
||||
{
|
||||
register char *cp;
|
||||
struct stat sbuf;
|
||||
struct passwd *pwd;
|
||||
struct passwd pwdbuf, *pwd;
|
||||
FILE *hostf;
|
||||
uid_t uid;
|
||||
int first;
|
||||
@ -293,10 +324,12 @@ again:
|
||||
if (first == 1 && (__check_rhosts_file || superuser)) {
|
||||
char *pbuf;
|
||||
size_t dirlen;
|
||||
size_t buflen = __sysconf (_SC_GETPW_R_SIZE_MAX);
|
||||
char buffer = __alloca (buflen);
|
||||
|
||||
first = 0;
|
||||
if ((pwd = getpwnam(luser)) == NULL)
|
||||
return (-1);
|
||||
if (getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) < 0)
|
||||
return -1;
|
||||
|
||||
dirlen = strlen (pwd->pw_dir);
|
||||
pbuf = alloca (dirlen + sizeof "/.rhosts");
|
||||
@ -395,17 +428,30 @@ __icheckhost(raddr, lhost)
|
||||
u_int32_t raddr;
|
||||
register char *lhost;
|
||||
{
|
||||
register struct hostent *hp;
|
||||
register struct hostent hostbuf, *hp;
|
||||
size_t buflen;
|
||||
char *buffer;
|
||||
register u_int32_t laddr;
|
||||
register char **pp;
|
||||
int herr;
|
||||
|
||||
/* Try for raw ip address first. */
|
||||
if (isdigit(*lhost) && (int32_t)(laddr = inet_addr(lhost)) != -1)
|
||||
return (raddr == laddr);
|
||||
|
||||
/* Better be a hostname. */
|
||||
if ((hp = gethostbyname(lhost)) == NULL)
|
||||
return (0);
|
||||
buflen = 1024;
|
||||
buffer = __alloca (buflen);
|
||||
while (__gethostbyname_r (lhost, &hostbuf, buffer, buflen, &hp, &herr)
|
||||
< 0)
|
||||
if (herr != NETDB_INTERNAL || errno != ERANGE)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
/* Enlarge the buffer. */
|
||||
buflen *= 2;
|
||||
buflen = __alloca (buflen);
|
||||
}
|
||||
|
||||
/* Spin through ip addresses. */
|
||||
for (pp = hp->h_addr_list; *pp; ++pp)
|
||||
|
Reference in New Issue
Block a user