From 51a074a18c82845991a4a547b0c20a15b364c910 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Mon, 1 Apr 2002 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2002-04-01 --- boot/boot.c | 11 +++++++++++ boot/bootauth.c | 24 ++++++++++++++++++++++++ boot/local.c | 1 + 3 files changed, 36 insertions(+) diff --git a/boot/boot.c b/boot/boot.c index 2d639147f9d5c3322b2200b0a921e0a05bd1b696..a41e3b436d8c0e788e1a076b90ed551592ee91e0 100644 --- a/boot/boot.c +++ b/boot/boot.c @@ -197,6 +197,16 @@ rootserver(char *arg) char *cp; int n; + /* look for required reply */ + readfile("#e/nobootprompt", reply, sizeof(reply)); + if(reply[0]){ + mp = findmethod(reply); + if(mp) + goto HaveMethod; + print("boot method %s not found\n", reply); + reply[0] = 0; + } + /* make list of methods */ mp = method; n = sprint(prompt, "root is from (%s", mp->name); @@ -221,6 +231,7 @@ rootserver(char *arg) outin(prompt, reply, sizeof(reply)); mp = findmethod(reply); if(mp){ + HaveMethod: bargc = tokenize(reply, bargv, Nbarg-1); cp = strchr(reply, '!'); if(cp) diff --git a/boot/bootauth.c b/boot/bootauth.c index 14cc4f73b7317d6ff62412ee4fd42272ea4f14b8..57663a97270043aa06ac3e99726b8bd124cb8912 100644 --- a/boot/bootauth.c +++ b/boot/bootauth.c @@ -5,6 +5,7 @@ #include "../boot/boot.h" char *authaddr; +static void glenda(void); void authentication(int cpuflag) @@ -12,6 +13,11 @@ authentication(int cpuflag) char *argv[16], **av; int ac; + if(access("/factotum", 0) < 0){ + glenda(); + return; + } + /* start agent */ ac = 0; av = argv; @@ -45,3 +51,21 @@ authentication(int cpuflag) if(cpuflag) return; } + +static void +glenda(void) +{ + int fd; + char *s; + + s = getenv("user"); + if(s == nil) + s = "glenda"; + + fd = open("#c/hostowner", OWRITE); + if(fd >= 0){ + if(write(fd, s, strlen(s)) != strlen(s)) + fprint(2, "setting #c/hostowner to %s: %r\n", s); + close(fd); + } +} diff --git a/boot/local.c b/boot/local.c index 85356bfba7cf8bc6abef111d895001b4878f0e1a..4702a1dfa07cd5ac3959cf9f19514135686fad3a 100644 --- a/boot/local.c +++ b/boot/local.c @@ -110,6 +110,7 @@ connectlocal(void) default: break; } + waitpid(); close(p[1]); return p[0];