Plan 9 from Bell Labs’s /usr/web/sources/extra/9hist/boot/bootauth.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


## diffname boot/bootauth.c 2001/0819
## diff -e /dev/null /n/emeliedump/2001/0819/sys/src/9/boot/bootauth.c
0a
#include <u.h>
#include <libc.h>
#include <auth.h>
#include <fcall.h>
#include "../boot/boot.h"

char	*authaddr;

void
authentication(int cpuflag)
{
	char *argv[16], **av;
	int ac;
	int factotumpid, pid;

	/* start agent */
	ac = 0;
	av = argv;
	av[ac++] = "factotum";
//av[ac++] = "-dt";
	if(cpuflag)
		av[ac++] = "-s";
	else
		av[ac++] = "-u";
	if(authaddr != nil){
		av[ac++] = "-a";
		av[ac++] = authaddr;
	}
	av[ac] = 0;
	switch(fork()){
	case -1:
		fatal("starting factotum: %r");
	case 0:
		exec("/factotum", av);
		fatal("execing /factotum");
	default:
		break;
	}

	/* wait for agent to really be there */
	while(access("/mnt/factotum", 0) < 0)
		sleep(250);

	if(cpuflag)
		return;
	/* ask for password */
#ifdef quux
	/* start agent */
	ac = 0;
	av = argv;
	av[ac++] = "factotum";
	av[ac++] = "-gd";
	av[ac++] = "p9sk1";
	av[ac++] = "cs.bell-labs.com";
	av[ac] = 0;
	switch((factotumpid = fork())){
	case -1:
		fatal("starting factotum: %r");
	case 0:
		exec("/factotum", av);
		fatal("execing /factotum");
	default:
		break;
	}

	for(;;){
		pid = waitpid();
		if(pid == factotumpid)
			break;
		if(pid == -1)
			fatal("waiting for factotum");
	}
#endif quux
}
.
## diffname boot/bootauth.c 2001/0820
## diff -e /n/emeliedump/2001/0819/sys/src/9/boot/bootauth.c /n/emeliedump/2001/0820/sys/src/9/boot/bootauth.c
46,73d
14d
## diffname boot/bootauth.c 2001/1106
## diff -e /n/emeliedump/2001/0820/sys/src/9/boot/bootauth.c /n/emeliedump/2001/1106/sys/src/9/boot/bootauth.c
19c
av[ac++] = "-dt";
.
## diffname boot/bootauth.c 2001/1107
## diff -e /n/emeliedump/2001/1106/sys/src/9/boot/bootauth.c /n/emeliedump/2001/1107/sys/src/9/boot/bootauth.c
19c
//av[ac++] = "-d";
.
14a
	/* make capabilities available to factotum */
	bind("#¤", "/dev", MAFTER);

.
## diffname boot/bootauth.c 2001/1121
## diff -e /n/emeliedump/2001/1107/sys/src/9/boot/bootauth.c /n/emeliedump/2001/1121/sys/src/9/boot/bootauth.c
26a
	av[ac++] = "-sfactotum";
.
24c
		av[ac++] = "-S";
.
## diffname boot/bootauth.c 2001/1130
## diff -e /n/emeliedump/2001/1121/sys/src/9/boot/bootauth.c /n/emeliedump/2001/1130/sys/src/9/boot/bootauth.c
15,17d
## diffname boot/bootauth.c 2001/1204
## diff -e /n/emeliedump/2001/1130/sys/src/9/boot/bootauth.c /n/emeliedump/2001/1204/sys/src/9/boot/bootauth.c
19a
//av[ac++] = "-D";	//9p messages
.
## diffname boot/bootauth.c 2002/0401
## diff -e /n/emeliedump/2001/1204/sys/src/9/boot/bootauth.c /n/emeliedump/2002/0401/sys/src/9/boot/bootauth.c
46a
}

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);
	}
.
14a
	if(access("/factotum", 0) < 0){
		glenda();
		return;
	}

.
7a
static void glenda(void);
.
## diffname boot/bootauth.c 2002/0421
## diff -e /n/emeliedump/2002/0401/sys/src/9/boot/bootauth.c /n/emeliedump/2002/0421/sys/src/9/boot/bootauth.c
16c
	if(access("/factotum", 05) < 0){
.
## diffname boot/bootauth.c 2002/0423
## diff -e /n/emeliedump/2002/0421/sys/src/9/boot/bootauth.c /n/emeliedump/2002/0423/sys/src/9/boot/bootauth.c
16c
	if(access("/factotum", AEXEC) < 0){
.
## diffname boot/bootauth.c 2002/1130
## diff -e /n/emeliedump/2002/0423/sys/src/9/boot/bootauth.c /n/emeliedump/2002/1130/sys/src/9/boot/bootauth.c
41,42c
		exec("/boot/factotum", av);
		fatal("execing /boot/factotum");
.
16c
	if(access("/boot/factotum", AEXEC) < 0){
.

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].