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
263sslopen(Chan *c, int omode)263sslopen(Chan *c, int omode)
264{264{
265 Dstate *s, **pp;265 Dstate *s, **pp;
266 int perm;
267 int ft;266 int ft;
268 267
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
283 ft = TYPE(c->qid);268 ft = TYPE(c->qid);
284 switch(ft) {269 switch(ft) {
285 default:270 default:
@@ -309,11 +294,7 @@ sslopen(Chan *c, int omode) · 23 unmodified lines
309 if(s == 0)294 if(s == 0)
310 dsnew(c, pp);295 dsnew(c, pp);
311 else {296 else {
312 if((perm & (s->perm>>6)) != perm297 devpermcheck(s->user, s->perm, omode);
313 && (strcmp(up->user, s->user) != 0
314 || (perm & s->perm) != perm))
315 error(Eperm);
316
317 s->ref++;298 s->ref++;
318 }299 }
319 unlock(&dslock);300 unlock(&dslock);
@@ -1458,7 +1439,7 @@ buftochan(char *p) · 1138 unmodified lines
1458 fd = strtoul(p, 0, 0);1439 fd = strtoul(p, 0, 0);
1459 if(fd < 0)1440 if(fd < 0)
1460 error(Ebadarg);1441 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 */
1462 if(devtab[c->type] == &ssldevtab){1443 if(devtab[c->type] == &ssldevtab){
1463 cclose(c);1444 cclose(c);
1464 error("cannot ssl encrypt devssl files");1445 error("cannot ssl encrypt devssl files");
kern/devtls.c+4−21
@@ -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
12typedef struct OneWay OneWay;12typedef struct OneWay OneWay;
13typedef struct Secret Secret;13typedef struct Secret Secret;
@@ -421,21 +421,7 @@ static Chan* · 407 unmodified lines
421tlsopen(Chan *c, int omode)421tlsopen(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)) != perm457 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

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