diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-02-13 22:21:12 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-02-13 22:21:12 +0000 |
commit | f381e85a1c8a8882b7f97043dae54ac839db974b (patch) | |
tree | 42964899881cffd82df87d11f9b1d54766837bbe /libexec/rlogind | |
parent | d7fa5fca0ff0386bb6f3bcda381e752e499d33f8 (diff) |
ok, i finally learned about struct ipoption
Diffstat (limited to 'libexec/rlogind')
-rw-r--r-- | libexec/rlogind/rlogind.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libexec/rlogind/rlogind.c b/libexec/rlogind/rlogind.c index 30f366f6507..42670479b48 100644 --- a/libexec/rlogind/rlogind.c +++ b/libexec/rlogind/rlogind.c @@ -39,7 +39,7 @@ static char copyright[] = #ifndef lint /* from: static char sccsid[] = "@(#)rlogind.c 8.1 (Berkeley) 6/4/93"; */ -static char *rcsid = "$Id: rlogind.c,v 1.16 1997/02/05 21:09:30 deraadt Exp $"; +static char *rcsid = "$Id: rlogind.c,v 1.17 1997/02/13 22:21:10 deraadt Exp $"; #endif /* not lint */ /* @@ -62,6 +62,7 @@ static char *rcsid = "$Id: rlogind.c,v 1.16 1997/02/05 21:09:30 deraadt Exp $"; #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/ip.h> +#include <netinet/ip_var.h> #include <arpa/inet.h> #include <netdb.h> @@ -258,23 +259,24 @@ doit(f, 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, + if (getsockopt(0, ipproto, IP_OPTIONS, (char *)&opts, &optsize) == 0 && 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]; } } } |