History

20080111-1121

Charles.Forsyth committed 18 years ago

Commit 642c93f1 parent 78a84407 files · +51 −7Browse files

Unified · Split

7 files
  1. CHANGES +4 −0
  2. appl/lib/newns.b +25 −2
  3. dis/lib/newns.dis +0 −0
  4. include/version.h +1 −1
  5. man/2/INDEX +1 −0
  6. man/2/newns +19 −2
  7. module/newns.m +2 −3
CHANGES+4−0
@@ -1,3 +1,7 @@
120080111
2 add newuser to newns(2)
320080109
4 Sys->iounit should accept any valid file descriptor, not just ORDWR
120071227520071227
2 add styxflush(2) etc.6 add styxflush(2) etc.
3 add NetBSD, emu/NetBSD7 add NetBSD, emu/NetBSD
appl/lib/newns.b+25−2
@@ -272,7 +272,8 @@ mount(argv: list of string, facfd: ref Sys->FD): string · 271 unmodified lines
272 return ig(r, sys->sprint("cannot load %s: %r", Factotum->PATH));272 return ig(r, sys->sprint("cannot load %s: %r", Factotum->PATH));
273 factotum->init();273 factotum->init();
274 afd := sys->fauth(fd, spec);274 afd := sys->fauth(fd, spec);
275 ai := factotum->proxy(afd, facfd, "proto=p9any role=client"); # TO DO: something with ai275 if(afd != nil)
276 factotum->proxy(afd, facfd, "proto=p9any role=client"); # ignore result; if it fails, mount will fail
276 if(sys->mount(fd, afd, dir, r.flags, spec) < 0)277 if(sys->mount(fd, afd, dir, r.flags, spec) < 0)
277 return ig(r, sys->sprint("mount %q %q: %r", addr, dir));278 return ig(r, sys->sprint("mount %q %q: %r", addr, dir));
278 return nil;279 return nil;
@@ -351,7 +352,8 @@ import9(argv: list of string, facfd: ref Sys->FD): string · 72 unmodified lines
351 }352 }
352 # TO DO: new style: impo aan|nofilter clear|ssl|tls\n353 # TO DO: new style: impo aan|nofilter clear|ssl|tls\n
353 afd := sys->fauth(fd, "");354 afd := sys->fauth(fd, "");
354 ai := factotum->proxy(afd, facfd, "proto=p9any role=client"); # TO DO: something with ai355 if(afd != nil)
356 factotum->proxy(afd, facfd, "proto=p9any role=client");
355 if(sys->mount(fd, afd, dir, r.flags, "") < 0)357 if(sys->mount(fd, afd, dir, r.flags, "") < 0)
356 return ig(r, sys->sprint("import %q %q: %r", addr, dir));358 return ig(r, sys->sprint("import %q %q: %r", addr, dir));
357 return nil;359 return nil;
@@ -440,3 +442,24 @@ netmkaddr(addr, net, svc: string): string · 82 unmodified lines
440 return addr;442 return addr;
441 return sys->sprint("%s!%s", addr, svc);443 return sys->sprint("%s!%s", addr, svc);
442}444}
445
446newuser(user: string, cap: string, nsfile: string): string
447{
448 if(cap == nil)
449 return "no capability";
450
451 sys = load Sys Sys->PATH;
452 fd := sys->open("#¤/capuse", Sys->OWRITE);
453 if(fd == nil)
454 return sys->sprint("opening #¤/capuse: %r");
455
456 b := array of byte cap;
457 if(sys->write(fd, b, len b) < 0)
458 return sys->sprint("writing %s to #¤/capuse: %r", cap);
459
460 # mount factotum as new user (probably unhelpful if not factotum owner)
461 sys->unmount(nil, "/mnt/factotum");
462 sys->bind("#sfactotum", "/mnt/factotum", Sys->MREPL);
463
464 return newns(user, nsfile);
465}
dis/lib/newns.dis+0−0

Binary file not shown.

include/version.h+1−1
@@ -1 +1 @@
1#define VERSION "Fourth Edition (20080109)"1#define VERSION "Fourth Edition (20080111)"
man/2/INDEX+1−0
@@ -277,6 +277,7 @@ pathname names · 276 unmodified lines
277relative names277relative names
278rooted names278rooted names
279newns newns279newns newns
280newuser newns
280categories palmfile281categories palmfile
281dbinfo palmfile282dbinfo palmfile
282doc palmfile283doc palmfile
man/2/newns+19−2
@@ -1,12 +1,13 @@
1.TH NEWNS 21.TH NEWNS 2
2.SH NAME2.SH NAME
3newns \- build a new name space from a description file3Newns: newns, newuser \- build a new name space from a description file
4.SH SYNOPSIS4.SH SYNOPSIS
5.EX5.EX
6include "newns.m";6include "newns.m";
7ns := load Newns Newns->PATH;7ns := load Newns Newns->PATH;
8 8
9newns: fn(user: string, nsfile: string): string;9newns: fn(user: string, nsfile: string): string;
10newuser: fn(user: string, cap: string, nsfile: string): string;
10.EE11.EE
11.SH DESCRIPTION12.SH DESCRIPTION
12.B Newns13.B Newns
@@ -23,12 +24,28 @@ or empty, then · 10 unmodified lines
23.B newns24.B newns
24attempts to read file the file25attempts to read file the file
25.BR namespace .26.BR namespace .
27.PP
28.B Newuser
29uses a capability
30.I cap
31suitable for
32.IR cap (3)
33to change the current process's user name to
34.IR user ,
35and uses
36.B newns
37and
38.I nsfile
39to build it a new name space.
40The capability is typically obtained via
41.IR factotum (4).
26.SH SOURCE42.SH SOURCE
27.B /appl/lib/newns.b43.B /appl/lib/newns.b
28.SH SEE ALSO44.SH SEE ALSO
29.IR sys-bind (2),45.IR sys-bind (2),
30.IR sys-chdir (2),46.IR sys-chdir (2),
31.IR sys-pctl (2),47.IR sys-pctl (2),
48.IR factotum (4),
32.IR namespace (6)49.IR namespace (6)
33.SH BUGS50.SH BUGS
34The51The
module/newns.m+2−3
@@ -1,8 +1,7 @@
1Newns: module1Newns: module
2{2{
3 PATH: con "/dis/lib/newns.dis";3 PATH: con "/dis/lib/newns.dis";
4 #4
5 # Build a new namespace from a description file
6 #
7 newns: fn(user: string, nsfile: string): string;5 newns: fn(user: string, nsfile: string): string;
6 newuser: fn(user: string, cap: string, nsfile: string): string;
8};7};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t