aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/auth/factotum/pass.c
blob: ddda95964f5fa24621958d68615af57e0ce2f2e9 (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
33
34
35
36
37
38
39
40
41
/*
 * This is just a repository for a password.
 * We don't want to encourage this, there's
 * no server side.
 *
 * Client:
 *	start proto=pass ...
 *	read password
 */

#include "std.h"
#include "dat.h"

static int
passproto(Conv *c)
{
	Key *k;

	k = keyfetch(c, "%A", c->attr);
	if(k == nil)
		return -1;
	c->state = "write";
	convprint(c, "%q %q",
		strfindattr(k->attr, "user"),
		strfindattr(k->privattr, "!password"));
	return 0;
}

static Role passroles[] = {
	"client",	passproto,
	0
};

Proto pass =
{
	"pass",
	passroles,
	"user? !password?",
	nil,
	nil
};