aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/auth/respond.c
blob: 68f9d400c32d9eb064ccb01d9022ce47272f25e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <u.h>
#include <libc.h>
#include <auth.h>

void
usage(void)
{
	fprint(2, "usage: auth/respond 'params' chal\n");
	exits("usage");
}

void
main(int argc, char **argv)
{
	char buf[128];
	int n;

	ARGBEGIN{
	default:
		usage();
	}ARGEND

	if(argc != 2)
		usage();

	memset(buf, 0, sizeof buf);
	n = auth_respond(argv[1], strlen(argv[1]), buf, sizeof buf-1, auth_getkey, "%s", argv[0]);
	if(n < 0)
		sysfatal("auth_respond: %r");
	write(1, buf, n);
	print("\n");
}