aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-06-12 17:51:56 +0000
committerrsc <devnull@localhost>2006-06-12 17:51:56 +0000
commitca786c9f4ef7c059230fe5c56539726edc3808ed (patch)
tree80f09aaeb36e813da3a1d17465ed525958325d8f
parent63fcc2bc3c1b37227cc9f5b9b8ca45ce091a1477 (diff)
downloadplan9port-ca786c9f4ef7c059230fe5c56539726edc3808ed.tar.gz
plan9port-ca786c9f4ef7c059230fe5c56539726edc3808ed.tar.bz2
plan9port-ca786c9f4ef7c059230fe5c56539726edc3808ed.zip
new uid world
-rw-r--r--src/lib9/getns.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib9/getns.c b/src/lib9/getns.c
index 29bc857c..923efc75 100644
--- a/src/lib9/getns.c
+++ b/src/lib9/getns.c
@@ -2,6 +2,17 @@
#include <libc.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
* the X11 display name as the name space identifier.
@@ -48,7 +59,7 @@ nsfromdisplay(void)
free(p);
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);
free(p);
free(d);