summaryrefslogtreecommitdiff
path: root/libexec/rshd
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-02-13 22:21:12 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-02-13 22:21:12 +0000
commitf381e85a1c8a8882b7f97043dae54ac839db974b (patch)
tree42964899881cffd82df87d11f9b1d54766837bbe /libexec/rshd
parentd7fa5fca0ff0386bb6f3bcda381e752e499d33f8 (diff)
ok, i finally learned about struct ipoption
Diffstat (limited to 'libexec/rshd')
-rw-r--r--libexec/rshd/rshd.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libexec/rshd/rshd.c b/libexec/rshd/rshd.c
index 2ac2bf24ccb..c4ab99d8c9a 100644
--- a/libexec/rshd/rshd.c
+++ b/libexec/rshd/rshd.c
@@ -39,7 +39,7 @@ static char copyright[] =
#ifndef lint
/* from: static char sccsid[] = "@(#)rshd.c 8.2 (Berkeley) 4/6/94"; */
-static char *rcsid = "$Id: rshd.c,v 1.13 1997/02/05 21:09:29 deraadt Exp $";
+static char *rcsid = "$Id: rshd.c,v 1.14 1997/02/13 22:21:08 deraadt Exp $";
#endif /* not lint */
/*
@@ -58,6 +58,7 @@ static char *rcsid = "$Id: rshd.c,v 1.13 1997/02/05 21:09:29 deraadt Exp $";
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>
+#include <netinet/ip_var.h>
#include <arpa/inet.h>
#include <netdb.h>
@@ -238,23 +239,23 @@ doit(fromp)
}
#ifdef IP_OPTIONS
{
- u_char optbuf[BUFSIZ/3];
- int optsize = sizeof(optbuf), ipproto, i;
+ struct ipoption opts;
+ int optsize = sizeof(opts), ipproto, i;
struct protoent *ip;
if ((ip = getprotobyname("ip")) != NULL)
ipproto = ip->p_proto;
else
ipproto = IPPROTO_IP;
- if (!getsockopt(0, ipproto, IP_OPTIONS, (char *)optbuf, &optsize) &&
+ if (!getsockopt(0, ipproto, IP_OPTIONS, (char *)&opts, &optsize) &&
optsize != 0) {
for (i = 0; i < optsize; ) {
- u_char c = optbuf[i];
+ u_char c = (u_char)opts.ipopt_list[i];
if (c == IPOPT_LSRR || c == IPOPT_SSRR)
exit(1);
if (c == IPOPT_EOL)
break;
- i += (c == IPOPT_NOP) ? 1 : optbuf[i+1];
+ i += (c == IPOPT_NOP) ? 1 : (u_char)opts.ipopt_list[i+1];
}
}
}