~kris/9p

9hist

ref: 0d941989b452d48363e8af021d1c89eebbbc8a97 9hist/boot/userpasswd.c -rw-r--r-- 549 bytes
0d941989 — David du Colombier Plan 9 from Bell Labs 2001-11-01 24 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);
}