5 typedef struct Test Test;
10 int (*server)(Test*, AuthRpc*, int);
11 int (*client)(Test*, int);
15 ai2status(AuthInfo *ai)
24 proxyserver(Test *t, AuthRpc *rpc, int fd)
28 sprint(buf, "proto=%q role=server", t->name);
29 return ai2status(fauth_proxy(fd, rpc, nil, buf));
33 proxyclient(Test *t, int fd)
35 return ai2status(auth_proxy(fd, auth_getkey, "proto=%q role=client", t->name));
40 "apop", proxyserver, proxyclient,
41 "cram", proxyserver, proxyclient,
42 "p9sk1", proxyserver, proxyclient,
43 "p9sk2", proxyserver, proxyclient,
44 "p9any", proxyserver, proxyclient,
50 fprint(2, "usage: test [name]...\n");
55 runtest(AuthRpc *srpc, Test *t)
63 print("%s...", t->name);
71 if((*t->server)(t, srpc, p[1]) < 0){
72 print("\n\tserver: %r");
79 if((*t->client)(t, p[0]) < 0){
80 print("\n\tclient: %r");
93 main(int argc, char **argv)
105 afd = open("/n/kremvax/factotum/rpc", ORDWR);
107 sysfatal("open /n/kremvax/factotum/rpc: %r");
108 srpc = auth_allocrpc(afd);
110 sysfatal("auth_allocrpc: %r");
113 for(i=0; i<nelem(test); i++)
114 runtest(srpc, &test[i]);
116 for(i=0; i<argc; i++)
117 for(j=0; j<nelem(test); j++)
118 if(strcmp(argv[i], test[j].name) == 0)
119 runtest(srpc, &test[j]);