Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_fixcpp/sys/src/libauth/auth_wep.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
#include <auth.h>
4
#include "authlocal.h"
5
 
6
/*
7
 *  make factotum add wep keys to an 802.11 device
8
 */
9
int
10
auth_wep(char *dev, char *fmt, ...)
11
{
12
	AuthRpc *rpc;
13
	char *params, *p;
14
	int fd;
15
	va_list arg;
16
	int rv;
17
 
18
	rv = -1;
19
 
20
	if(dev == nil){
21
		werrstr("no device specified");
22
		return rv;
23
	}
24
 
25
	fd = open("/mnt/factotum/rpc", ORDWR);
26
	if(fd < 0)
27
		return rv;
28
 
29
	rpc = auth_allocrpc(fd);
30
	if(rpc != nil){
31
		quotefmtinstall();	/* just in case */
32
		va_start(arg, fmt);
33
		params = vsmprint(fmt, arg);
34
		va_end(arg);
35
		if(params != nil){
36
			p = smprint("proto=wep %s", params);
37
			if(p != nil){
38
				if(auth_rpc(rpc, "start", p, strlen(p)) == ARok
39
				&& auth_rpc(rpc, "write", dev, strlen(dev)) == ARok)
40
					rv = 0;
41
				free(p);
42
			}
43
			free(params);
44
		}
45
		auth_freerpc(rpc);
46
	}
47
	close(fd);
48
 
49
	return rv;
50
}