From 54a40794ed58c688254a3c4f4b0cc8377e424815 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 2 Apr 1993 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1993-04-02 --- boot/boot.c | 1 - boot/doauthenticate.c | 4 ++-- pc/bbmalloc.c | 14 +++++++++++++- pc/devvga.c | 1 + pc/fns.h | 1 + port/auth.c | 7 ++++++- port/devcons.c | 4 ++-- 7 files changed, 25 insertions(+), 7 deletions(-) diff --git a/boot/boot.c b/boot/boot.c index c2d13531bf163e3c2353e0d9341032458e828a97..9be8af01b07829fccb84151a23e59779ff3385a7 100644 --- a/boot/boot.c +++ b/boot/boot.c @@ -94,7 +94,6 @@ boot(int argc, char *argv[]) if(fd < 0) fatal("can't connect to file server"); if(!islocal && !ishybrid){ - nop(fd); if(cfs) fd = (*cfs)(fd); doauthenticate(fd, mp); diff --git a/boot/doauthenticate.c b/boot/doauthenticate.c index fc460754279dde58b098b442bf15b48a9fe427bf..f2a2bde9d9e0ed1e197eab453dad89dd9db91ffd 100644 --- a/boot/doauthenticate.c +++ b/boot/doauthenticate.c @@ -101,12 +101,12 @@ checkkey(Method *mp, char *name, char *key) strcpy(tr.uid, name); convTR2M(&tr, trbuf); msg = fromauth(mp, trbuf, tbuf); - if(msg) - return msg; if(msg == ccmsg){ fprint(2, "boot: can't contact auth server, passwd unchecked\n"); return 0; } + if(msg) + return msg; convM2T(tbuf, &t, key); if(t.num == AuthTc && strcmp(name, t.cuid)==0) return 0; diff --git a/pc/bbmalloc.c b/pc/bbmalloc.c index 298620e336de09d5f333edd7f5d50c705a4b34fc..f1087f1dc9325cf89b950fb25832d96bbf63e425 100644 --- a/pc/bbmalloc.c +++ b/pc/bbmalloc.c @@ -18,7 +18,7 @@ enum { nbbarena=4096 /* number of words in an arena */ }; -static ulong bbarena[narena][nbbarena]; +static ulong *bbarena[narena]; static ulong *bbcur[narena] = {&bbarena[0][0], &bbarena[1][0]}; static ulong *bblast[narena] = {0, 0}; @@ -43,6 +43,18 @@ bbmalloc(int nbytes) return ans; } +void +bbinit(void) +{ + int i; + + if(bbarena[0]) + return; + for(i = 0; i < narena; i++) + bbarena[i] = xalloc(nbbarena); +} + + void bbfree(void *p, int n) { diff --git a/pc/devvga.c b/pc/devvga.c index 8f85b3d40221df3ee0dbc32b5ea0e0298173f67f..e38ebf8cf40b77bbc766057a33231482c0ae1e30 100644 --- a/pc/devvga.c +++ b/pc/devvga.c @@ -293,6 +293,7 @@ vgawrite(Chan *c, void *buf, long n, ulong offset) || ldepth > 3 || ldepth < 0) error(Ebadarg); cursoroff(1); + bbinit(); setscreen(maxx, maxy, ldepth); cursoron(1); return n; diff --git a/pc/fns.h b/pc/fns.h index a510d4276ad8241419408345fdbc8a906197d03f..41061c4e82128f8b1b9e66eab302b2856e31d312 100644 --- a/pc/fns.h +++ b/pc/fns.h @@ -1,6 +1,7 @@ #include "../port/portfns.h" void meminit(void); +void bbinit(void); void bigcursor(void); void bootargs(ulong); #define clearmmucache() /* 386 doesn't have one */ diff --git a/port/auth.c b/port/auth.c index 239a9ab10990008cc40c63b1edcaa6334e23dd77..ae72d24848e6a335ccbde5831970dbad018ebe64 100644 --- a/port/auth.c +++ b/port/auth.c @@ -135,7 +135,10 @@ sysfsession(ulong *arg) n = convS2M(f, buf); if((*devtab[c->type].write)(c, buf, n, 0) != n) error(Emountrpc); + dkhack: n = (*devtab[c->type].read)(c, buf, MAXMSG, 0); + if(n == 2 && buf[0] == 'O' && buf[1] == 'K') + goto dkhack; if(convM2S(buf, f, n) == 0) error(Emountrpc); if(f->type == Rsession){ @@ -409,8 +412,10 @@ authcheck(Chan *c, char *a, int n) c->aux = newcrypt(); cp = c->aux; convM2T(a, &cp->t, evekey); - if(cp->t.num != AuthTc || strcmp(u->p->user, cp->t.cuid)) + if(cp->t.num != AuthTc) error(Ebadarg); + if(strcmp(u->p->user, cp->t.cuid)) + error(cp->t.cuid); convM2A(a+TICKETLEN, &cp->a, cp->t.key); if(cp->a.num != AuthAs || memcmp(cp->t.chal, cp->a.chal, CHALLEN)) error(Eperm); diff --git a/port/devcons.c b/port/devcons.c index 766d5cbefcf6b32617406c1fe41024081e66eff6..4f362b9054d67b848ddb2c634e634ce81e898623 100644 --- a/port/devcons.c +++ b/port/devcons.c @@ -354,8 +354,8 @@ Dirtab consdir[]={ "cons", {Qcons}, 0, 0660, "consctl", {Qconsctl}, 0, 0220, "cputime", {Qcputime}, 6*NUMSIZE, 0444, - "hostdomain", {Qhostdomain}, DOMLEN, 0622, - "hostowner", {Qhostowner}, NAMELEN, 0622, + "hostdomain", {Qhostdomain}, DOMLEN, 0664, + "hostowner", {Qhostowner}, NAMELEN, 0664, "hz", {Qhz}, NUMSIZE, 0666, "key", {Qkey}, DESKEYLEN, 0622, "klog", {Qklog}, 0, 0444,