~kris/9p

9hist

ref: e44792ff9c7d95ff8d7680e3f4eb1419930e8050 9hist/boot/userpasswd.c -rw-r--r-- 549 bytes
e44792ff — David du Colombier Plan 9 from Bell Labs 2001-08-08 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);
}