-# $OpenBSD: Makefile,v 1.6 1996/07/20 12:02:03 joshd Exp $
+# $OpenBSD: Makefile,v 1.7 1996/12/15 23:20:32 millert Exp $
# $NetBSD: Makefile,v 1.12 1996/03/19 03:03:04 jtc Exp $
PROG= pppd
-SRCS= main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c ccp.c \
+SRCS= main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c ccp.c \
auth.c options.c sys-bsd.c demand.c gencode.c grammar.c scanner.c \
- nametoaddr.c optimize.c bpf_filter.c chap_ms.c ipxcp.c md4.c
+ nametoaddr.c optimize.c bpf_filter.c chap_ms.c ipxcp.c
.PATH: ${.CURDIR}/../../lib/libpcap ${.CURDIR}/../../sys/net
MAN= pppd.8
SUBDIR= pppstats chat
-/* $OpenBSD: auth.c,v 1.4 1996/07/20 12:02:04 joshd Exp $ */
+/* $OpenBSD: auth.c,v 1.5 1996/12/15 23:20:33 millert Exp $ */
/*
* auth.c - PPP authentication and phase control.
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: auth.c,v 1.4 1996/07/20 12:02:04 joshd Exp $";
+static char rcsid[] = "$OpenBSD: auth.c,v 1.5 1996/12/15 23:20:33 millert Exp $";
#endif
#include <stdio.h>
u_int32_t addr;
struct wordlist *addrs;
{
- u_int32_t a, mask, ah;
- int accept;
+ u_int32_t mask, ah;
+ struct in_addr ina;
+ int accept, r = 1;
char *ptr_word, *ptr_mask;
struct hostent *hp;
struct netent *np;
hp = gethostbyname(ptr_word);
if (hp != NULL && hp->h_addrtype == AF_INET) {
- a = *(u_int32_t *)hp->h_addr;
+ ina.s_addr = *(u_int32_t *)hp->h_addr;
mask = ~ (u_int32_t) 0; /* are we sure we want this? */
} else {
np = getnetbyname (ptr_word);
if (np != NULL && np->n_addrtype == AF_INET)
- a = htonl (*(u_int32_t *)np->n_net);
+ ina.s_addr = htonl (*(u_int32_t *)np->n_net);
else
- a = inet_addr (ptr_word);
+ r = inet_aton (ptr_word, &ina);
if (ptr_mask == NULL) {
/* calculate appropriate mask for net */
- ah = ntohl(a);
+ ah = ntohl(ina.s_addr);
if (IN_CLASSA(ah))
mask = IN_CLASSA_NET;
else if (IN_CLASSB(ah))
if (ptr_mask != NULL)
*ptr_mask = '/';
- if (a == -1L)
+ if (r == 0)
syslog (LOG_WARNING,
"unknown host %s in auth. address list",
addrs->word);
else
- if (((addr ^ a) & htonl(mask)) == 0)
+ if (((addr ^ ina.s_addr) & htonl(mask)) == 0)
return accept;
}
return 0; /* not in list => can't have it */
-/* $OpenBSD: options.c,v 1.4 1996/07/20 12:02:13 joshd Exp $ */
+/* $OpenBSD: options.c,v 1.5 1996/12/15 23:20:34 millert Exp $ */
/*
* options.c - handles option processing for PPP.
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: options.c,v 1.4 1996/07/20 12:02:13 joshd Exp $";
+static char rcsid[] = "$OpenBSD: options.c,v 1.5 1996/12/15 23:20:34 millert Exp $";
#endif
#include <ctype.h>
{
struct hostent *hp;
char *colon;
+ struct in_addr ina;
u_int32_t local, remote;
ipcp_options *wo = &ipcp_wantoptions[0];
*/
if (colon != arg) {
*colon = '\0';
- if ((local = inet_addr(arg)) == -1) {
+ if (inet_aton(arg, &ina) == 0) {
if ((hp = gethostbyname(arg)) == NULL) {
option_error("unknown host: %s", arg);
return -1;
our_name[MAXNAMELEN-1] = 0;
}
}
- }
+ } else
+ local = ina.s_addr;
if (bad_ip_adrs(local)) {
option_error("bad local IP address %s", ip_ntoa(local));
return -1;
* If colon last character, then no remote addr.
*/
if (*++colon != '\0') {
- if ((remote = inet_addr(colon)) == -1) {
+ if (inet_aton(colon, &ina) == 0) {
if ((hp = gethostbyname(colon)) == NULL) {
option_error("unknown host: %s", colon);
return -1;
remote_name[MAXNAMELEN-1] = 0;
}
}
- }
+ } else
+ remote = ina.s_addr;
if (bad_ip_adrs(remote)) {
option_error("bad remote IP address %s", ip_ntoa(remote));
return -1;
setnetmask(argv)
char **argv;
{
- u_int32_t mask;
+ struct in_addr ina;
- if ((mask = inet_addr(*argv)) == -1 || (netmask & ~mask) != 0) {
+ if (inet_aton(*argv, &ina) == 0 || (netmask & ~ina.s_addr) != 0) {
option_error("invalid netmask value '%s'", *argv);
return 0;
}
- netmask = mask;
+ netmask = ina.s_addr;
return (1);
}
u_int32_t dns;
struct hostent *hp;
- dns = inet_addr(*argv);
- if (dns == -1) {
+ if (inet_aton(*argv, &dns) == 0) {
if ((hp = gethostbyname(*argv)) == NULL) {
option_error("invalid address parameter '%s' for ms-dns option",
*argv);