2 * This file contains routines modified from OpenBSD. Parts are contributed
3 * by Todd Miller <millert@openbsd.org>, Theo De Raadt <deraadt@openbsd.org>
6 * $FreeBSD: src/lib/libopie/opieextra.c,v 1.1.2.2 2002/07/15 14:17:08 des Exp $
7 * $DragonFly: src/lib/libopie/opieextra.c,v 1.3 2005/08/04 17:27:09 drhodus Exp $
10 #include <sys/types.h>
17 * Returns: 1 user doesnt exist, -1 file error, 0 user exists.
21 opie_haskey(char *username
)
25 return opielookup(&opie
, username
);
31 * Returns the current sequence number and
32 * seed for the passed user.
36 opie_keyinfo(char *username
)
39 static char str
[OPIE_CHALLENGE_MAX
];
42 i
= opiechallenge(&opie
, username
, str
);
52 * Check to see if answer is the correct one to the current
55 * Returns: 0 success, -1 failure
59 opie_passverify(char *username
, char *passwd
)
64 i
= opielookup(&opie
, username
);
65 if (i
== -1 || i
== 1)
68 if (opieverify(&opie
, passwd
) == 0)
74 #define OPIE_HASH_DEFAULT 1
76 /* Current hash type (index into opie_hash_types array) */
77 static int opie_hash_type
= OPIE_HASH_DEFAULT
;
79 struct opie_algorithm_table
{
83 static struct opie_algorithm_table opie_algorithm_table
[] = {
87 /* Get current hash type */
91 return(opie_algorithm_table
[opie_hash_type
].name
);