devssl, devtls: fix permission checks
This commit is contained in:
parent
a630e17bd7
commit
cb4b187f10
2 changed files with 3 additions and 39 deletions
|
@ -263,23 +263,8 @@ static Chan*
|
|||
sslopen(Chan *c, int omode)
|
||||
{
|
||||
Dstate *s, **pp;
|
||||
int perm;
|
||||
int ft;
|
||||
|
||||
perm = 0;
|
||||
omode &= 3;
|
||||
switch(omode) {
|
||||
case OREAD:
|
||||
perm = 4;
|
||||
break;
|
||||
case OWRITE:
|
||||
perm = 2;
|
||||
break;
|
||||
case ORDWR:
|
||||
perm = 6;
|
||||
break;
|
||||
}
|
||||
|
||||
ft = TYPE(c->qid);
|
||||
switch(ft) {
|
||||
default:
|
||||
|
@ -309,11 +294,7 @@ sslopen(Chan *c, int omode)
|
|||
if(s == 0)
|
||||
dsnew(c, pp);
|
||||
else {
|
||||
if((perm & (s->perm>>6)) != perm
|
||||
&& (strcmp(up->user, s->user) != 0
|
||||
|| (perm & s->perm) != perm))
|
||||
error(Eperm);
|
||||
|
||||
devpermcheck(s->user, s->perm, omode);
|
||||
s->ref++;
|
||||
}
|
||||
unlock(&dslock);
|
||||
|
|
|
@ -424,21 +424,7 @@ static Chan*
|
|||
tlsopen(Chan *c, int omode)
|
||||
{
|
||||
TlsRec *tr, **pp;
|
||||
int t, perm;
|
||||
|
||||
perm = 0;
|
||||
omode &= 3;
|
||||
switch(omode) {
|
||||
case OREAD:
|
||||
perm = 4;
|
||||
break;
|
||||
case OWRITE:
|
||||
perm = 2;
|
||||
break;
|
||||
case ORDWR:
|
||||
perm = 6;
|
||||
break;
|
||||
}
|
||||
int t;
|
||||
|
||||
t = TYPE(c->qid);
|
||||
switch(t) {
|
||||
|
@ -471,10 +457,7 @@ tlsopen(Chan *c, int omode)
|
|||
tr = *pp;
|
||||
if(tr == nil)
|
||||
error("must open connection using clone");
|
||||
if((perm & (tr->perm>>6)) != perm
|
||||
&& (strcmp(up->user, tr->user) != 0
|
||||
|| (perm & tr->perm) != perm))
|
||||
error(Eperm);
|
||||
devpermcheck(tr->user, tr->perm, omode);
|
||||
if(t == Qhand){
|
||||
if(waserror()){
|
||||
unlock(&tr->hqlock);
|
||||
|
|
Loading…
Reference in a new issue