Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/dist/pppd/pppd bring in changes from 2.4.4b1; we will import...



details:   https://anonhg.NetBSD.org/src/rev/edb927e7790e
branches:  trunk
changeset: 586762:edb927e7790e
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Dec 31 08:58:50 2005 +0000

description:
bring in changes from 2.4.4b1; we will import 2.4.4 once it is released.

diffstat:

 dist/pppd/pppd/auth.c      |   28 +++++++-
 dist/pppd/pppd/ccp.c       |   11 ++-
 dist/pppd/pppd/chap-new.c  |   33 +++++----
 dist/pppd/pppd/chap_ms.c   |  100 ++++++++++++++----------------
 dist/pppd/pppd/chap_ms.h   |   45 ++++--------
 dist/pppd/pppd/ipcp.c      |   27 +++++--
 dist/pppd/pppd/ipv6cp.c    |    7 +-
 dist/pppd/pppd/ipxcp.c     |    6 +-
 dist/pppd/pppd/lcp.c       |   63 +++++++++++++++----
 dist/pppd/pppd/lcp.h       |   20 +++++-
 dist/pppd/pppd/main.c      |  146 ++++++++++++++++++++++++++++++++++++++++----
 dist/pppd/pppd/multilink.c |   16 ++--
 dist/pppd/pppd/options.c   |   25 ++++---
 dist/pppd/pppd/pathnames.h |    3 +-
 dist/pppd/pppd/pppd.h      |    8 +-
 dist/pppd/pppd/tty.c       |   14 +---
 dist/pppd/pppd/upap.c      |    5 +-
 17 files changed, 370 insertions(+), 187 deletions(-)

diffs (truncated from 1486 to 300 lines):

diff -r 1f2a723221c2 -r edb927e7790e dist/pppd/pppd/auth.c
--- a/dist/pppd/pppd/auth.c     Sat Dec 31 08:36:01 2005 +0000
+++ b/dist/pppd/pppd/auth.c     Sat Dec 31 08:58:50 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auth.c,v 1.2 2005/02/20 10:47:16 cube Exp $    */
+/*     $NetBSD: auth.c,v 1.3 2005/12/31 08:58:50 christos Exp $        */
 
 /*
  * auth.c - PPP authentication and phase control.
@@ -75,7 +75,7 @@
 #if 0
 #define RCSID  "Id: auth.c,v 1.101 2004/11/12 10:30:51 paulus Exp"
 #else
-__RCSID("$NetBSD: auth.c,v 1.2 2005/02/20 10:47:16 cube Exp $");
+__RCSID("$NetBSD: auth.c,v 1.3 2005/12/31 08:58:50 christos Exp $");
 #endif
 #endif
 
@@ -543,15 +543,25 @@
 
 /*
  * An Open on LCP has requested a change from Dead to Establish phase.
- * Do what's necessary to bring the physical layer up.
  */
 void
 link_required(unit)
     int unit;
 {
+}
+
+/*
+ * Bring the link up to the point of being able to do ppp.
+ */
+void start_link(unit)
+    int unit;
+{
+    char *msg;
+
     new_phase(PHASE_SERIALCONN);
 
     devfd = the_channel->connect();
+    msg = "Connect script failed";
     if (devfd < 0)
        goto fail;
 
@@ -564,6 +574,7 @@
      * gives us.  Thus we don't need the tdb_writelock/tdb_writeunlock.
      */
     fd_ppp = the_channel->establish_ppp(devfd);
+    msg = "ppp establishment failed";
     if (fd_ppp < 0) {
        status = EXIT_FATAL_ERROR;
        goto disconnect;
@@ -597,7 +608,6 @@
     new_phase(PHASE_DEAD);
     if (the_channel->cleanup)
        (*the_channel->cleanup)();
-
 }
 
 /*
@@ -659,6 +669,8 @@
        the_channel->disconnect();
        devfd = -1;
     }
+    if (the_channel->cleanup)
+       (*the_channel->cleanup)();
 
     if (doing_multilink && multilink_master) {
        if (!bundle_terminating)
@@ -1002,10 +1014,12 @@
     int unit, protocol, prot_flavor;
 {
     int bit;
+    const char *prot = "";
 
     switch (protocol) {
     case PPP_CHAP:
        bit = CHAP_WITHPEER;
+       prot = "CHAP";
        switch (prot_flavor) {
        case CHAP_MD5:
            bit |= CHAP_MD5_WITHPEER;
@@ -1024,15 +1038,19 @@
        if (passwd_from_file)
            BZERO(passwd, MAXSECRETLEN);
        bit = PAP_WITHPEER;
+       prot = "PAP";
        break;
     case PPP_EAP:
        bit = EAP_WITHPEER;
+       prot = "EAP";
        break;
     default:
        warn("auth_withpeer_success: unknown protocol %x", protocol);
        bit = 0;
     }
 
+    notice("%s authentication succeeded", prot);
+
     /* Save the authentication method for later. */
     auth_done[unit] |= bit;
 
@@ -2566,5 +2584,5 @@
     argv[5] = strspeed;
     argv[6] = NULL;
 
-    auth_script_pid = run_program(script, argv, 0, auth_script_done, NULL);
+    auth_script_pid = run_program(script, argv, 0, auth_script_done, NULL, 0);
 }
