summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/cmd/cwfs/9p1.c2
-rw-r--r--sys/src/cmd/cwfs/9p2.c10
-rw-r--r--sys/src/cmd/cwfs/all.h1
-rw-r--r--sys/src/cmd/cwfs/con.c8
-rw-r--r--sys/src/cmd/cwfs/config.c15
5 files changed, 30 insertions, 6 deletions
diff --git a/sys/src/cmd/cwfs/9p1.c b/sys/src/cmd/cwfs/9p1.c
index 3c8b3af0c..2517f086e 100644
--- a/sys/src/cmd/cwfs/9p1.c
+++ b/sys/src/cmd/cwfs/9p1.c
@@ -82,7 +82,7 @@ authorize(Chan *cp, Fcall *in, Fcall *ou)
return 1;
if(strcmp(in->uname, "none") == 0)
- return 1;
+ return !nonone;
if(in->type == Toattach)
return 0;
diff --git a/sys/src/cmd/cwfs/9p2.c b/sys/src/cmd/cwfs/9p2.c
index 87736ab6e..692dcdceb 100644
--- a/sys/src/cmd/cwfs/9p2.c
+++ b/sys/src/cmd/cwfs/9p2.c
@@ -201,20 +201,20 @@ authorize(Chan* chan, Fcall* f)
db = cons.flags & authdebugflag;
- if(strcmp(f->uname, "none") == 0){
+ if(noauth || wstatallow){
uid = strtouid(f->uname);
if(db)
- fprint(2, "permission granted to none: uid %s = %d\n",
+ fprint(2, "permission granted by noauth uid %s = %d\n",
f->uname, uid);
return uid;
}
- if(noauth || wstatallow){
+ if(f->afid == NOFID && !nonone){
uid = strtouid(f->uname);
if(db)
- fprint(2, "permission granted by noauth uid %s = %d\n",
+ fprint(2, "permission granted to none: uid %s = %d\n",
f->uname, uid);
- return uid;
+ return 0; /* none */
}
af = filep(chan, f->afid, 0);
diff --git a/sys/src/cmd/cwfs/all.h b/sys/src/cmd/cwfs/all.h
index a74be73d8..89a15bea5 100644
--- a/sys/src/cmd/cwfs/all.h
+++ b/sys/src/cmd/cwfs/all.h
@@ -84,6 +84,7 @@ ulong chatflag;
ulong authdebugflag;
int noattach; /* attach is disabled */
int noauth; /* auth is disable */
+int nonone; /* attach as none disabled */
int noatime; /* atime is disabled */
int noatimeset; /* noatime was changed (reset after dump) */
int wstatallow; /* set to circumvent wstat permissions */
diff --git a/sys/src/cmd/cwfs/con.c b/sys/src/cmd/cwfs/con.c
index 201e4ac7e..00fadf6bb 100644
--- a/sys/src/cmd/cwfs/con.c
+++ b/sys/src/cmd/cwfs/con.c
@@ -694,6 +694,13 @@ cmd_noauth(int, char *[])
}
void
+cmd_nonone(int, char *[])
+{
+ nonone = !nonone;
+ print("none %s\n", nonone ? "disabled" : "enabled");
+}
+
+void
cmd_noattach(int, char *[])
{
noattach = !noattach;
@@ -767,6 +774,7 @@ installcmds(void)
cmd_install("hangup", "chan -- clunk files", cmd_hangup);
cmd_install("printconf", "-- print configuration", cmd_printconf);
cmd_install("noauth", "toggle noauth flag", cmd_noauth);
+ cmd_install("nonone", "toggle nonone flag", cmd_nonone);
cmd_install("noattach", "toggle noattach flag", cmd_noattach);
cmd_install("files", "report on files structure", cmd_files);
diff --git a/sys/src/cmd/cwfs/config.c b/sys/src/cmd/cwfs/config.c
index a9c87bb6c..bcb8b5e58 100644
--- a/sys/src/cmd/cwfs/config.c
+++ b/sys/src/cmd/cwfs/config.c
@@ -21,6 +21,7 @@ static Device* confdev;
static int copyworm = 0, copydev = 0;
static char *src, *dest;
+static int nononeset;
static int noauthset;
static int readonlyset;
static int resetparams;
@@ -432,6 +433,8 @@ mergeconf(Iobuf *p)
if(!noauthset)
noauth = 0;
+ if(!nononeset)
+ nonone = 0;
if(!noatimeset)
noatime = 0;
if(!readonlyset)
@@ -450,6 +453,9 @@ mergeconf(Iobuf *p)
} else if(strcmp(word, "noauth") == 0){
if(!noauthset)
noauth = 1;
+ } else if(strcmp(word, "nonone") == 0){
+ if(!nononeset)
+ nonone = 1;
} else if(strcmp(word, "noatime") == 0){
if(!noatimeset)
noatime = 1;
@@ -600,6 +606,8 @@ start:
fs->conf);
if(noauth)
cp = seprint(cp, ep, "noauth\n");
+ if(nonone)
+ cp = seprint(cp, ep, "nonone\n");
if(noatime)
cp = seprint(cp, ep, "noatime\n");
if(readonly)
@@ -1009,6 +1017,13 @@ arginit(void)
f.modconf = 1;
continue;
}
+ if(strcmp(word, "nonone") == 0) {
+ nonone = !nonone;
+ print("none %s\n", nonone ? "disabled" : "enabled");
+ nononeset++;
+ f.modconf = 1;
+ continue;
+ }
if(strcmp(word, "noatime") == 0) {
noatime = !noatime;
print("atime %s\n", noatime ? "disabled" : "enabled");