]> git.ozlabs.org Git - ppp.git/commitdiff
Patches from Frank Cusack.
authorDavid F. Skoll <dfs@roaringpenguin.com>
Sun, 1 Sep 2002 12:00:15 +0000 (12:00 +0000)
committerDavid F. Skoll <dfs@roaringpenguin.com>
Sun, 1 Sep 2002 12:00:15 +0000 (12:00 +0000)
README.MSCHAP80
pppd/auth.c
pppd/ccp.c
pppd/chap.c
pppd/chap_ms.c
pppd/pppd.h

index c77d7696d1d468fa746e33f66c1be4f70070116e..7c16f3eb7e28ca48913562bbcb16d11d50fe6aa2 100644 (file)
@@ -226,7 +226,8 @@ int main(argc, argv)
     for (i = 0; i < sizeof(challenge); i++)
         challenge[i] = (u_char)challengeInt[i];
 
-    ChapMS(&cstate, challenge, sizeof(challenge), argv[2], strlen(argv[2]));
+    ChapMS(&cstate, challenge, argv[2], strlen(argv[2]),
+          (MS_ChapResponse *)&cstate.response);
     printf("Response length is %d, response is:", cstate.resp_length);
 
     for (i = 0; i < cstate.resp_length; i++) {
@@ -241,8 +242,8 @@ int main(argc, argv)
 }
 -------------
 
-This needs to link against chap_ms.o, md4.o, and the DES library.  When 
-you run it with the command line:
+This needs to link against chap_ms.o, md4.o, sha1.o and the DES library.
+When you run it with the command line:
 
  $ testchap 00000000000000000000000000000000 hello
 
index 469b0f857411fc2c62ead751e8aed6522ebcdbe7..76fc8210388e8431c227806471fd3f52b3046a85 100644 (file)
@@ -32,7 +32,7 @@
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#define RCSID  "$Id: auth.c,v 1.80 2002/07/16 13:11:43 kad Exp $"
+#define RCSID  "$Id: auth.c,v 1.81 2002/09/01 12:00:15 dfs Exp $"
 
 #include <stdio.h>
 #include <stddef.h>
@@ -608,59 +608,62 @@ void
 start_networks(unit)
     int unit;
 {
-    static int started = 0;
     int i;
     struct protent *protp;
     int ecp_required, mppe_required;
 
-    if (!started) {
-       started = 1;
-       new_phase(PHASE_NETWORK);
+    new_phase(PHASE_NETWORK);
 
 #ifdef HAVE_MULTILINK
-       if (multilink) {
-           if (mp_join_bundle()) {
-               if (updetach && !nodetach)
-                   detach();
-               return;
-           }
+    if (multilink) {
+       if (mp_join_bundle()) {
+           if (updetach && !nodetach)
+               detach();
+           return;
        }
+    }
 #endif /* HAVE_MULTILINK */
 
 #ifdef PPP_FILTER
-       if (!demand)
-           set_filters(&pass_filter, &active_filter);
+    if (!demand)
+       set_filters(&pass_filter, &active_filter);
 #endif
-       /* Start CCP and ECP */
-       for (i = 0; (protp = protocols[i]) != NULL; ++i)
-           if ((protp->protocol == PPP_ECP || protp->protocol == PPP_CCP)
-               && protp->enabled_flag && protp->open != NULL)
-               (*protp->open)(0);
-    }
+    /* Start CCP and ECP */
+    for (i = 0; (protp = protocols[i]) != NULL; ++i)
+       if ((protp->protocol == PPP_ECP || protp->protocol == PPP_CCP)
+           && protp->enabled_flag && protp->open != NULL)
+           (*protp->open)(0);
 
     /*
-     * Bring up other network protocols after encryption has completed.
-     * OPENED here merely means that negotiation has completed.  It is
-     * up to the protocol to correctly terminate or disable LCP/NCP 
-     * based on the result of the negotiation.
+     * Bring up other network protocols iff encryption is not required.
      */
     ecp_required = ecp_gotoptions[unit].required;
     mppe_required = ccp_gotoptions[unit].mppe;
-    if ((!ecp_required && !mppe_required)
-       || (ecp_required && ecp_fsm[unit].state == OPENED)
-       || (mppe_required && ccp_fsm[unit].state == OPENED)) {
-       for (i = 0; (protp = protocols[i]) != NULL; ++i)
-           if (protp->protocol < 0xC000
-               && protp->protocol != PPP_CCP && protp->protocol != PPP_ECP
-               && protp->enabled_flag && protp->open != NULL) {
-               (*protp->open)(0);
-               ++num_np_open;
-           }
+    if (!ecp_required && !mppe_required)
+       continue_networks(unit);
+}
 
-       if (num_np_open == 0)
-           /* nothing to do */
-           lcp_close(0, "No network protocols running");
-    }
+void
+continue_networks(unit)
+    int unit;
+{
+    int i;
+    struct protent *protp;
+
+    /*
+     * Start the "real" network protocols.
+     */
+    for (i = 0; (protp = protocols[i]) != NULL; ++i)
+       if (protp->protocol < 0xC000
+           && protp->protocol != PPP_CCP && protp->protocol != PPP_ECP
+           && protp->enabled_flag && protp->open != NULL) {
+           (*protp->open)(0);
+           ++num_np_open;
+       }
+
+    if (num_np_open == 0)
+       /* nothing to do */
+       lcp_close(0, "No network protocols running");
 }
 
 /*
index 2941de5f7a5c79b72a603153866442850bcfdedb..54fc743e2a702fdc68051d2f25335c185ff6186f 100644 (file)
@@ -25,7 +25,7 @@
  * OR MODIFICATIONS.
  */
 
-#define RCSID  "$Id: ccp.c,v 1.38 2002/07/10 20:04:35 kad Exp $"
+#define RCSID  "$Id: ccp.c,v 1.39 2002/09/01 12:00:15 dfs Exp $"
 
 #include <stdlib.h>
 #include <string.h>
@@ -1421,7 +1421,7 @@ ccp_up(f)
     if (go->mppe) {
        BZERO(mppe_recv_key, MPPE_MAX_KEY_LEN);
        BZERO(mppe_send_key, MPPE_MAX_KEY_LEN);
-       start_networks(f->unit);                /* Bring up IP et al */
+       continue_networks(f->unit);             /* Bring up IP et al */
     }
 #endif
 }
