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 $
16 * Returns: 1 user doesnt exist, -1 file error, 0 user exists.
20 opie_haskey(char *username)
24 return opielookup(&opie, username);
30 * Returns the current sequence number and
31 * seed for the passed user.
35 opie_keyinfo(char *username)
38 static char str[OPIE_CHALLENGE_MAX];
41 i = opiechallenge(&opie, username, str);
51 * Check to see if answer is the correct one to the current
54 * Returns: 0 success, -1 failure
58 opie_passverify(char *username, char *passwd)
63 i = opielookup(&opie, username);
64 if (i == -1 || i == 1)
67 if (opieverify(&opie, passwd) == 0)
73 #define OPIE_HASH_DEFAULT 1
75 /* Current hash type (index into opie_hash_types array) */
76 static int opie_hash_type = OPIE_HASH_DEFAULT;
78 struct opie_algorithm_table {
82 static struct opie_algorithm_table opie_algorithm_table[] = {
86 /* Get current hash type */
88 opie_get_algorithm(void)
90 return(opie_algorithm_table[opie_hash_type].name);