diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-12-07 09:53:08 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-12-07 09:53:08 +0100 |
commit | 950706198644c4715efbc95ec79857fd4fa55353 (patch) | |
tree | 585bcd04140cbaf7e8b788b68ba737d6555be897 /sys | |
parent | 52b500af6185068233ff021b2160463192f69ef0 (diff) |
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.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/src/cmd/cwfs/9p1.c | 4 | ||||
-rw-r--r-- | sys/src/cmd/cwfs/9p2.c | 6 | ||||
-rw-r--r-- | sys/src/cmd/cwfs/portdat.h | 1 | ||||
-rw-r--r-- | sys/src/cmd/cwfs/srv.c | 1 |
4 files changed, 10 insertions, 2 deletions
diff --git a/sys/src/cmd/cwfs/9p1.c b/sys/src/cmd/cwfs/9p1.c index 2517f086e..3c9a0a190 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 !nonone; + return !nonone || cp->authok; if(in->type == Toattach) return 0; @@ -145,6 +145,8 @@ authorize(Chan *cp, Fcall *in, Fcall *ou) memmove(a.chal, aip->rchal, CHALLEN); convA2M9p1(&a, ou->rauth, t.key); + cp->authok = 1; + return 1; } diff --git a/sys/src/cmd/cwfs/9p2.c b/sys/src/cmd/cwfs/9p2.c index 692dcdceb..8c34691f5 100644 --- a/sys/src/cmd/cwfs/9p2.c +++ b/sys/src/cmd/cwfs/9p2.c @@ -209,7 +209,7 @@ authorize(Chan* chan, Fcall* f) 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 @@ authorize(Chan* chan, Fcall* f) if(db) fprint(2, "authorize: uid is %d\n", uid); qunlock(af); + + if(uid > 0) + chan->authok = 1; + return uid; } diff --git a/sys/src/cmd/cwfs/portdat.h b/sys/src/cmd/cwfs/portdat.h index fba14dbbe..d2af352e0 100644 --- a/sys/src/cmd/cwfs/portdat.h +++ b/sys/src/cmd/cwfs/portdat.h @@ -263,6 +263,7 @@ struct Chan Queue* send; Queue* reply; + int authok; uchar authinfo[64]; void* pdata; /* sometimes is a Netconn* */ diff --git a/sys/src/cmd/cwfs/srv.c b/sys/src/cmd/cwfs/srv.c index 813ac8337..f05aabc87 100644 --- a/sys/src/cmd/cwfs/srv.c +++ b/sys/src/cmd/cwfs/srv.c @@ -182,6 +182,7 @@ srvchan(int fd, char *name) chan->msize = 0; chan->whotime = 0; snprint(chan->whochan, sizeof(chan->whochan), "%s", name); + chan->authok = 0; incref(srv); srv->chan = chan; |