From 71b7bef30bb2744136a003b31d27866a7e5a9fa2 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sat, 4 Apr 1998 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1998-04-04 --- pc/archgeneric.c | 1 + port/auth.c | 24 +++++++++++++++++++++++- port/portfns.h | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/pc/archgeneric.c b/pc/archgeneric.c index 4276ab1fe301efad7da71e5923905b3821c41a0d..f243ceadbc9799ee2624ae480fcbb99e893dc8ae 100644 --- a/pc/archgeneric.c +++ b/pc/archgeneric.c @@ -60,6 +60,7 @@ static X86type x86type[] = { 5, 7, 23, "P54C VRT", }, { 6, 1, 16, "PentiumPro", },/* determined by trial and error */ { 6, 3, 16, "PentiumII", }, /* determined by trial and error */ + { 6, 5, 16, "PentiumII", }, /* determined by trial and error */ { 3, -1, 32, "386", }, /* family defaults */ { 4, -1, 22, "486", }, diff --git a/port/auth.c b/port/auth.c index dbbb9b2f197edf7dfee2a53735d1a804af992950..f36f436cbcaef8dad6d634c16cffa7d13149c40c 100644 --- a/port/auth.c +++ b/port/auth.c @@ -477,6 +477,24 @@ authcheck(Chan *c, char *a, int n) return n; } +/* + * reading authcheck after writing into it yields the + * nonce key + */ +long +authcheckread(Chan *c, char *a, int n) +{ + Crypt *cp; + + cp = c->aux; + if(cp == nil) + error(Ebadarg); + if(n < TICKETLEN)) + error(Ebadarg); + convT2M(&cp->t, a, nil); + return sizeof(cp->t); +} + /* * called by devcons() for #c/authenticator * @@ -522,7 +540,11 @@ authentread(Chan *c, char *a, int n) cp->a.num = AuthAc; memmove(cp->a.chal, cp->t.chal, CHALLEN); convA2M(&cp->a, cp->tbuf, cp->t.key); - memmove(a, cp->tbuf, AUTHENTLEN); + + if(n >= AUTHENTLEN) + memmove(a, cp->tbuf, AUTHENTLEN); + if(n >= AUTHENTLEN + TICKETLEN) + convT2M(&cp->t, a+AUTHENTLEN, nil); return n; } diff --git a/port/portfns.h b/port/portfns.h index 56f12dd3b17182a841c63760a58aafee6dacd888..1b1217d7a361e76e9c9adbe7fe67de1c47d2f743 100644 --- a/port/portfns.h +++ b/port/portfns.h @@ -9,6 +9,7 @@ int anyhigher(void); int anyready(void); Image* attachimage(int, Chan*, ulong, ulong); long authcheck(Chan*, char*, int); +long authcheckread(Chan*, char*, int n); void authclose(Chan*); long authentread(Chan*, char*, int); long authentwrite(Chan*, char*, int);