shithub: riscv

ref: 9ced712a2ad70557a8ceb89ff3b969b92c85f68c
dir: /sys/src/cmd/upas/common/become.c/

View raw version
#include "common.h"
#include <auth.h>
#include <ndb.h>

/*
 *  become powerless user
 */
int
become(char **, char *who)
{
	if(strcmp(who, "none") == 0) {
		if(procsetuser("none") < 0) {
			werrstr("can't become none: %r");
			return -1;
		}
		if(newns("none", nil) < 0) {
			werrstr("can't set new namespace: %r");
			return -1;
		}
	}
	return 0;
}