Deleted Added
full compact
chap.c (93418) chap.c (96324)
1/*-
2 * Copyright (c) 1996 - 2001 Brian Somers <brian@Awfulhak.org>
3 * based on work by Toshiharu OHNO <tony-o@iij.ad.jp>
4 * Internet Initiative Japan, Inc (IIJ)
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 11 unchanged lines hidden (view full) ---

20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
1/*-
2 * Copyright (c) 1996 - 2001 Brian Somers <brian@Awfulhak.org>
3 * based on work by Toshiharu OHNO <tony-o@iij.ad.jp>
4 * Internet Initiative Japan, Inc (IIJ)
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 11 unchanged lines hidden (view full) ---

20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: head/usr.sbin/ppp/chap.c 93418 2002-03-30 12:30:09Z brian $
28 * $FreeBSD: head/usr.sbin/ppp/chap.c 96324 2002-05-10 03:11:35Z brian $
29 */
30
31#include <sys/param.h>
32#include <netinet/in.h>
33#include <netinet/in_systm.h>
34#include <netinet/ip.h>
35#include <sys/socket.h>
36#include <sys/un.h>

--- 502 unchanged lines hidden (view full) ---

539#endif
540 ChapOutput(authp->physical, CHAP_CHALLENGE, authp->id,
541 chap->challenge.local, 1 + *chap->challenge.local + len, NULL);
542}
543
544static void
545chap_Success(struct authinfo *authp)
546{
29 */
30
31#include <sys/param.h>
32#include <netinet/in.h>
33#include <netinet/in_systm.h>
34#include <netinet/ip.h>
35#include <sys/socket.h>
36#include <sys/un.h>

--- 502 unchanged lines hidden (view full) ---

539#endif
540 ChapOutput(authp->physical, CHAP_CHALLENGE, authp->id,
541 chap->challenge.local, 1 + *chap->challenge.local + len, NULL);
542}
543
544static void
545chap_Success(struct authinfo *authp)
546{
547 struct bundle *bundle = authp->physical->dl->bundle;
547 const char *msg;
548 const char *msg;
549
548 datalink_GotAuthname(authp->physical->dl, authp->in.name);
549#ifndef NODES
550 if (authp->physical->link.lcp.want_authtype == 0x81) {
551 msg = auth2chap(authp)->authresponse;
552 MPPE_MasterKeyValid = 1; /* XXX Global ! */
553 } else
554#endif
550 datalink_GotAuthname(authp->physical->dl, authp->in.name);
551#ifndef NODES
552 if (authp->physical->link.lcp.want_authtype == 0x81) {
553 msg = auth2chap(authp)->authresponse;
554 MPPE_MasterKeyValid = 1; /* XXX Global ! */
555 } else
556#endif
557#ifndef NORADIUS
558 if (*bundle->radius.cfg.file && bundle->radius.repstr)
559 msg = bundle->radius.repstr;
560 else
561#endif
555 msg = "Welcome!!";
556
557 ChapOutput(authp->physical, CHAP_SUCCESS, authp->id, msg, strlen(msg),
558 NULL);
559
560 authp->physical->link.lcp.auth_ineed = 0;
562 msg = "Welcome!!";
563
564 ChapOutput(authp->physical, CHAP_SUCCESS, authp->id, msg, strlen(msg),
565 NULL);
566
567 authp->physical->link.lcp.auth_ineed = 0;
561 if (Enabled(authp->physical->dl->bundle, OPT_UTMP))
568 if (Enabled(bundle, OPT_UTMP))
562 physical_Login(authp->physical, authp->in.name);
563
564 if (authp->physical->link.lcp.auth_iwait == 0)
565 /*
566 * Either I didn't need to authenticate, or I've already been
567 * told that I got the answer right.
568 */
569 datalink_AuthOk(authp->physical->dl);
570}
571
572static void
573chap_Failure(struct authinfo *authp)
574{
575#ifndef NODES
569 physical_Login(authp->physical, authp->in.name);
570
571 if (authp->physical->link.lcp.auth_iwait == 0)
572 /*
573 * Either I didn't need to authenticate, or I've already been
574 * told that I got the answer right.
575 */
576 datalink_AuthOk(authp->physical->dl);
577}
578
579static void
580chap_Failure(struct authinfo *authp)
581{
582#ifndef NODES
576 char buf[1024];
583 char buf[1024], *ptr;
577#endif
578 const char *msg;
579
584#endif
585 const char *msg;
586
587#ifndef NORADIUS
588 struct bundle *bundle = authp->physical->link.lcp.fsm.bundle;
589 if (*bundle->radius.cfg.file && bundle->radius.errstr)
590 msg = bundle->radius.errstr;
591 else
592#endif
580#ifndef NODES
593#ifndef NODES
581 if (authp->physical->link.lcp.want_authtype == 0x81) {
582 char *ptr;
594 if (authp->physical->link.lcp.want_authtype == 0x80) {
595 sprintf(buf, "E=691 R=1 M=Invalid!");
596 msg = buf;
597 } else if (authp->physical->link.lcp.want_authtype == 0x81) {
583 int i;
584
585 ptr = buf;
586 ptr += sprintf(buf, "E=691 R=0 C=");
587 for (i=0; i<16; i++)
588 ptr += sprintf(ptr, "%02X", *(auth2chap(authp)->challenge.local+1+i));
589
590 sprintf(ptr, " V=3 M=Invalid!");

--- 349 unchanged lines hidden ---
598 int i;
599
600 ptr = buf;
601 ptr += sprintf(buf, "E=691 R=0 C=");
602 for (i=0; i<16; i++)
603 ptr += sprintf(ptr, "%02X", *(auth2chap(authp)->challenge.local+1+i));
604
605 sprintf(ptr, " V=3 M=Invalid!");

--- 349 unchanged lines hidden ---