History

devssl, devtls: merge with 9front

cinap_lenrek committed 10 years ago

Commit 0f3bdd71 parent fc582332 files · +6 −42Browse files

Unified · Split

2 files
  1. kern/devssl.c +2 −21
  2. kern/devtls.c +4 −21
kern/devssl.c+2−21
@@ -263,23 +263,8 @@ static Chan* · 262 unmodified lines
263263 sslopen(Chan *c, int omode)
264264 {
265265 Dstate *s, **pp;
266− int perm;
267266 int ft;
268267
269− perm = 0;
270− omode &= 3;
271− switch(omode) {
272− case OREAD:
273− perm = 4;
274− break;
275− case OWRITE:
276− perm = 2;
277− break;
278− case ORDWR:
279− perm = 6;
280− break;
281− }
282−
283268 ft = TYPE(c->qid);
284269 switch(ft) {
285270 default:
@@ -309,11 +294,7 @@ sslopen(Chan *c, int omode) · 23 unmodified lines
309294 if(s == 0)
310295 dsnew(c, pp);
311296 else {
312− if((perm & (s->perm>>6)) != perm
313− && (strcmp(up->user, s->user) != 0
314− || (perm & s->perm) != perm))
315− error(Eperm);
316−
297+ devpermcheck(s->user, s->perm, omode);
317298 s->ref++;
318299 }
319300 unlock(&dslock);
@@ -1458,7 +1439,7 @@ buftochan(char *p) · 1138 unmodified lines
14581439 fd = strtoul(p, 0, 0);
14591440 if(fd < 0)
14601441 error(Ebadarg);
1461− c = fdtochan(fd, -1, 0, 1); /* error check and inc ref */
1442+ c = fdtochan(fd, ORDWR, 1, 1); /* error check and inc ref */
14621443 if(devtab[c->type] == &ssldevtab){
14631444 cclose(c);
14641445 error("cannot ssl encrypt devssl files");
kern/devtls.c+4−21
@@ -7,7 +7,7 @@ · 6 unmodified lines
77 #include "fns.h"
88 #include "error.h"
99
10−#include "libsec.h"
10+#include <libsec.h>
1111
1212 typedef struct OneWay OneWay;
1313 typedef struct Secret Secret;
@@ -421,21 +421,7 @@ static Chan* · 407 unmodified lines
421421 tlsopen(Chan *c, int omode)
422422 {
423423 TlsRec *tr, **pp;
424− int t, perm;
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− }
424+ int t;
439425
440426 t = TYPE(c->qid);
441427 switch(t) {
@@ -468,10 +454,7 @@ tlsopen(Chan *c, int omode) · 26 unmodified lines
468454 tr = *pp;
469455 if(tr == nil)
470456 error("must open connection using clone");
471− if((perm & (tr->perm>>6)) != perm
472− && (strcmp(up->user, tr->user) != 0
473− || (perm & tr->perm) != perm))
474− error(Eperm);
457+ devpermcheck(tr->user, tr->perm, omode);
475458 if(t == Qhand){
476459 if(waserror()){
477460 unlock(&tr->hqlock);
@@ -1886,7 +1869,7 @@ buftochan(char *p) · 1408 unmodified lines
18861869 fd = strtoul(p, 0, 0);
18871870 if(fd < 0)
18881871 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 */
18901873 return c;
18911874 }
18921875

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t