]> git.ozlabs.org Git - ppp.git/commitdiff
Ensure that MPPE keys are available when using a plugin.
authorFrank Cusack <fcusack@fcusack.com>
Mon, 23 Dec 2002 23:24:37 +0000 (23:24 +0000)
committerFrank Cusack <fcusack@fcusack.com>
Mon, 23 Dec 2002 23:24:37 +0000 (23:24 +0000)
pppd/ccp.c
pppd/chap_ms.c
pppd/chap_ms.h
pppd/plugins/radius/radius.c

index 18f2dc0cdbd871e6f6b613b7a7e3f185c943cc20..0e768b71ad2d426982fc3cdefb0b3c8718a68fe9 100644 (file)
@@ -33,7 +33,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: ccp.c,v 1.41 2002/12/04 23:03:32 paulus Exp $"
+#define RCSID  "$Id: ccp.c,v 1.42 2002/12/23 23:24:37 fcusack Exp $"
 
 #include <stdlib.h>
 #include <string.h>
@@ -44,7 +44,7 @@
 #include <net/ppp-comp.h>
 
 #ifdef MPPE
-#include "chap_ms.h"   /* mppe_xxxx_key */
+#include "chap_ms.h"   /* mppe_xxxx_key, mppe_keys_set */
 #include "lcp.h"       /* lcp_close(), lcp_fsm */
 #endif
 
@@ -578,6 +578,14 @@ ccp_resetci(f)
            return;
        }
 
+       /* A plugin (eg radius) may not have obtained key material. */
+       if (!mppe_keys_set) {
+           error("MPPE required, but keys are not available.  "
+                 "Possible plugin problem?");
+           lcp_close(f->unit, "MPPE required but not available");
+           return;
+       }
+
        /* LM auth not supported for MPPE */
        if (auth_done[f->unit] & (CHAP_MS_WITHPEER | CHAP_MS_PEER)) {
            /* This might be noise */
index e9946c9d8d6544fd770fd9406189e5a52af3b05b..0fe1888c150e9195c4a88c07c9ea11068f17a42a 100644 (file)
@@ -48,7 +48,7 @@
  *   Copyright (c) 2002 Google, Inc.
  */
 
-#define RCSID  "$Id: chap_ms.c,v 1.25 2002/12/04 23:03:32 paulus Exp $"
+#define RCSID  "$Id: chap_ms.c,v 1.26 2002/12/23 23:24:37 fcusack Exp $"
 
 #ifdef CHAPMS
 
@@ -99,6 +99,7 @@ bool  ms_lanman = 0;          /* Use LanMan password instead of NT */
 #ifdef MPPE
 u_char mppe_send_key[MPPE_MAX_KEY_LEN];
 u_char mppe_recv_key[MPPE_MAX_KEY_LEN];
+int mppe_keys_set = 0;         /* Have the MPPE keys been set? */
 #endif
 
 static void
@@ -461,6 +462,7 @@ ChapMS(chap_state *cstate, u_char *rchallenge, char *secret, int secret_len,
 
 #ifdef MPPE
     Set_Start_Key(rchallenge, secret, secret_len);
+    mppe_keys_set = 1;
 #endif
 }
 
@@ -507,6 +509,7 @@ ChapMS2(chap_state *cstate, u_char *rchallenge, u_char *PeerChallenge,
 
 #ifdef MPPE
     SetMasterKeys(secret, secret_len, response->NTResp, authenticator);
+    mppe_keys_set = 1;
 #endif
 }
 
index ae6b2485764ae74082e4fffc3b368387ad2c520c..f52f58d61f458a536fa4209643d09fe22416ce15 100644 (file)
@@ -27,7 +27,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: chap_ms.h,v 1.7 2002/12/04 23:03:32 paulus Exp $
+ * $Id: chap_ms.h,v 1.8 2002/12/23 23:24:37 fcusack Exp $
  */
 
 #ifndef __CHAPMS_INCLUDE__
@@ -71,6 +71,7 @@ typedef struct {
 #include <net/ppp-comp.h>      /* MPPE_MAX_KEY_LEN */
 extern u_char mppe_send_key[MPPE_MAX_KEY_LEN];
 extern u_char mppe_recv_key[MPPE_MAX_KEY_LEN];
+extern int mppe_keys_set;
 #endif
 
 /* Are we the authenticator or authenticatee?  For MS-CHAPv2 key derivation. */
index 5e27ee0b24ac3869331ff9214b71521d9d3bec44..48882a9e1c84be070d6a56e21e9c01b7704280e4 100644 (file)
@@ -24,7 +24,7 @@
 *
 ***********************************************************************/
 static char const RCSID[] =
-"$Id: radius.c,v 1.18 2002/11/13 18:19:26 fcusack Exp $";
+"$Id: radius.c,v 1.19 2002/12/23 23:24:37 fcusack Exp $";
 
 #include "pppd.h"
 #include "chap.h"
@@ -709,6 +709,7 @@ radius_setmppekeys(VALUE_PAIR *vp, REQUEST_INFO *req_info, chap_state *cstate)
      * to generate the start key, sigh.  NB: We do not support the LM-Key.
      */
     mppe_set_keys(cstate->challenge, &plain[8]);
+    mppe_keys_set = 1;
 
     return 0;    
 }
@@ -777,6 +778,7 @@ radius_setmppekeys2(VALUE_PAIR *vp, REQUEST_INFO *req_info)
        memcpy(mppe_send_key, plain + 1, 16);
     else
        memcpy(mppe_recv_key, plain + 1, 16);
+    mppe_keys_set = 1;
 
     return 0;
 }