~kris/9p

9hist

51a074a18c82845991a4a547b0c20a15b364c910 — David du Colombier 24 years ago fd9e111
Plan 9 from Bell Labs 2002-04-01
3 files changed, 36 insertions(+), 0 deletions(-)

M boot/boot.c
M boot/bootauth.c
M boot/local.c
M boot/boot.c => boot/boot.c +11 -0
@@ 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)

M boot/bootauth.c => boot/bootauth.c +24 -0
@@ 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);
	}
}

M boot/local.c => boot/local.c +1 -0
@@ 110,6 110,7 @@ connectlocal(void)
	default:
		break;
	}
	waitpid();

	close(p[1]);
	return p[0];