~kris/9p

9hist

ref: 8bae60a2e35f5e4eec0866a39c035624fd96c060 9hist/boot/userpasswd.c -rw-r--r-- 549 bytes
8bae60a2 — David du Colombier Plan 9 from Bell Labs 2001-08-13 25 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <u.h>
#include <libc.h>
#include <auth.h>
#include <../boot/boot.h>

char	username[64];
char	password[64];
#ifdef asdf
extern	char *sauth;
#endif asdf

char *homsg = "can't set user name or key; please reboot";

/*
 *  get/set user name.
 */
void
setusername(int, Method*)
{
	if(*username == 0 || strcmp(username, "none") == 0){
		strcpy(username, "none");
		outin("user", username, sizeof(username));
	}

	/* set host's owner (and uid of current process) */
	if(writefile("#c/hostowner", username, strlen(username)) < 0)
		fatal(homsg);
}