aux/listen1: allow alternative namespace when running as user none with -n option

This commit is contained in:
cinap_lenrek 2015-10-10 00:09:02 +02:00
parent bab31af707
commit 47682ee42a
2 changed files with 7 additions and 1 deletions

View file

@ -20,6 +20,8 @@ listen, listen1, tcp7, tcp9, tcp19, tcp21, tcp22, tcp23, tcp25, tcp53, tcp110, t
]
.RB [ -p
.IR maxprocs ]
.RB [ -n
.IR namespace ]
.I addr
.I cmd
[

View file

@ -5,6 +5,7 @@
int maxprocs;
int verbose;
int trusted;
char *nsfile;
void
usage(void)
@ -22,7 +23,7 @@ becomenone(void)
if(fd < 0 || write(fd, "none", strlen("none")) < 0)
sysfatal("can't become none: %r");
close(fd);
if(newns("none", nil) < 0)
if(newns("none", nsfile) < 0)
sysfatal("can't build namespace: %r");
}
@ -69,6 +70,9 @@ main(int argc, char **argv)
case 'p':
maxprocs = atoi(EARGF(usage()));
break;
case 'n':
nsfile = EARGF(usage());
break;
}ARGEND
if(argc < 2)