| @@ -7,7 +7,7 @@ · 6 unmodified lines |
| 7 | #include "fns.h" | 7 | #include "fns.h" |
| 8 | #include "error.h" | 8 | #include "error.h" |
| 9 | | 9 | |
| 10 | #include "libsec.h" | 10 | #include <libsec.h> |
| 11 | | 11 | |
| 12 | typedef struct OneWay OneWay; | 12 | typedef struct OneWay OneWay; |
| 13 | typedef struct Secret Secret; | 13 | typedef struct Secret Secret; |
| @@ -421,21 +421,7 @@ static Chan* · 407 unmodified lines |
| 421 | tlsopen(Chan *c, int omode) | 421 | tlsopen(Chan *c, int omode) |
| 422 | { | 422 | { |
| 423 | TlsRec *tr, **pp; | 423 | TlsRec *tr, **pp; |
| 424 | int t, perm; | 424 | int t; |
| 425 | | | |
| 426 | perm = 0; | | |
| 427 | omode &= 3; | | |
| 428 | switch(omode) { | | |
| 429 | case OREAD: | | |
| 430 | perm = 4; | | |
| 431 | break; | | |
| 432 | case OWRITE: | | |
| 433 | perm = 2; | | |
| 434 | break; | | |
| 435 | case ORDWR: | | |
| 436 | perm = 6; | | |
| 437 | break; | | |
| 438 | } | | |
| 439 | | 425 | |
| 440 | t = TYPE(c->qid); | 426 | t = TYPE(c->qid); |
| 441 | switch(t) { | 427 | switch(t) { |
| @@ -468,10 +454,7 @@ tlsopen(Chan *c, int omode) · 26 unmodified lines |
| 468 | tr = *pp; | 454 | tr = *pp; |
| 469 | if(tr == nil) | 455 | if(tr == nil) |
| 470 | error("must open connection using clone"); | 456 | error("must open connection using clone"); |
| 471 | if((perm & (tr->perm>>6)) != perm | 457 | devpermcheck(tr->user, tr->perm, omode); |
| 472 | && (strcmp(up->user, tr->user) != 0 | | |
| 473 | || (perm & tr->perm) != perm)) | | |
| 474 | error(Eperm); | | |
| 475 | if(t == Qhand){ | 458 | if(t == Qhand){ |
| 476 | if(waserror()){ | 459 | if(waserror()){ |
| 477 | unlock(&tr->hqlock); | 460 | unlock(&tr->hqlock); |
| @@ -1886,7 +1869,7 @@ buftochan(char *p) · 1408 unmodified lines |
| 1886 | fd = strtoul(p, 0, 0); | 1869 | fd = strtoul(p, 0, 0); |
| 1887 | if(fd < 0) | 1870 | if(fd < 0) |
| 1888 | error(Ebadarg); | 1871 | error(Ebadarg); |
| 1889 | c = fdtochan(fd, -1, 0, 1); /* error check and inc ref */ | 1872 | c = fdtochan(fd, ORDWR, 1, 1); /* error check and inc ref */ |
| 1890 | return c; | 1873 | return c; |
| 1891 | } | 1874 | } |
| 1892 | | 1875 | |