• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/src/router/ppp/pppd/

Lines Matching refs:cstate

128     chap_state *cstate = &chap[unit];
130 BZERO(cstate, sizeof(*cstate));
131 cstate->unit = unit;
132 cstate->clientstate = CHAPCS_INITIAL;
133 cstate->serverstate = CHAPSS_INITIAL;
134 cstate->timeouttime = CHAP_DEFTIMEOUT;
135 cstate->max_transmits = CHAP_DEFTRANSMITS;
150 chap_state *cstate = &chap[unit];
152 cstate->resp_name = our_name;
153 cstate->resp_type = digest;
155 if (cstate->clientstate == CHAPCS_INITIAL ||
156 cstate->clientstate == CHAPCS_PENDING) {
158 cstate->clientstate = CHAPCS_PENDING;
167 cstate->clientstate = CHAPCS_LISTEN;
180 chap_state *cstate = &chap[unit];
182 cstate->chal_name = our_name;
183 cstate->chal_type = digest;
185 if (cstate->serverstate == CHAPSS_INITIAL ||
186 cstate->serverstate == CHAPSS_PENDING) {
188 cstate->serverstate = CHAPSS_PENDING;
192 ChapGenChallenge(cstate);
193 ChapSendChallenge(cstate); /* crank it up dude! */
194 cstate->serverstate = CHAPSS_INITIAL_CHAL;
205 chap_state *cstate = (chap_state *) arg;
209 if (cstate->serverstate != CHAPSS_INITIAL_CHAL &&
210 cstate->serverstate != CHAPSS_RECHALLENGE)
213 if (cstate->chal_transmits >= cstate->max_transmits) {
216 cstate->serverstate = CHAPSS_BADAUTH;
217 auth_peer_fail(cstate->unit, PPP_CHAP);
221 ChapSendChallenge(cstate); /* Re-send challenge */
232 chap_state *cstate = (chap_state *) arg;
235 if (cstate->clientstate != CHAPCS_RESPONSE)
238 ChapSendResponse(cstate); /* re-send response */
249 chap_state *cstate = (chap_state *) arg;
252 if (cstate->serverstate != CHAPSS_OPEN)
255 ChapGenChallenge(cstate);
256 ChapSendChallenge(cstate);
257 cstate->serverstate = CHAPSS_RECHALLENGE;
270 chap_state *cstate = &chap[unit];
272 if (cstate->clientstate == CHAPCS_INITIAL)
273 cstate->clientstate = CHAPCS_CLOSED;
274 else if (cstate->clientstate == CHAPCS_PENDING)
275 cstate->clientstate = CHAPCS_LISTEN;
277 if (cstate->serverstate == CHAPSS_INITIAL)
278 cstate->serverstate = CHAPSS_CLOSED;
279 else if (cstate->serverstate == CHAPSS_PENDING) {
280 ChapGenChallenge(cstate);
281 ChapSendChallenge(cstate);
282 cstate->serverstate = CHAPSS_INITIAL_CHAL;
296 chap_state *cstate = &chap[unit];
299 if (cstate->serverstate == CHAPSS_INITIAL_CHAL ||
300 cstate->serverstate == CHAPSS_RECHALLENGE)
301 UNTIMEOUT(ChapChallengeTimeout, cstate);
302 else if (cstate->serverstate == CHAPSS_OPEN
303 && cstate->chal_interval != 0)
304 UNTIMEOUT(ChapRechallenge, cstate);
305 if (cstate->clientstate == CHAPCS_RESPONSE)
306 UNTIMEOUT(ChapResponseTimeout, cstate);
308 cstate->clientstate = CHAPCS_INITIAL;
309 cstate->serverstate = CHAPSS_INITIAL;
320 chap_state *cstate = &chap[unit];
322 if (cstate->serverstate != CHAPSS_INITIAL &&
323 cstate->serverstate != CHAPSS_CLOSED)
325 if (cstate->clientstate != CHAPCS_INITIAL &&
326 cstate->clientstate != CHAPCS_CLOSED)
341 chap_state *cstate = &chap[unit];
373 ChapReceiveChallenge(cstate, inp, id, len);
377 ChapReceiveResponse(cstate, inp, id, len);
381 ChapReceiveFailure(cstate, inp, id, len);
385 ChapReceiveSuccess(cstate, inp, id, len);
399 ChapReceiveChallenge(cstate, inp, id, len)
400 chap_state *cstate;
413 if (cstate->clientstate == CHAPCS_CLOSED ||
414 cstate->clientstate == CHAPCS_PENDING) {
415 CHAPDEBUG(("ChapReceiveChallenge: in state %d", cstate->clientstate));
446 if (!get_secret(cstate->unit, cstate->resp_name, rhostname,
453 if (cstate->clientstate == CHAPCS_RESPONSE)
454 UNTIMEOUT(ChapResponseTimeout, cstate);
456 cstate->resp_id = id;
457 cstate->resp_transmits = 0;
460 switch (cstate->resp_type) {
464 MD5Update(&mdContext, &cstate->resp_id, 1);
468 BCOPY(hash, cstate->response, MD5_SIGNATURE_SIZE);
469 cstate->resp_length = MD5_SIGNATURE_SIZE;
474 ChapMS(cstate, (char *)rchallenge, rchallenge_len, secret, secret_len);
479 CHAPDEBUG(("unknown digest type %d", cstate->resp_type));
484 ChapSendResponse(cstate);
492 ChapReceiveResponse(cstate, inp, id, len)
493 chap_state *cstate;
506 if (cstate->serverstate == CHAPSS_CLOSED ||
507 cstate->serverstate == CHAPSS_PENDING) {
508 CHAPDEBUG(("ChapReceiveResponse: in state %d", cstate->serverstate));
512 if (id != cstate->chal_id)
520 if (cstate->serverstate == CHAPSS_OPEN) {
521 ChapSendStatus(cstate, CHAP_SUCCESS);
524 if (cstate->serverstate == CHAPSS_BADAUTH) {
525 ChapSendStatus(cstate, CHAP_FAILURE);
543 UNTIMEOUT(ChapChallengeTimeout, cstate);
555 if (!get_secret(cstate->unit, (explicit_remote? remote_name: rhostname),
556 cstate->chal_name, secret, &secret_len, 1)) {
561 switch (cstate->chal_type) {
567 MD5Update(&mdContext, &cstate->chal_id, 1);
569 MD5Update(&mdContext, cstate->challenge, cstate->chal_len);
578 CHAPDEBUG(("unknown digest type %d", cstate->chal_type));
583 ChapSendStatus(cstate, code);
586 old_state = cstate->serverstate;
587 cstate->serverstate = CHAPSS_OPEN;
589 auth_peer_success(cstate->unit, PPP_CHAP, rhostname, len);
591 if (cstate->chal_interval != 0)
592 TIMEOUT(ChapRechallenge, cstate, cstate->chal_interval);
597 cstate->serverstate = CHAPSS_BADAUTH;
598 auth_peer_fail(cstate->unit, PPP_CHAP);
606 ChapReceiveSuccess(cstate, inp, id, len)
607 chap_state *cstate;
613 if (cstate->clientstate == CHAPCS_OPEN)
617 if (cstate->clientstate != CHAPCS_RESPONSE) {
619 CHAPDEBUG(("ChapReceiveSuccess: in state %d\n", cstate->clientstate));
623 UNTIMEOUT(ChapResponseTimeout, cstate);
631 cstate->clientstate = CHAPCS_OPEN;
633 auth_withpeer_success(cstate->unit, PPP_CHAP);
641 ChapReceiveFailure(cstate, inp, id, len)
642 chap_state *cstate;
647 if (cstate->clientstate != CHAPCS_RESPONSE) {
649 CHAPDEBUG(("ChapReceiveFailure: in state %d\n", cstate->clientstate));
653 UNTIMEOUT(ChapResponseTimeout, cstate);
662 auth_withpeer_fail(cstate->unit, PPP_CHAP);
670 ChapSendChallenge(cstate)
671 chap_state *cstate;
677 chal_len = cstate->chal_len;
678 name_len = strlen(cstate->chal_name);
685 PUTCHAR(cstate->chal_id, outp);
689 BCOPY(cstate->challenge, outp, chal_len);
692 BCOPY(cstate->chal_name, outp, name_len); /* append hostname */
694 output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN);
696 TIMEOUT(ChapChallengeTimeout, cstate, cstate->timeouttime);
697 ++cstate->chal_transmits;
705 ChapSendStatus(cstate, code)
706 chap_state *cstate;
725 PUTCHAR(cstate->chal_id, outp);
728 output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN);
734 * string and its length are stored in *cstate, and various other fields of
735 * *cstate are initialized.
739 ChapGenChallenge(cstate)
740 chap_state *cstate;
743 u_char *ptr = cstate->challenge;
751 cstate->chal_len = chal_len;
752 cstate->chal_id = ++cstate->id;
753 cstate->chal_transmits = 0;
762 * in *cstate.
766 ChapSendResponse(cstate)
767 chap_state *cstate;
772 md_len = cstate->resp_length;
773 name_len = strlen(cstate->resp_name);
780 PUTCHAR(cstate->resp_id, outp); /* copy id from challenge packet */
784 BCOPY(cstate->response, outp, md_len); /* copy MD to buffer */
787 BCOPY(cstate->resp_name, outp, name_len); /* append our name */
790 output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN);
792 cstate->clientstate = CHAPCS_RESPONSE;
793 TIMEOUT(ChapResponseTimeout, cstate, cstate->timeouttime);
794 ++cstate->resp_transmits;