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.
This commit is contained in:
parent
52b500af61
commit
9507061986
4 changed files with 10 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -263,6 +263,7 @@ struct Chan
|
|||
Queue* send;
|
||||
Queue* reply;
|
||||
|
||||
int authok;
|
||||
uchar authinfo[64];
|
||||
|
||||
void* pdata; /* sometimes is a Netconn* */
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue