summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-03-01 19:29:44 +0000
committerphk <phk@FreeBSD.org>1996-03-01 19:29:44 +0000
commit8bc36c3dbc3c59e9d8632ddda344652ff44d3ec1 (patch)
tree1c9cbef7f7c1e9feb2933a403aacaa972df34957 /usr.sbin
parent0d3859fc4832bd1d80625f81b97b1e37cc44bb93 (diff)
downloadFreeBSD-src-8bc36c3dbc3c59e9d8632ddda344652ff44d3ec1.zip
FreeBSD-src-8bc36c3dbc3c59e9d8632ddda344652ff44d3ec1.tar.gz
Use libmd.
Add support for negotiating (more like "informing peer") about DNS. Various cleanup of warnings.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pppd/Makefile8
-rw-r--r--usr.sbin/pppd/args.h8
-rw-r--r--usr.sbin/pppd/auth.c5
-rw-r--r--usr.sbin/pppd/chap.c14
-rw-r--r--usr.sbin/pppd/ipcp.c52
-rw-r--r--usr.sbin/pppd/ipcp.h6
-rw-r--r--usr.sbin/pppd/md5.c304
-rw-r--r--usr.sbin/pppd/md5.h58
-rw-r--r--usr.sbin/pppd/options.c46
-rw-r--r--usr.sbin/pppd/pppd.810
-rw-r--r--usr.sbin/pppd/pppd.h4
-rw-r--r--usr.sbin/pppd/sys-bsd.c3
12 files changed, 133 insertions, 385 deletions
diff --git a/usr.sbin/pppd/Makefile b/usr.sbin/pppd/Makefile
index 098cc4a..4735613 100644
--- a/usr.sbin/pppd/Makefile
+++ b/usr.sbin/pppd/Makefile
@@ -1,10 +1,10 @@
-# $Id: Makefile.bsd,v 1.7 1995/04/27 00:19:50 paulus Exp $
+# $Id: Makefile,v 1.2 1995/10/31 21:20:42 peter Exp $
BINDIR?= /usr/sbin
CFLAGS+= -I.. -DHAVE_PATHS_H
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
MAN8= pppd.8
# The next line is for NetBSD-current systems.
@@ -12,7 +12,7 @@ MAN= pppd.cat8
BINMODE=4555
BINOWN= root
-LDADD= -lcrypt -lutil
-DPADD= ${LIBCRYPT} ${LIBUTIL}
+LDADD= -lcrypt -lutil -lmd
+DPADD= ${LIBCRYPT} ${LIBUTIL} ${LIBMD}
.include <bsd.prog.mk>
diff --git a/usr.sbin/pppd/args.h b/usr.sbin/pppd/args.h
index e879838..e767212 100644
--- a/usr.sbin/pppd/args.h
+++ b/usr.sbin/pppd/args.h
@@ -1,12 +1,12 @@
/*
* neat macro from ka9q to "do the right thing" with ansi prototypes
- * $Id: args.h,v 1.1 1993/11/11 03:54:25 paulus Exp $
+ * $Id: args.h,v 1.2 1994/09/25 02:31:51 wollman Exp $
*/
-#ifndef __ARGS
+#ifndef __P
#ifdef __STDC__
-#define __ARGS(x) x
+#define __P(x) x
#else
-#define __ARGS(x) ()
+#define __P(x) ()
#endif
#endif
diff --git a/usr.sbin/pppd/auth.c b/usr.sbin/pppd/auth.c
index dd9735b..f180ef1 100644
--- a/usr.sbin/pppd/auth.c
+++ b/usr.sbin/pppd/auth.c
@@ -33,12 +33,13 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: auth.c,v 1.17 1995/08/16 01:37:22 paulus Exp $";
+static char rcsid[] = "$Id: auth.c,v 1.5 1995/10/31 21:20:45 peter Exp $";
#endif
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
+#include <unistd.h>
#include <syslog.h>
#include <pwd.h>
#include <string.h>
@@ -110,8 +111,6 @@ static int scan_authfile __P((FILE *, char *, char *, char *,
struct wordlist **, char *));
static void free_wordlist __P((struct wordlist *));
-extern char *crypt __P((char *, char *));
-
/*
* An Open on LCP has requested a change from Dead to Establish phase.
* Do what's necessary to bring the physical layer up.
diff --git a/usr.sbin/pppd/chap.c b/usr.sbin/pppd/chap.c
index d72c36d..4b2c733 100644
--- a/usr.sbin/pppd/chap.c
+++ b/usr.sbin/pppd/chap.c
@@ -19,7 +19,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: chap.c,v 1.8 1995/07/04 12:32:26 paulus Exp $";
+static char rcsid[] = "$Id: chap.c,v 1.4 1995/10/31 21:20:55 peter Exp $";
#endif
/*
@@ -31,10 +31,10 @@ static char rcsid[] = "$Id: chap.c,v 1.8 1995/07/04 12:32:26 paulus Exp $";
#include <sys/types.h>
#include <sys/time.h>
#include <syslog.h>
+#include <md5.h>
#include "pppd.h"
#include "chap.h"
-#include "md5.h"
chap_state chap[NUM_PPP]; /* CHAP state; one for each unit */
@@ -342,6 +342,7 @@ ChapReceiveChallenge(cstate, inp, id, len)
char secret[MAXSECRETLEN];
char rhostname[256];
MD5_CTX mdContext;
+ unsigned char digest[16];
CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: Rcvd id %d.", id));
if (cstate->clientstate == CHAPCS_CLOSED ||
@@ -396,8 +397,8 @@ ChapReceiveChallenge(cstate, inp, id, len)
MD5Update(&mdContext, &cstate->resp_id, 1);
MD5Update(&mdContext, secret, secret_len);
MD5Update(&mdContext, rchallenge, rchallenge_len);
- MD5Final(&mdContext);
- BCOPY(mdContext.digest, cstate->response, MD5_SIGNATURE_SIZE);
+ MD5Final(digest, &mdContext);
+ BCOPY(digest, cstate->response, MD5_SIGNATURE_SIZE);
cstate->resp_length = MD5_SIGNATURE_SIZE;
break;
@@ -426,6 +427,7 @@ ChapReceiveResponse(cstate, inp, id, len)
char rhostname[256];
u_char buf[256];
MD5_CTX mdContext;
+ unsigned char digest[16];
u_char msg[256];
char secret[MAXSECRETLEN];
@@ -500,10 +502,10 @@ ChapReceiveResponse(cstate, inp, id, len)
MD5Update(&mdContext, &cstate->chal_id, 1);
MD5Update(&mdContext, secret, secret_len);
MD5Update(&mdContext, cstate->challenge, cstate->chal_len);
- MD5Final(&mdContext);
+ MD5Final(digest, &mdContext);
/* compare local and remote MDs and send the appropriate status */
- if (memcmp (mdContext.digest, remmd, MD5_SIGNATURE_SIZE) == 0)
+ if (memcmp (digest, remmd, MD5_SIGNATURE_SIZE) == 0)
code = CHAP_SUCCESS; /* they are the same! */
break;
diff --git a/usr.sbin/pppd/ipcp.c b/usr.sbin/pppd/ipcp.c
index 86c47ed..e029e2d 100644
--- a/usr.sbin/pppd/ipcp.c
+++ b/usr.sbin/pppd/ipcp.c
@@ -18,7 +18,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: ipcp.c,v 1.4 1995/10/31 21:21:06 peter Exp $";
+static char rcsid[] = "$Id: ipcp.c,v 1.5 1995/11/03 19:06:45 peter Exp $";
#endif
/*
@@ -756,6 +756,28 @@ ipcp_reqci(f, inp, len, reject_if_disagree)
next += cilen; /* Step to next CI */
switch (citype) { /* Check CI type */
+ case CI_DNS1:
+ case CI_DNS2:
+ if ( (citype == CI_DNS1 && !dns1) ||
+ (citype == CI_DNS2 && !dns2)) {
+ orc = CONFREJ; /* Reject DNS */
+ break;
+ }
+ IPCPDEBUG((LOG_INFO, "ipcp: received DNS[12] "));
+ GETLONG(tl, p); /* Parse his idea */
+ ciaddr1 = htonl(tl);
+ IPCPDEBUG((LOG_INFO, "(%s:", ip_ntoa(ciaddr1)));
+ if ( (citype == CI_DNS1 && ciaddr1 != dns1) ||
+ (citype == CI_DNS2 && ciaddr1 != dns2)) {
+ orc = CONFNAK;
+ if (!reject_if_disagree) {
+ DECPTR(sizeof (long), p);
+ tl = ntohl(citype == CI_DNS1 ? dns1 : dns2);
+ PUTLONG(tl, p);
+ }
+ }
+ break;
+
case CI_ADDRS:
IPCPDEBUG((LOG_INFO, "ipcp: received ADDRS "));
if (!ao->neg_addr ||
@@ -1190,6 +1212,34 @@ ipcp_printpkt(p, plen, printer, arg)
printer(arg, "addr %s", ip_ntoa(htonl(cilong)));
}
break;
+ case CI_DNS1:
+ if (olen == CILEN_ADDR) {
+ p += 2;
+ GETLONG(cilong, p);
+ printer(arg, "dns1 %s", ip_ntoa(htonl(cilong)));
+ }
+ break;
+ case CI_DNS2:
+ if (olen == CILEN_ADDR) {
+ p += 2;
+ GETLONG(cilong, p);
+ printer(arg, "dns2 %s", ip_ntoa(htonl(cilong)));
+ }
+ break;
+ case CI_NBNS1:
+ if (olen == CILEN_ADDR) {
+ p += 2;
+ GETLONG(cilong, p);
+ printer(arg, "nbns1 %s", ip_ntoa(htonl(cilong)));
+ }
+ break;
+ case CI_NBNS2:
+ if (olen == CILEN_ADDR) {
+ p += 2;
+ GETLONG(cilong, p);
+ printer(arg, "nbns2 %s", ip_ntoa(htonl(cilong)));
+ }
+ break;
}
while (p < optend) {
GETCHAR(code, p);
diff --git a/usr.sbin/pppd/ipcp.h b/usr.sbin/pppd/ipcp.h
index b1f9b40..aba2500 100644
--- a/usr.sbin/pppd/ipcp.h
+++ b/usr.sbin/pppd/ipcp.h
@@ -16,7 +16,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: ipcp.h,v 1.5 1994/09/21 06:47:37 paulus Exp $
+ * $Id: ipcp.h,v 1.4 1995/10/31 21:21:09 peter Exp $
*/
/*
@@ -25,6 +25,10 @@
#define CI_ADDRS 1 /* IP Addresses */
#define CI_COMPRESSTYPE 2 /* Compression Type */
#define CI_ADDR 3
+#define CI_DNS1 129 /* Primary DNS */
+#define CI_NBNS1 130 /* Primary NBNS */
+#define CI_DNS2 131 /* Secondary DNS */
+#define CI_NBNS2 132 /* Secondary NBNS */
#define MAX_STATES 16 /* from slcompress.h */
diff --git a/usr.sbin/pppd/md5.c b/usr.sbin/pppd/md5.c
deleted file mode 100644
index 480c860..0000000
--- a/usr.sbin/pppd/md5.c
+++ /dev/null
@@ -1,304 +0,0 @@
-
-
-/*
- ***********************************************************************
- ** md5.c -- the source code for MD5 routines **
- ** RSA Data Security, Inc. MD5 Message-Digest Algorithm **
- ** Created: 2/17/90 RLR **
- ** Revised: 1/91 SRD,AJ,BSK,JT Reference C ver., 7/10 constant corr. **
- ***********************************************************************
- */
-
-/*
- ***********************************************************************
- ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. **
- ** **
- ** License to copy and use this software is granted provided that **
- ** it is identified as the "RSA Data Security, Inc. MD5 Message- **
- ** Digest Algorithm" in all material mentioning or referencing this **
- ** software or this function. **
- ** **
- ** License is also granted to make and use derivative works **
- ** provided that such works are identified as "derived from the RSA **
- ** Data Security, Inc. MD5 Message-Digest Algorithm" in all **
- ** material mentioning or referencing the derived work. **
- ** **
- ** RSA Data Security, Inc. makes no representations concerning **
- ** either the merchantability of this software or the suitability **
- ** of this software for any particular purpose. It is provided "as **
- ** is" without express or implied warranty of any kind. **
- ** **
- ** These notices must be retained in any copies of any part of this **
- ** documentation and/or software. **
- ***********************************************************************
- */
-
-#include "md5.h"
-
-/*
- ***********************************************************************
- ** Message-digest routines: **
- ** To form the message digest for a message M **
- ** (1) Initialize a context buffer mdContext using MD5Init **
- ** (2) Call MD5Update on mdContext and M **
- ** (3) Call MD5Final on mdContext **
- ** The message digest is now in mdContext->digest[0...15] **
- ***********************************************************************
- */
-
-/* forward declaration */
-static void Transform ();
-
-static unsigned char PADDING[64] = {
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-/* F, G, H and I are basic MD5 functions */
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | (~z)))
-
-/* ROTATE_LEFT rotates x left n bits */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4 */
-/* Rotation is separate from addition to prevent recomputation */
-#define FF(a, b, c, d, x, s, ac) \
- {(a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define GG(a, b, c, d, x, s, ac) \
- {(a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define HH(a, b, c, d, x, s, ac) \
- {(a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define II(a, b, c, d, x, s, ac) \
- {(a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-
-#ifdef __STDC__
-#define UL(x) x##U
-#else
-#define UL(x) x
-#endif
-
-/* The routine MD5Init initializes the message-digest context
- mdContext. All fields are set to zero.
- */
-void MD5Init (mdContext)
-MD5_CTX *mdContext;
-{
- mdContext->i[0] = mdContext->i[1] = (UINT4)0;
-
- /* Load magic initialization constants.
- */
- mdContext->buf[0] = (UINT4)0x67452301;
- mdContext->buf[1] = (UINT4)0xefcdab89;
- mdContext->buf[2] = (UINT4)0x98badcfe;
- mdContext->buf[3] = (UINT4)0x10325476;
-}
-
-/* The routine MD5Update updates the message-digest context to
- account for the presence of each of the characters inBuf[0..inLen-1]
- in the message whose digest is being computed.
- */
-void MD5Update (mdContext, inBuf, inLen)
-MD5_CTX *mdContext;
-unsigned char *inBuf;
-unsigned int inLen;
-{
- UINT4 in[16];
- int mdi;
- unsigned int i, ii;
-
- /* compute number of bytes mod 64 */
- mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
-
- /* update number of bits */
- if ((mdContext->i[0] + ((UINT4)inLen << 3)) < mdContext->i[0])
- mdContext->i[1]++;
- mdContext->i[0] += ((UINT4)inLen << 3);
- mdContext->i[1] += ((UINT4)inLen >> 29);
-
- while (inLen--) {
- /* add new character to buffer, increment mdi */
- mdContext->in[mdi++] = *inBuf++;
-
- /* transform if necessary */
- if (mdi == 0x40) {
- for (i = 0, ii = 0; i < 16; i++, ii += 4)
- in[i] = (((UINT4)mdContext->in[ii+3]) << 24) |
- (((UINT4)mdContext->in[ii+2]) << 16) |
- (((UINT4)mdContext->in[ii+1]) << 8) |
- ((UINT4)mdContext->in[ii]);
- Transform (mdContext->buf, in);
- mdi = 0;
- }
- }
-}
-
-/* The routine MD5Final terminates the message-digest computation and
- ends with the desired message digest in mdContext->digest[0...15].
- */
-void MD5Final (mdContext)
-MD5_CTX *mdContext;
-{
- UINT4 in[16];
- int mdi;
- unsigned int i, ii;
- unsigned int padLen;
-
- /* save number of bits */
- in[14] = mdContext->i[0];
- in[15] = mdContext->i[1];
-
- /* compute number of bytes mod 64 */
- mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
-
- /* pad out to 56 mod 64 */
- padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi);
- MD5Update (mdContext, PADDING, padLen);
-
- /* append length in bits and transform */
- for (i = 0, ii = 0; i < 14; i++, ii += 4)
- in[i] = (((UINT4)mdContext->in[ii+3]) << 24) |
- (((UINT4)mdContext->in[ii+2]) << 16) |
- (((UINT4)mdContext->in[ii+1]) << 8) |
- ((UINT4)mdContext->in[ii]);
- Transform (mdContext->buf, in);
-
- /* store buffer in digest */
- for (i = 0, ii = 0; i < 4; i++, ii += 4) {
- mdContext->digest[ii] = (unsigned char)(mdContext->buf[i] & 0xFF);
- mdContext->digest[ii+1] =
- (unsigned char)((mdContext->buf[i] >> 8) & 0xFF);
- mdContext->digest[ii+2] =
- (unsigned char)((mdContext->buf[i] >> 16) & 0xFF);
- mdContext->digest[ii+3] =
- (unsigned char)((mdContext->buf[i] >> 24) & 0xFF);
- }
-}
-
-/* Basic MD5 step. Transforms buf based on in.
- */
-static void Transform (buf, in)
-UINT4 *buf;
-UINT4 *in;
-{
- UINT4 a = buf[0], b = buf[1], c = buf[2], d = buf[3];
-
- /* Round 1 */
-#define S11 7
-#define S12 12
-#define S13 17
-#define S14 22
- FF ( a, b, c, d, in[ 0], S11, UL(3614090360)); /* 1 */
- FF ( d, a, b, c, in[ 1], S12, UL(3905402710)); /* 2 */
- FF ( c, d, a, b, in[ 2], S13, UL( 606105819)); /* 3 */
- FF ( b, c, d, a, in[ 3], S14, UL(3250441966)); /* 4 */
- FF ( a, b, c, d, in[ 4], S11, UL(4118548399)); /* 5 */
- FF ( d, a, b, c, in[ 5], S12, UL(1200080426)); /* 6 */
- FF ( c, d, a, b, in[ 6], S13, UL(2821735955)); /* 7 */
- FF ( b, c, d, a, in[ 7], S14, UL(4249261313)); /* 8 */
- FF ( a, b, c, d, in[ 8], S11, UL(1770035416)); /* 9 */
- FF ( d, a, b, c, in[ 9], S12, UL(2336552879)); /* 10 */
- FF ( c, d, a, b, in[10], S13, UL(4294925233)); /* 11 */
- FF ( b, c, d, a, in[11], S14, UL(2304563134)); /* 12 */
- FF ( a, b, c, d, in[12], S11, UL(1804603682)); /* 13 */
- FF ( d, a, b, c, in[13], S12, UL(4254626195)); /* 14 */
- FF ( c, d, a, b, in[14], S13, UL(2792965006)); /* 15 */
- FF ( b, c, d, a, in[15], S14, UL(1236535329)); /* 16 */
-
- /* Round 2 */
-#define S21 5
-#define S22 9
-#define S23 14
-#define S24 20
- GG ( a, b, c, d, in[ 1], S21, UL(4129170786)); /* 17 */
- GG ( d, a, b, c, in[ 6], S22, UL(3225465664)); /* 18 */
- GG ( c, d, a, b, in[11], S23, UL( 643717713)); /* 19 */
- GG ( b, c, d, a, in[ 0], S24, UL(3921069994)); /* 20 */
- GG ( a, b, c, d, in[ 5], S21, UL(3593408605)); /* 21 */
- GG ( d, a, b, c, in[10], S22, UL( 38016083)); /* 22 */
- GG ( c, d, a, b, in[15], S23, UL(3634488961)); /* 23 */
- GG ( b, c, d, a, in[ 4], S24, UL(3889429448)); /* 24 */
- GG ( a, b, c, d, in[ 9], S21, UL( 568446438)); /* 25 */
- GG ( d, a, b, c, in[14], S22, UL(3275163606)); /* 26 */
- GG ( c, d, a, b, in[ 3], S23, UL(4107603335)); /* 27 */
- GG ( b, c, d, a, in[ 8], S24, UL(1163531501)); /* 28 */
- GG ( a, b, c, d, in[13], S21, UL(2850285829)); /* 29 */
- GG ( d, a, b, c, in[ 2], S22, UL(4243563512)); /* 30 */
- GG ( c, d, a, b, in[ 7], S23, UL(1735328473)); /* 31 */
- GG ( b, c, d, a, in[12], S24, UL(2368359562)); /* 32 */
-
- /* Round 3 */
-#define S31 4
-#define S32 11
-#define S33 16
-#define S34 23
- HH ( a, b, c, d, in[ 5], S31, UL(4294588738)); /* 33 */
- HH ( d, a, b, c, in[ 8], S32, UL(2272392833)); /* 34 */
- HH ( c, d, a, b, in[11], S33, UL(1839030562)); /* 35 */
- HH ( b, c, d, a, in[14], S34, UL(4259657740)); /* 36 */
- HH ( a, b, c, d, in[ 1], S31, UL(2763975236)); /* 37 */
- HH ( d, a, b, c, in[ 4], S32, UL(1272893353)); /* 38 */
- HH ( c, d, a, b, in[ 7], S33, UL(4139469664)); /* 39 */
- HH ( b, c, d, a, in[10], S34, UL(3200236656)); /* 40 */
- HH ( a, b, c, d, in[13], S31, UL( 681279174)); /* 41 */
- HH ( d, a, b, c, in[ 0], S32, UL(3936430074)); /* 42 */
- HH ( c, d, a, b, in[ 3], S33, UL(3572445317)); /* 43 */
- HH ( b, c, d, a, in[ 6], S34, UL( 76029189)); /* 44 */
- HH ( a, b, c, d, in[ 9], S31, UL(3654602809)); /* 45 */
- HH ( d, a, b, c, in[12], S32, UL(3873151461)); /* 46 */
- HH ( c, d, a, b, in[15], S33, UL( 530742520)); /* 47 */
- HH ( b, c, d, a, in[ 2], S34, UL(3299628645)); /* 48 */
-
- /* Round 4 */
-#define S41 6
-#define S42 10
-#define S43 15
-#define S44 21
- II ( a, b, c, d, in[ 0], S41, UL(4096336452)); /* 49 */
- II ( d, a, b, c, in[ 7], S42, UL(1126891415)); /* 50 */
- II ( c, d, a, b, in[14], S43, UL(2878612391)); /* 51 */
- II ( b, c, d, a, in[ 5], S44, UL(4237533241)); /* 52 */
- II ( a, b, c, d, in[12], S41, UL(1700485571)); /* 53 */
- II ( d, a, b, c, in[ 3], S42, UL(2399980690)); /* 54 */
- II ( c, d, a, b, in[10], S43, UL(4293915773)); /* 55 */
- II ( b, c, d, a, in[ 1], S44, UL(2240044497)); /* 56 */
- II ( a, b, c, d, in[ 8], S41, UL(1873313359)); /* 57 */
- II ( d, a, b, c, in[15], S42, UL(4264355552)); /* 58 */
- II ( c, d, a, b, in[ 6], S43, UL(2734768916)); /* 59 */
- II ( b, c, d, a, in[13], S44, UL(1309151649)); /* 60 */
- II ( a, b, c, d, in[ 4], S41, UL(4149444226)); /* 61 */
- II ( d, a, b, c, in[11], S42, UL(3174756917)); /* 62 */
- II ( c, d, a, b, in[ 2], S43, UL( 718787259)); /* 63 */
- II ( b, c, d, a, in[ 9], S44, UL(3951481745)); /* 64 */
-
- buf[0] += a;
- buf[1] += b;
- buf[2] += c;
- buf[3] += d;
-}
-
-/*
- ***********************************************************************
- ** End of md5.c **
- ******************************** (cut) ********************************
- */
diff --git a/usr.sbin/pppd/md5.h b/usr.sbin/pppd/md5.h
deleted file mode 100644
index 535b18d..0000000
--- a/usr.sbin/pppd/md5.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- ***********************************************************************
- ** md5.h -- header file for implementation of MD5 **
- ** RSA Data Security, Inc. MD5 Message-Digest Algorithm **
- ** Created: 2/17/90 RLR **
- ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version **
- ** Revised (for MD5): RLR 4/27/91 **
- ** -- G modified to have y&~z instead of y&z **
- ** -- FF, GG, HH modified to add in last register done **
- ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 **
- ** -- distinct additive constant for each step **
- ** -- round 4 added, working mod 7 **
- ***********************************************************************
- */
-
-/*
- ***********************************************************************
- ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. **
- ** **
- ** License to copy and use this software is granted provided that **
- ** it is identified as the "RSA Data Security, Inc. MD5 Message- **
- ** Digest Algorithm" in all material mentioning or referencing this **
- ** software or this function. **
- ** **
- ** License is also granted to make and use derivative works **
- ** provided that such works are identified as "derived from the RSA **
- ** Data Security, Inc. MD5 Message-Digest Algorithm" in all **
- ** material mentioning or referencing the derived work. **
- ** **
- ** RSA Data Security, Inc. makes no representations concerning **
- ** either the merchantability of this software or the suitability **
- ** of this software for any particular purpose. It is provided "as **
- ** is" without express or implied warranty of any kind. **
- ** **
- ** These notices must be retained in any copies of any part of this **
- ** documentation and/or software. **
- ***********************************************************************
- */
-
-#ifndef __MD5_INCLUDE__
-
-/* typedef a 32-bit type */
-typedef unsigned long int UINT4;
-
-/* Data structure for MD5 (Message-Digest) computation */
-typedef struct {
- UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
- UINT4 buf[4]; /* scratch buffer */
- unsigned char in[64]; /* input buffer */
- unsigned char digest[16]; /* actual digest after MD5Final call */
-} MD5_CTX;
-
-void MD5Init ();
-void MD5Update ();
-void MD5Final ();
-
-#define __MD5_INCLUDE__
-#endif /* __MD5_INCLUDE__ */
diff --git a/usr.sbin/pppd/options.c b/usr.sbin/pppd/options.c
index 6bea932..8ed6ff0 100644
--- a/usr.sbin/pppd/options.c
+++ b/usr.sbin/pppd/options.c
@@ -18,7 +18,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: options.c,v 1.7 1995/10/31 21:29:25 peter Exp $";
+static char rcsid[] = "$Id: options.c,v 1.8 1995/11/04 10:44:22 peter Exp $";
#endif
#include <stdio.h>
@@ -69,6 +69,8 @@ int crtscts = 0; /* Use hardware flow control */
int modem = 1; /* Use modem control lines */
int inspeed = 0; /* Input/Output speed requested */
u_int32_t netmask = 0; /* IP netmask to set on interface */
+u_int32_t dns1 = 0; /* Primary DNS server */
+u_int32_t dns2 = 0; /* Secondary DNS server */
int lockflag = 0; /* Create lock file to lock the serial dev */
int nodetach = 0; /* Don't detach from controlling tty */
char *connector = NULL; /* Script to establish physical link */
@@ -125,6 +127,8 @@ static int setconnector __P((char **));
static int setdisconnector __P((char **));
static int setdomain __P((char **));
static int setnetmask __P((char **));
+static int setdns1 __P((char **));
+static int setdns2 __P((char **));
static int setcrtscts __P((void));
static int setnocrtscts __P((void));
static int setxonxoff __P((void));
@@ -213,6 +217,8 @@ static struct cmd {
{"mru", 1, setmru}, /* Set MRU value for negotiation */
{"mtu", 1, setmtu}, /* Set our MTU */
{"netmask", 1, setnetmask}, /* set netmask */
+ {"dns1", 1, setdns1}, /* set Primary Domain Name Server */
+ {"dns2", 1, setdns2}, /* set Secondary Domain Name Server */
{"passive", 0, setpassive}, /* Set passive mode */
{"silent", 0, setsilent}, /* Set silent mode */
{"modem", 0, setmodem}, /* Use modem control lines */
@@ -1402,6 +1408,44 @@ setnetmask(argv)
return (1);
}
+
+/*
+ * setdns1 - set the primary dns.
+ */
+static int
+setdns1(argv)
+ char **argv;
+{
+ struct in_addr mask;
+
+ if ((inet_aton(*argv, &mask) < 0)) {
+ fprintf(stderr, "Invalid dns1 %s\n", *argv);
+ return (0);
+ }
+
+ dns1 = mask.s_addr;
+ return (1);
+}
+
+
+/*
+ * setdns2 - set the secondary dns.
+ */
+static int
+setdns2(argv)
+ char **argv;
+{
+ struct in_addr mask;
+
+ if ((inet_aton(*argv, &mask) < 0)) {
+ fprintf(stderr, "Invalid dns2 %s\n", *argv);
+ return (0);
+ }
+
+ dns2 = mask.s_addr;
+ return (1);
+}
+
static int
setcrtscts()
{
diff --git a/usr.sbin/pppd/pppd.8 b/usr.sbin/pppd/pppd.8
index e1c7bbd..32a4049 100644
--- a/usr.sbin/pppd/pppd.8
+++ b/usr.sbin/pppd/pppd.8
@@ -1,5 +1,5 @@
.\" manual page [] for pppd 2.0
-.\" $Id: pppd.8,v 1.14 1995/08/16 01:39:53 paulus Exp $
+.\" $Id: pppd.8,v 1.3 1995/10/31 21:21:39 peter Exp $
.\" SH section heading
.\" SS subsection heading
.\" LP paragraph
@@ -126,6 +126,14 @@ links (40 bytes for TCP/IP header + 256 bytes of data).
Set the interface netmask to <n>, a 32 bit netmask in "decimal dot" notation
(e.g. 255.255.255.0).
.TP
+.B dns1 \fI<n>
+If peer asks for primary DNS server, tell them this address,
+a 32 bit ip number in "decimal dot" notation (e.g. 1.2.3.4).
+.TP
+.B dns2 \fI<n>
+If peer asks for secondary DNS server, tell them this address,
+a 32 bit ip number in "decimal dot" notation (e.g. 1.2.3.5).
+.TP
.B passive
Enables the "passive" option in the LCP. With this option,
.I pppd
diff --git a/usr.sbin/pppd/pppd.h b/usr.sbin/pppd/pppd.h
index 66b0107..bedf675 100644
--- a/usr.sbin/pppd/pppd.h
+++ b/usr.sbin/pppd/pppd.h
@@ -16,7 +16,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: pppd.h,v 1.8 1995/04/26 06:46:31 paulus Exp $
+ * $Id: pppd.h,v 1.4 1995/10/31 21:21:42 peter Exp $
*/
/*
@@ -67,6 +67,8 @@ extern int crtscts; /* Use hardware flow control */
extern int modem; /* Use modem control lines */
extern int inspeed; /* Input/Output speed requested */
extern u_int32_t netmask; /* IP netmask to set on interface */
+extern u_int32_t dns1; /* Primary DNS server */
+extern u_int32_t dns2; /* Secondary DNS server */
extern int lockflag; /* Create lock file to lock the serial dev */
extern int nodetach; /* Don't detach from controlling tty */
extern char *connector; /* Script to establish physical link */
diff --git a/usr.sbin/pppd/sys-bsd.c b/usr.sbin/pppd/sys-bsd.c
index eea6125..3b9d224 100644
--- a/usr.sbin/pppd/sys-bsd.c
+++ b/usr.sbin/pppd/sys-bsd.c
@@ -19,7 +19,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: sys-bsd.c,v 1.21 1995/08/16 01:40:23 paulus Exp $";
+static char rcsid[] = "$Id: sys-bsd.c,v 1.5 1995/10/31 21:21:46 peter Exp $";
#endif
/*
@@ -30,6 +30,7 @@ static char rcsid[] = "$Id: sys-bsd.c,v 1.21 1995/08/16 01:40:23 paulus Exp $";
#include <syslog.h>
#include <string.h>
#include <stdlib.h>
+#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <termios.h>
OpenPOWER on IntegriCloud