index c295bb360864520b2d98e06d27f21ed2f66ec175..a48f69f2158500a8d906d3c79a47e1b39453bde0 100644 (file)
@@ -33,7 +33,7 @@
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#define RCSID  "$Id: chap.c,v 1.32 2002/05/21 17:26:49 dfs Exp $"
+#define RCSID  "$Id: chap.c,v 1.33 2002/09/01 12:00:15 dfs Exp $"
 
 /*
  * TODO:
@@ -500,7 +500,6 @@ ChapReceiveChallenge(cstate, inp, id, len)
     case CHAP_MICROSOFT:
        ChapMS(cstate, rchallenge, secret, secret_len,
               (MS_ChapResponse *) cstate->response);
-       cstate->resp_length = MS_CHAP_RESPONSE_LEN;
        break;
 
     case CHAP_MICROSOFT_V2:
@@ -509,7 +508,6 @@ ChapReceiveChallenge(cstate, inp, id, len)
                cstate->resp_name, secret, secret_len,
                (MS_Chap2Response *) cstate->response, cstate->earesponse,
                 MS_CHAP2_AUTHENTICATEE);
-       cstate->resp_length = MS_CHAP2_RESPONSE_LEN;
        break;
 #endif /* CHAPMS */
 
index 0f627fb5aedc8f5ac99428b7cd9ce0c89452890e..fb54843ce9634b41d943d5a7a6783d11930c13b1 100644 (file)
@@ -40,7 +40,7 @@
  *   Copyright (c) 2002 Google, Inc.
  */
 
-#define RCSID  "$Id: chap_ms.c,v 1.20 2002/04/02 14:15:07 dfs Exp $"
+#define RCSID  "$Id: chap_ms.c,v 1.21 2002/09/01 12:00:15 dfs Exp $"
 
 #ifdef CHAPMS
 
@@ -570,18 +570,19 @@ ChapMS(chap_state *cstate, u_char *rchallenge, char *secret, int secret_len,
 #endif
     BZERO(response, sizeof(*response));
 
-    /* Calculate both always */
     ChapMS_NT(rchallenge, secret, secret_len, response->NTResp);
 
 #ifdef MSLANMAN
     ChapMS_LANMan(rchallenge, secret, secret_len, response);
 
-    /* prefered method is set by option  */
+    /* preferred method is set by option  */
     response->UseNT[0] = !ms_lanman;
 #else
     response->UseNT[0] = 1;
 #endif
 
+    cstate->resp_length = MS_CHAP_RESPONSE_LENGTH;
+
 #ifdef MPPE
     Set_Start_Key(rchallenge, secret, secret_len);
 #endif
@@ -625,6 +626,9 @@ ChapMS2(chap_state *cstate, u_char *rchallenge, u_char *PeerChallenge,
     GenerateAuthenticatorResponse(secret, secret_len, response->NTResp,
                                  response->PeerChallenge, rchallenge,
                                  user, authResponse);
+
+    cstate->resp_length = MS_CHAP2_RESPONSE_LEN;
+
 #ifdef MPPE
     SetMasterKeys(secret, secret_len, response->NTResp, authenticator);
 #endif
index e2cc42808ef3c045c894dcd6b1e0bbc023ed22f6..1a5a10991325c97186f113dc7c60ab4be0f81e05 100644 (file)
@@ -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.71 2002/07/16 13:11:43 kad Exp $
+ * $Id: pppd.h,v 1.72 2002/09/01 12:00:15 dfs Exp $
  */
 
 /*
@@ -496,6 +496,7 @@ void link_terminated __P((int));  /* we are finished with the link */
 void link_down __P((int));       /* the LCP layer has left the Opened state */
 void link_established __P((int)); /* the link is up; authenticate now */
 void start_networks __P((int));   /* start all the network control protos */
+void continue_networks __P((int)); /* start network [ip, etc] control protos */
 void np_up __P((int, int));      /* a network protocol has come up */
 void np_down __P((int, int));    /* a network protocol has gone down */
 void np_finished __P((int, int)); /* a network protocol no longer needs link */