diff -r 1f2a723221c2 -r edb927e7790e dist/pppd/pppd/ccp.c
--- a/dist/pppd/pppd/ccp.c      Sat Dec 31 08:36:01 2005 +0000
+++ b/dist/pppd/pppd/ccp.c      Sat Dec 31 08:58:50 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ccp.c,v 1.1.1.1 2005/02/20 10:28:37 cube Exp $ */
+/*     $NetBSD: ccp.c,v 1.2 2005/12/31 08:58:50 christos Exp $ */
 
 /*
  * ccp.c - PPP Compression Control Protocol.
@@ -35,7 +35,7 @@
 #if 0
 #define RCSID  "Id: ccp.c,v 1.48 2004/11/13 02:28:15 paulus Exp"
 #else
-__RCSID("$NetBSD: ccp.c,v 1.1.1.1 2005/02/20 10:28:37 cube Exp $");
+__RCSID("$NetBSD: ccp.c,v 1.2 2005/12/31 08:58:50 christos Exp $");
 #endif
 #endif
 
@@ -1169,8 +1169,11 @@
                    }
                } else {
                    /* Neither are set. */
-                   newret = CONFREJ;
-                   break;
+                   /* We cannot accept this.  */
+                   newret = CONFNAK;
+                   /* Give the peer our idea of what can be used,
+                      so it can choose and confirm */
+                   ho->mppe = ao->mppe;
                }
 
                /* rebuild the opts */
diff -r 1f2a723221c2 -r edb927e7790e dist/pppd/pppd/chap-new.c
--- a/dist/pppd/pppd/chap-new.c Sat Dec 31 08:36:01 2005 +0000
+++ b/dist/pppd/pppd/chap-new.c Sat Dec 31 08:58:50 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chap-new.c,v 1.1.1.1 2005/02/20 10:28:41 cube Exp $    */
+/*     $NetBSD: chap-new.c,v 1.2 2005/12/31 08:58:50 christos Exp $    */
 
 /*
  * chap-new.c - New CHAP implementation.
@@ -35,7 +35,7 @@
 #if 0
 #define RCSID  "Id: chap-new.c,v 1.6 2004/11/04 10:02:26 paulus Exp"
 #else
-__RCSID("$NetBSD: chap-new.c,v 1.1.1.1 2005/02/20 10:28:41 cube Exp $");
+__RCSID("$NetBSD: chap-new.c,v 1.2 2005/12/31 08:58:50 christos Exp $");
 #endif
 #endif
 
@@ -105,6 +105,7 @@
        int challenge_xmits;
        int challenge_pktlen;
        unsigned char challenge[CHAL_MAX_PKTLEN];
+       char message[256];
 } server;
 
 /* Values for flags in chap_client_state and chap_server_state */
@@ -319,15 +320,12 @@
        int (*verifier)(char *, char *, int, struct chap_digest_type *,
                unsigned char *, unsigned char *, char *, int);
        char rname[MAXNAMELEN+1];
-       char message[256];
 
        if ((ss->flags & LOWERUP) == 0)
                return;
        if (id != ss->challenge[PPP_HDRLEN+1] || len < 2)
                return;
-       if ((ss->flags & AUTH_DONE) == 0) {
-               if ((ss->flags & CHALLENGE_VALID) == 0)
-                       return;
+       if (ss->flags & CHALLENGE_VALID) {
                response = pkt;
                GETCHAR(response_len, pkt);
                len -= response_len + 1;        /* length of name */
@@ -335,7 +333,6 @@
                if (len < 0)
                        return;
 
-               ss->flags &= ~CHALLENGE_VALID;
                if (ss->flags & TIMEOUT_PENDING) {
                        ss->flags &= ~TIMEOUT_PENDING;
                        UNTIMEOUT(chap_timeout, ss);
@@ -355,39 +352,43 @@
                        verifier = chap_verify_response;
                ok = (*verifier)(name, ss->name, id, ss->digest,
                                 ss->challenge + PPP_HDRLEN + CHAP_HDRLEN,
-                                response, message, sizeof(message));
+                                response, ss->message, sizeof(ss->message));
                if (!ok || !auth_number()) {
                        ss->flags |= AUTH_FAILED;
                        warn("Peer %q failed CHAP authentication", name);
                }
-       }
+       } else if ((ss->flags & AUTH_DONE) == 0)
+               return;
 
        /* send the response */
        p = outpacket_buf;
        MAKEHEADER(p, PPP_CHAP);
