示例#1
0
/*
 * opie_haopie()
 *
 * Returns: 1 user doesnt exist, -1 file error, 0 user exists.
 *
 */
int
opie_haskey(char *username)
{
	struct opie opie;
 
	return opielookup(&opie, username);
}
示例#2
0
/*
 * opie_passverify()
 *
 * Check to see if answer is the correct one to the current
 * challenge.
 *
 * Returns: 0 success, -1 failure
 *
 */
int
opie_passverify(char *username, char *passwd)
{
	int i;
	struct opie opie;

	i = opielookup(&opie, username);
	if (i == -1 || i == 1)
		return(-1);

	if (opieverify(&opie, passwd) == 0)
		return(opie.opie_n);

	return(-1);
}
示例#3
0
   This function MUST eventually be followed by an opieverify() to release
   the user lock and file handles.

   This function will give you a blanked-out state block if it returns a
   nonzero status. Even though it returns a non-zero status and a blank
   state block, you still MUST call opieverify() to clear the lock and
   any internal state (the latter condition is not actually used yet).
*/

static char *algids[] = { NULL, NULL, NULL, "sha1", "md4", "md5" };

int opiechallenge FUNCTION((mp, name, ss), struct opie *mp AND char *name AND char *ss)
{
  int rval = -1;

  rval = opielookup(mp, name);
#if DEBUG
  if (rval) syslog(LOG_DEBUG, "opiechallenge: opielookup(mp, name=%s) returned %d", name, rval);
#endif /* DEBUG */

  if (!rval) {
    rval = opielock(name);
#if DEBUG
    if (rval) syslog(LOG_DEBUG, "opiechallenge: opielock(name=%s) returned %d", name, rval);
#endif /* DEBUG */
  }

  if (rval ||
    (snprintf(ss, OPIE_CHALLENGE_MAX, "otp-%s %d %s ext", algids[MDX], mp->opie_n - 1, mp->opie_seed) >= OPIE_CHALLENGE_MAX)) {
    opierandomchallenge(ss);
    memset(mp, 0, sizeof(*mp));