~kris/9p

9hist

8b850f5fcab6499a320ffb791624c7cd1a534b00 — David du Colombier 24 years ago 37873eb
Plan 9 from Bell Labs 2002-03-06
2 files changed, 10 insertions(+), 9 deletions(-)

M ip/netlog.c
M port/devssl.c
M ip/netlog.c => ip/netlog.c +1 -1
@@ 207,7 207,7 @@ netlogctl(Fs *f, char* s, int n)
		cmderror(cb, "unknown ip control message");
	}

	for(i = 1; i < n; i++){
	for(i = 1; i < cb->nf; i++){
		for(fp = flags; fp->name; fp++)
			if(strcmp(fp->name, cb->f[i]) == 0)
				break;

M port/devssl.c => port/devssl.c +9 -8
@@ 1,5 1,5 @@
/*
 *  devssl - secure sockets layer emulation
 *  devssl - secure sockets layer
 */
#include	"u.h"
#include	"../port/lib.h"


@@ 575,6 575,7 @@ sslbread(Chan *c, long n, ulong)
			pad = 0;
			toconsume = 2;
		} else {
			s.s->unprocessed = pullupblock(s.s->unprocessed, 3);
			len = ((p[0] & 0x3f)<<8) | p[1];
			pad = p[2];
			if(pad > len){


@@ 583,7 584,7 @@ sslbread(Chan *c, long n, ulong)
			}
			toconsume = 3;
		}
		ensure(s.s, &s.s->unprocessed, toconsume+len+pad);
		ensure(s.s, &s.s->unprocessed, toconsume+len);

		/*
		 * Now we have a full SSL packet in the unprocessed list.


@@ 602,9 603,9 @@ sslbread(Chan *c, long n, ulong)
		consume(&s.s->unprocessed, consumed, toconsume);

		/* grab the next message and decode/decrypt it */
		b = qtake(&s.s->unprocessed, len+pad, 0);
		b = qtake(&s.s->unprocessed, len, 0);

		if(blocklen(b) != len+pad)
		if(blocklen(b) != len)
			print("devssl: sslbread got wrong count %d != %d", blocklen(b), len);

		if(waserror()){


@@ 1167,14 1168,14 @@ sslwrite(Chan *c, void *a, long n, vlong off)
	} else if(strcmp(buf, "secretin") == 0 && p != 0) {
		m = (strlen(p)*3)/2;
		x = smalloc(m);
		n = dec64(x, m, p, strlen(p));
		setsecret(&s.s->in, x, n);
		t = dec64(x, m, p, strlen(p));
		setsecret(&s.s->in, x, t);
		free(x);
	} else if(strcmp(buf, "secretout") == 0 && p != 0) {
		m = (strlen(p)*3)/2 + 1;
		x = smalloc(m);
		n = dec64(x, m, p, strlen(p));
		setsecret(&s.s->out, x, n);
		t = dec64(x, m, p, strlen(p));
		setsecret(&s.s->out, x, t);
		free(x);
	} else
		error(Ebadarg);