ref: 2eed9bfe084e7c24ae0bbe776e8e26b4da814707
parent: d54980f5320e55083b74a03f87f5f9fd4251319e
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Fri Dec 7 04:53:08 EST 2012
cwfs: allow previously authorized channels to attach as none we allow allow previously authorized channels to attach as none even if anonymous logins are disabled with nonone.
--- a/sys/src/cmd/cwfs/9p1.c
+++ b/sys/src/cmd/cwfs/9p1.c
@@ -82,7 +82,7 @@
return 1;
if(strcmp(in->uname, "none") == 0)
- return !nonone;
+ return !nonone || cp->authok;
if(in->type == Toattach)
return 0;
@@ -144,6 +144,8 @@
a.num = AuthAs;
memmove(a.chal, aip->rchal, CHALLEN);
convA2M9p1(&a, ou->rauth, t.key);
+
+ cp->authok = 1;
return 1;
}
--- a/sys/src/cmd/cwfs/9p2.c
+++ b/sys/src/cmd/cwfs/9p2.c
@@ -209,7 +209,7 @@
return uid;
}
- if(f->afid == NOFID && !nonone){+ if(f->afid == NOFID && (!nonone || chan->authok)){uid = strtouid(f->uname);
if(db)
fprint(2, "permission granted to none: uid %s = %d\n",
@@ -230,6 +230,10 @@
if(db)
fprint(2, "authorize: uid is %d\n", uid);
qunlock(af);
+
+ if(uid > 0)
+ chan->authok = 1;
+
return uid;
}
--- a/sys/src/cmd/cwfs/portdat.h
+++ b/sys/src/cmd/cwfs/portdat.h
@@ -263,6 +263,7 @@
Queue* send;
Queue* reply;
+ int authok;
uchar authinfo[64];
void* pdata; /* sometimes is a Netconn* */
--- a/sys/src/cmd/cwfs/srv.c
+++ b/sys/src/cmd/cwfs/srv.c
@@ -182,6 +182,7 @@
chan->msize = 0;
chan->whotime = 0;
snprint(chan->whochan, sizeof(chan->whochan), "%s", name);
+ chan->authok = 0;
incref(srv);
srv->chan = chan;
--
⑨