mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-27 11:52:03 +00:00
new uid world
This commit is contained in:
parent
63fcc2bc3c
commit
ca786c9f4e
1 changed files with 12 additions and 1 deletions
|
@ -2,6 +2,17 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
static int
|
||||||
|
isme(char *uid)
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
n = strtol(uid, &p, 10);
|
||||||
|
if(*p == 0 && p > uid)
|
||||||
|
return n == getuid();
|
||||||
|
return strcmp(getuser(), uid) == 0;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Absent other hints, it works reasonably well to use
|
* Absent other hints, it works reasonably well to use
|
||||||
* the X11 display name as the name space identifier.
|
* the X11 display name as the name space identifier.
|
||||||
|
@ -48,7 +59,7 @@ nsfromdisplay(void)
|
||||||
free(p);
|
free(p);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
if((d->mode&0777) != 0700 || strcmp(d->uid, getuser()) != 0){
|
if((d->mode&0777) != 0700 || !isme(d->uid)){
|
||||||
werrstr("bad name space dir %s", p);
|
werrstr("bad name space dir %s", p);
|
||||||
free(p);
|
free(p);
|
||||||
free(d);
|
free(d);
|
||||||
|
|
Loading…
Reference in a new issue