~kris/9p

9hist

3b573ec5c56fbdf51141291a2247f08cc2a54d18 — David du Colombier 34 years ago 0a5e555
Plan 9 from Bell Labs 1991-12-07
5 files changed, 18 insertions(+), 17 deletions(-)

M gnot/lib.h
M pc/kbd.c
M port/devcons.c
M port/lib.h
M port/portdat.h
M gnot/lib.h => gnot/lib.h +4 -3
@@ 83,9 83,10 @@ typedef struct Qid	Qid;
typedef struct Dir	Dir;
typedef struct Waitmsg	Waitmsg;

#define	ERRLEN	64
#define	DIRLEN	116
#define	NAMELEN	28
#define	ERRLEN		64
#define	DIRLEN		116
#define	NAMELEN		28
#define DESKEYLEN	7

struct Qid
{

M pc/kbd.c => pc/kbd.c +2 -2
@@ 189,10 189,10 @@ kbdinit(void)
	outb(Cmd, 0x60);
	if(outready() < 0)
		print("kbd init failed\n");
	outb(Data, 0x47);
	outb(Data, 0x47);	/* BUG -- on 6300 0x65 */
	if(outready() < 0)
		print("kbd init failed\n");
	outb(Cmd, 0xA8);
	outb(Cmd, 0xA8);	/* BUG -- should this be AE? */

	/* make mouse streaming, enabled */
	if(mousecmd(0xEA) < 0

M port/devcons.c => port/devcons.c +7 -7
@@ 21,7 21,7 @@ KIOQ	kbdq;
Ref	raw;			/* whether kbd i/o is raw (rcons is open) */

char	eve[NAMELEN] = "bootes";
char	evekey[KEYLEN];
char	evekey[DESKEYLEN];

/*
 *  init the queues and set the output routine


@@ 351,7 351,7 @@ Dirtab consdir[]={
	"user",		{Quser},	0,		0666,
	"chal",		{Qchal},	8,		0666,
	"crypt",	{Qcrypt},	0,		0666,
	"key",		{Qkey},		KEYLEN,		0222,
	"key",		{Qkey},		DESKEYLEN,	0222,
	"klog",		{Qklog},	0,		0444,
	"sysstat",	{Qsysstat},	0,		0666,
	"swap",		{Qswap},	0,		0666,


@@ 762,11 762,11 @@ conswrite(Chan *c, void *va, long n, ulong offset)
		break;

	case Qkey:
		if(n != KEYLEN)
		if(n != DESKEYLEN)
			error(Ebadarg);
		memmove(u->p->pgrp->crypt->key, a, KEYLEN);
		memmove(u->p->pgrp->crypt->key, a, DESKEYLEN);
		if(strcmp(u->p->user, eve) == 0)
			memmove(evekey, a, KEYLEN);
			memmove(evekey, a, DESKEYLEN);
		break;

	case Quser:


@@ 786,14 786,14 @@ conswrite(Chan *c, void *va, long n, ulong offset)
	case Qchal:
		if(offset != 0)
			error(Ebadarg);
		if(n != 8+NAMELEN+KEYLEN)
		if(n != 8+NAMELEN+DESKEYLEN)
			error(Ebadarg);
		decrypt(evekey, a, n);
		if(memcmp(u->p->pgrp->crypt->chal, a, 8) != 0)
			errors("authentication failure");
		strncpy(u->p->user, a+8, NAMELEN);
		u->p->user[NAMELEN-1] = '\0';
		memmove(u->p->pgrp->crypt->key, a+NAMELEN+KEYLEN, KEYLEN);
		memmove(u->p->pgrp->crypt->key, a+NAMELEN+DESKEYLEN, DESKEYLEN);
		break;

	case Qnull:

M port/lib.h => port/lib.h +4 -3
@@ 83,9 83,10 @@ typedef struct Qid	Qid;
typedef struct Dir	Dir;
typedef struct Waitmsg	Waitmsg;

#define	ERRLEN	64
#define	DIRLEN	116
#define	NAMELEN	28
#define	ERRLEN		64
#define	DIRLEN		116
#define	NAMELEN		28
#define DESKEYLEN	7

struct Qid
{

M port/portdat.h => port/portdat.h +1 -2
@@ 165,10 165,9 @@ struct Chan
	Qid	mqid;			/* qid of root of mount point */
};

#define	KEYLEN	7
struct Crypt
{
	char	key[KEYLEN];		/* des encryption key */
	char	key[DESKEYLEN];		/* des encryption key */
	char	chal[8];		/* challenge for setting user name */
};