Fill in sin_len.

This commit is contained in:
mycroft 1995-06-03 22:24:45 +00:00
parent 89ef25dac6
commit c7ad9c47f1
4 changed files with 22 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: netdate.c,v 1.8 1995/03/21 09:03:54 cgd Exp $ */
/* $NetBSD: netdate.c,v 1.9 1995/06/03 22:24:45 mycroft Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)netdate.c 8.1 (Berkeley) 5/31/93";
#else
static char rcsid[] = "$NetBSD: netdate.c,v 1.8 1995/03/21 09:03:54 cgd Exp $";
static char rcsid[] = "$NetBSD: netdate.c,v 1.9 1995/06/03 22:24:45 mycroft Exp $";
#endif
#endif /* not lint */
@ -89,9 +89,10 @@ netsettime(tval)
}
memset(&dest, 0, sizeof(dest));
dest.sin_port = sp->s_port;
dest.sin_len = sizeof(struct sockaddr_in);
dest.sin_family = AF_INET;
dest.sin_addr.s_addr = htonl((u_long)INADDR_ANY);
dest.sin_port = sp->s_port;
dest.sin_addr.s_addr = htonl(INADDR_ANY);
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0) {
if (errno != EPROTONOSUPPORT)
@ -100,6 +101,7 @@ netsettime(tval)
}
memset(&sin, 0, sizeof(sin));
sin.sin_len = sizeof(struct sockaddr_in);
sin.sin_family = AF_INET;
for (port = IPPORT_RESERVED - 1; port > IPPORT_RESERVED / 2; port--) {
sin.sin_port = htons((u_short)port);

View File

@ -26,7 +26,7 @@
#include "uucp.h"
#if USE_RCS_ID
const char tcp_rcsid[] = "$Id: tcp.c,v 1.2 1994/10/24 22:17:27 jtc Exp $";
const char tcp_rcsid[] = "$Id: tcp.c,v 1.3 1995/06/03 22:26:24 mycroft Exp $";
#endif
#if HAVE_TCP
@ -189,6 +189,7 @@ ftcp_open (qconn, ibaud, fwait)
return if we have received a connection. It would be more robust
to respawn the server if it fails; someday. */
bzero ((pointer) &s, sizeof s);
s.sin_len = sizeof(struct sockaddr_in);
s.sin_family = AF_INET;
zport = qconn->qport->uuconf_u.uuconf_stcp.uuconf_zport;
s.sin_port = itcp_port_number (zport);
@ -408,6 +409,7 @@ ftcp_dial (qconn, puuconf, qsys, zphone, qdialer, ptdialer)
return FALSE;
}
s.sin_len = sizeof(struct sockaddr_in);
s.sin_family = q->h_addrtype;
memcpy (&s.sin_addr.s_addr, q->h_addr, (size_t) q->h_length);
zport = qconn->qport->uuconf_u.uuconf_stcp.uuconf_zport;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rcmd.c,v 1.11 1995/02/25 06:20:53 cgd Exp $ */
/* $NetBSD: rcmd.c,v 1.12 1995/06/03 22:33:34 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993, 1994
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94";
#else
static char *rcsid = "$NetBSD: rcmd.c,v 1.11 1995/02/25 06:20:53 cgd Exp $";
static char *rcsid = "$NetBSD: rcmd.c,v 1.12 1995/06/03 22:33:34 mycroft Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@ -97,9 +97,10 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
return (-1);
}
fcntl(s, F_SETOWN, pid);
sin.sin_len = sizeof(struct sockaddr_in);
sin.sin_family = hp->h_addrtype;
bcopy(hp->h_addr_list[0], &sin.sin_addr, hp->h_length);
sin.sin_port = rport;
bcopy(hp->h_addr_list[0], &sin.sin_addr, hp->h_length);
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
break;
(void)close(s);
@ -174,7 +175,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
goto bad;
}
*fd2p = s3;
from.sin_port = ntohs((u_short)from.sin_port);
from.sin_port = ntohs(from.sin_port);
if (from.sin_family != AF_INET ||
from.sin_port >= IPPORT_RESERVED ||
from.sin_port < IPPORT_RESERVED / 2) {
@ -217,6 +218,7 @@ rresvport(alport)
struct sockaddr_in sin;
int s;
sin.sin_len = sizeof(struct sockaddr_in);
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
s = socket(AF_INET, SOCK_STREAM, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: res_init.c,v 1.7 1995/02/25 06:20:57 cgd Exp $ */
/* $NetBSD: res_init.c,v 1.8 1995/06/03 22:33:36 mycroft Exp $ */
/*-
* Copyright (c) 1985, 1989, 1993
@ -58,7 +58,7 @@
static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
static char rcsid[] = "$Id: res_init.c,v 4.9.1.1 1993/05/02 22:43:03 vixie Rel ";
#else
static char rcsid[] = "$NetBSD: res_init.c,v 1.7 1995/02/25 06:20:57 cgd Exp $";
static char rcsid[] = "$NetBSD: res_init.c,v 1.8 1995/06/03 22:33:36 mycroft Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@ -109,13 +109,14 @@ res_init()
int nsort = 0;
u_long mask;
_res.nsaddr.sin_len = sizeof(struct sockaddr_in);
_res.nsaddr.sin_family = AF_INET;
_res.nsaddr.sin_port = htons(NAMESERVER_PORT);
#ifdef USELOOPBACK
_res.nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
#else
_res.nsaddr.sin_addr.s_addr = INADDR_ANY;
#endif
_res.nsaddr.sin_family = AF_INET;
_res.nsaddr.sin_port = htons(NAMESERVER_PORT);
_res.nscount = 1;
_res.ndots = 1;
_res.pfcode = 0;
@ -254,10 +255,11 @@ res_init()
while (*cp == ' ' || *cp == '\t')
cp++;
if ((*cp != '\0') && (*cp != '\n') && inet_aton(cp, &a)) {
_res.nsaddr_list[nserv].sin_addr = a;
_res.nsaddr_list[nserv].sin_len = sizeof(struct sockaddr_in);
_res.nsaddr_list[nserv].sin_family = AF_INET;
_res.nsaddr_list[nserv].sin_port =
htons(NAMESERVER_PORT);
_res.nsaddr_list[nserv].sin_addr = a;
nserv++;
}
continue;