Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net PR/51464: Shoichi YAMAGUCHI: chap authenticator of p...



details:   https://anonhg.NetBSD.org/src/rev/534a9f9a2f0f
branches:  trunk
changeset: 817793:534a9f9a2f0f
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Sep 09 12:41:14 2016 +0000

description:
PR/51464: Shoichi YAMAGUCHI: chap authenticator of pppoe does not work

diffstat:

 sys/net/if_spppsubr.c |  24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diffs (81 lines):

diff -r 218a9cd8cca5 -r 534a9f9a2f0f sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Fri Sep 09 06:34:10 2016 +0000
+++ b/sys/net/if_spppsubr.c     Fri Sep 09 12:41:14 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.147 2016/08/06 22:03:45 pgoyette Exp $        */
+/*     $NetBSD: if_spppsubr.c,v 1.148 2016/09/09 12:41:14 christos Exp $        */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.147 2016/08/06 22:03:45 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.148 2016/09/09 12:41:14 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -4054,20 +4054,20 @@
                        sppp_print_bytes(value, value_len);
                        addlog(">\n");
                }
-               if (value_len != sizeof(sp->myauth.challenge)) {
+               if (value_len != sizeof(sp->hisauth.challenge)) {
                        if (debug)
                                log(LOG_DEBUG,
                                    "%s: chap bad hash value length: "
-                                   "%d bytes, should be %ld\n",
+                                   "%d bytes, should be %zu\n",
                                    ifp->if_xname, value_len,
-                                   (long) sizeof(sp->myauth.challenge));
+                                   sizeof(sp->hisauth.challenge));
                        goto chap_failure;
                }
 
                MD5Init(&ctx);
                MD5Update(&ctx, &h->ident, 1);
                MD5Update(&ctx, sp->hisauth.secret, sp->hisauth.secret_len);
-               MD5Update(&ctx, sp->myauth.challenge, sizeof(sp->myauth.challenge));
+               MD5Update(&ctx, sp->hisauth.challenge, sizeof(sp->hisauth.challenge));
                MD5Final(digest, &ctx);
 
 #define FAILMSG "Failed..."
@@ -4130,7 +4130,7 @@
 static void
 sppp_chap_open(struct sppp *sp)
 {
-       if (sp->myauth.proto == PPP_CHAP &&
+       if (sp->hisauth.proto == PPP_CHAP &&
            (sp->lcp.opts & (1 << LCP_OPT_AUTH_PROTO)) != 0) {
                /* we are authenticator for CHAP, start it */
                chap.scr(sp);
@@ -4265,24 +4265,22 @@
        uint32_t *ch;
        u_char clen = 4 * sizeof(uint32_t);
 
-       if (sp->myauth.name == NULL) {
+       if (sp->hisauth.name == NULL) {
            /* can't do anything useful */
-           printf("%s: chap starting without my name being set\n",
+           printf("%s: chap starting without his name being set\n",
                sp->pp_if.if_xname);
            return;
        }
 
        /* Compute random challenge. */
-       ch = (uint32_t *)sp->myauth.challenge;
+       ch = (uint32_t *)sp->hisauth.challenge;
        cprng_strong(kern_cprng, ch, clen, 0);
 
        sp->confid[IDX_CHAP] = ++sp->pp_seq[IDX_CHAP];
 
        sppp_auth_send(&chap, sp, CHAP_CHALLENGE, sp->confid[IDX_CHAP],
                       sizeof clen, (const char *)&clen,
-                      sizeof(sp->myauth.challenge), sp->myauth.challenge,
-                      sp->myauth.name_len,
-                      sp->myauth.name,
+                      sizeof(sp->hisauth.challenge), sp->hisauth.challenge,
                       0);
 }
 



Home | Main Index | Thread Index | Old Index