-       mlen = strlen(message);
+       mlen = strlen(ss->message);
        len = CHAP_HDRLEN + mlen;
        p[0] = (ss->flags & AUTH_FAILED)? CHAP_FAILURE: CHAP_SUCCESS;
        p[1] = id;
        p[2] = len >> 8;
        p[3] = len;
        if (mlen > 0)
-               memcpy(p + CHAP_HDRLEN, message, mlen);
+               memcpy(p + CHAP_HDRLEN, ss->message, mlen);
        output(0, outpacket_buf, PPP_HDRLEN + len);
 
-       if ((ss->flags & AUTH_DONE) == 0) {
-               ss->flags |= AUTH_DONE;
+       if (ss->flags & CHALLENGE_VALID) {
+               ss->flags &= ~CHALLENGE_VALID;
                if (ss->flags & AUTH_FAILED) {
                        auth_peer_fail(0, PPP_CHAP);
                } else {
-                       auth_peer_success(0, PPP_CHAP, ss->digest->code,
-                                         name, strlen(name));
+                       if ((ss->flags & AUTH_DONE) == 0)
+                               auth_peer_success(0, PPP_CHAP,
+                                                 ss->digest->code,
+                                                 name, strlen(name));
                        if (chap_rechallenge_time) {
                                ss->flags |= TIMEOUT_PENDING;
                                TIMEOUT(chap_timeout, ss,
                                        chap_rechallenge_time);
                        }
                }
+               ss->flags |= AUTH_DONE;
        }
 }
 
@@ -509,6 +510,7 @@
                auth_withpeer_success(0, PPP_CHAP, cs->digest->code);
        else {
                cs->flags |= AUTH_FAILED;
+               error("CHAP authentication failed");
                auth_withpeer_fail(0, PPP_CHAP);
        }
 }
@@ -560,6 +562,7 @@
        }
        if ((cs->flags & (AUTH_STARTED|AUTH_DONE)) == AUTH_STARTED) {
                cs->flags &= ~AUTH_STARTED;
+               error("CHAP authentication failed due to protocol-reject");
                auth_withpeer_fail(0, PPP_CHAP);
        }
 }
diff -r 1f2a723221c2 -r edb927e7790e dist/pppd/pppd/chap_ms.c
--- a/dist/pppd/pppd/chap_ms.c  Sat Dec 31 08:36:01 2005 +0000
+++ b/dist/pppd/pppd/chap_ms.c  Sat Dec 31 08:58:50 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chap_ms.c,v 1.2 2005/02/20 10:47:17 cube Exp $ */
+/*     $NetBSD: chap_ms.c,v 1.3 2005/12/31 08:58:50 christos Exp $     */
 
 /*
  * chap_ms.c - Microsoft MS-CHAP compatible implementation.
@@ -81,7 +81,7 @@
 #if 0
 #define RCSID  "Id: chap_ms.c,v 1.33 2004/11/12 09:57:43 paulus Exp"
 #else
-__RCSID("$NetBSD: chap_ms.c,v 1.2 2005/02/20 10:47:17 cube Exp $");
+__RCSID("$NetBSD: chap_ms.c,v 1.3 2005/12/31 08:58:50 christos Exp $");
 #endif
 #endif
 
@@ -97,7 +97,7 @@
 #include <md4.h>
 #include <sha1.h>
 
-#define SHA1_SIGNATURE_SIZE 20
+#define SHA1_SIGNATURE_SIZE SHA1_DIGEST_LENGTH
 
 #include "pppd.h"
 #include "chap-new.h"
@@ -114,13 +114,13 @@
 static void    NTPasswordHash __P((char *, int, u_char[MD4_SIGNATURE_SIZE]));
 static void    ChallengeResponse __P((u_char *, u_char *, u_char[24]));
 static void    ChapMS_NT __P((u_char *, char *, int, u_char[24]));
-static void    ChapMS2_NT __P((char *, u_char[16], char *, char *, int,
+static void    ChapMS2_NT __P((u_char *, u_char[16], char *, char *, int,
                                u_char[24]));
 static void    GenerateAuthenticatorResponsePlain
                        __P((char*, int, u_char[24], u_char[16], u_char *,
                             char *, u_char[41]));
 #ifdef MSLANMAN
-static void    ChapMS_LANMan __P((u_char *, char *, int, MS_ChapResponse *));



Home | Main Index | Thread Index | Old Index