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++) {
}
-------------
-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
* 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>
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");
}
/*
* 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>
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
}
* 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:
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:
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 */
* 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
#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
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
* 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 $
*/
/*
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 */