* 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>
 #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
 
            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 */
 
  *   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
 
 #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
 
 #ifdef MPPE
     Set_Start_Key(rchallenge, secret, secret_len);
+    mppe_keys_set = 1;
 #endif
 }
 
 
 #ifdef MPPE
     SetMasterKeys(secret, secret_len, response->NTResp, authenticator);
+    mppe_keys_set = 1;
 #endif
 }
 
 
  * 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__
 #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. */
 
 *
 ***********************************************************************/
 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"
      * 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;    
 }
        memcpy(mppe_send_key, plain + 1, 16);
     else
        memcpy(mppe_recv_key, plain + 1, 16);
+    mppe_keys_set = 1;
 
     return 0;
 }