shithub: riscv

Download patch

ref: 1d7bb80793f57de919873b5b80b0db9a79437083
parent: 4edc761024c6d9971e7fae28081e178b35288469
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Jan 1 23:27:23 EST 2018

factotum: remove legacy wep protocol

--- a/sys/src/cmd/auth/factotum/dat.h
+++ b/sys/src/cmd/auth/factotum/dat.h
@@ -225,8 +225,6 @@
 extern Proto p9cr, vnc;			/* p9cr.c */
 extern Proto pass;			/* pass.c */
 extern Proto rsa;			/* rsa.c */
-extern Proto wep;			/* wep.c */
-/* extern Proto srs;			/* srs.c */
 extern Proto httpdigest;		/* httpdigest.c */
 extern Proto ecdsa;			/* ecdsa.c */
 extern Proto wpapsk;			/* wpapsk.c */
--- a/sys/src/cmd/auth/factotum/fs.c
+++ b/sys/src/cmd/auth/factotum/fs.c
@@ -17,7 +17,7 @@
 static void		notifyf(void*, char*);
 static void		private(void);
 
-char	Easproto[]		= "auth server protocol botch";
+char Easproto[]		= "auth server protocol botch";
 char Ebadarg[]		= "invalid argument";
 char Ebadkey[]		= "bad key";
 char Enegotiation[]	= "negotiation failed, no common protocols or keys";
@@ -38,10 +38,8 @@
 	&p9sk1,
 	&dp9ik,
 	&pass,
-/*	&srs, */
 	&rsa,
 	&vnc,
-	&wep,
 	&ecdsa,
 	&wpapsk,
 	nil,
--- a/sys/src/cmd/auth/factotum/mkfile
+++ b/sys/src/cmd/auth/factotum/mkfile
@@ -12,7 +12,6 @@
 	p9sk1.$O\
 	pass.$O\
 	rsa.$O\
-	wep.$O\
 	ecdsa.$O\
 	wpapsk.$O\
 
--- a/sys/src/cmd/auth/factotum/wep.c
+++ /dev/null
@@ -1,128 +1,0 @@
-/*
- *  The caller supplies the device, we do the flavoring.  There
- *  are no phases, everything happens in the init routine.
- */
-
-#include "dat.h"
-
-typedef struct State State;
-struct State 
-{
-	Key *key;
-};
-
-enum
-{
-	HavePass,
-};
-
-static int
-wepinit(Proto*, Fsstate *fss)
-{
-	int ret;
-	Key *k;
-	Keyinfo ki;
-	State *s;
-
-	/* find a key with at least one password */
-	mkkeyinfo(&ki, fss, nil);
-	ret = findkey(&k, &ki, "!key1?");
-	if(ret != RpcOk)
-		ret = findkey(&k, &ki, "!key2?");
-	if(ret != RpcOk)
-		ret = findkey(&k, &ki, "!key3?");
-	if(ret != RpcOk)
-		return ret;
-
-	setattrs(fss->attr, k->attr);
-	s = emalloc(sizeof(*s));
-	s->key = k;
-	fss->ps = s;
-	fss->phase = HavePass;
-
-	return RpcOk;
-}
-
-static void
-wepclose(Fsstate *fss)
-{
-	State *s;
-
-	s = fss->ps;
-	if(s->key)
-		closekey(s->key);
-	free(s);
-}
-
-static int
-wepread(Fsstate *fss, void*, uint*)
-{
-	return phaseerror(fss, "read");
-}
-
-static int
-wepwrite(Fsstate *fss, void *va, uint n)
-{
-	char *data = va;
-	State *s;
-	char dev[64];
-	int fd, cfd;
-	int rv;
-	char *p;
-
-	/* get the device */
-	if(n > sizeof(dev)-5){
-		werrstr("device too long");
-		return RpcErrstr;
-	}
-	memmove(dev, data, n);
-	dev[n] = 0;
-	s = fss->ps;
-
-	/* legal? */
-	if(dev[0] != '#' || dev[1] != 'l'){
-		werrstr("%s not an ether device", dev);
-		return RpcErrstr;
-	}
-	strcat(dev, "!0");
-	fd = dial(dev, 0, 0, &cfd);
-	if(fd < 0)
-		return RpcErrstr;
-
-	/* flavor it with passwords, essid, and turn on wep */
-	rv = RpcErrstr;
-	p = _strfindattr(s->key->privattr, "!key1");
-	if(p != nil)
-		if(fprint(cfd, "key1 %s", p) < 0)
-			goto out;
-	p = _strfindattr(s->key->privattr, "!key2");
-	if(p != nil)
-		if(fprint(cfd, "key2 %s", p) < 0)
-			goto out;
-	p = _strfindattr(s->key->privattr, "!key3");
-	if(p != nil)
-		if(fprint(cfd, "key3 %s", p) < 0)
-			goto out;
-	p = _strfindattr(fss->attr, "essid");
-	if(p != nil)
-		if(fprint(cfd, "essid %s", p) < 0)
-			goto out;
-	if(fprint(cfd, "crypt on") < 0)
-		goto out;
-	rv = RpcOk;
-out:
-	close(fd);
-	close(cfd);
-	return rv;
-}
-
-Proto wep =
-{
-.name=		"wep",
-.init=		wepinit,
-.write=		wepwrite,
-.read=		wepread,
-.close=		wepclose,
-.addkey=	replacekey,
-.keyprompt=	"!key1? !key2? !key3? essid?",
-};