aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/upas/common/become.c
blob: 1b5aa4569be8d2af6d9ff8aff90721ea6052fefe (plain)
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 "common.h"
#include <auth.h>
#include <ndb.h>

/*
 *  become powerless user
 */
int
become(char **cmd, char *who)
{
	int fd;

	USED(cmd);
	if(strcmp(who, "none") == 0) {
		fd = open("#c/user", OWRITE);
		if(fd < 0 || write(fd, "none", strlen("none")) < 0) {
			werrstr("can't become none");
			return -1;
		}
		close(fd);
		// jpc if(newns("none", 0)) {
		// jpc 	werrstr("can't set new namespace");
		// jpc	return -1;
		// jpc }
	}
	return 0;
}