Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include "common.h"
2
#include <auth.h>
3
#include <ndb.h>
4
 
5
/*
6
 *  become powerless user
7
 */
8
int
9
become(char **cmd, char *who)
10
{
11
	int fd;
12
 
13
	USED(cmd);
14
	if(strcmp(who, "none") == 0) {
15
		fd = open("#c/user", OWRITE);
16
		if(fd < 0 || write(fd, "none", strlen("none")) < 0) {
17
			werrstr("can't become none");
18
			return -1;
19
		}
20
		close(fd);
21
		if(newns("none", 0)) {
22
			werrstr("can't set new namespace");
23
			return -1;
24
		}
25
	}
26
	return 0;
27
}
28