/*
#  This is version 0.3 of absent
#
#               Copyright (c) 1999 by AT&T.
#  Permission to use, copy, and modify this software without fee is
#  hereby granted, provided that this entire notice is included in all
#  copies of any software which is or includes a copy or modification
#  of this software and in all copies of the supporting documentation
#  for such software.
#
#  SOME PARTS OF ABSENT MAY BE RESTRICTED UNDER UNITED STATES EXPORT
#  REGULATIONS.
#
#  THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
#  IMPLIED WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE
#  ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
#  MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
#  PURPOSE.
*/
#ifndef _USER_TABLE_H
#define _USER_TABLE_H
#include "opie.h"
#include "keys.h"
#include "absent.h"

#include <strings.h>
#include <sys/file.h>
#include <sys/time.h>
#include <stdio.h>
#include <errno.h>
#include <syslog.h>
#include <fcntl.h>
#include <sys/param.h>

#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif  /* !MAXPATHLEN */

#ifndef USER_DIR
#define USER_DIR "/usr/local/pushweb/keys"
#endif /* !USER_DIR */

typedef struct {
   C_Block MACKey;
   time_t key_creation_time;
   struct opie opie_entry;
   enum {CHALLENGED, AUTHENTICATED, NONE} state;
} user_entry;

int write_user ( char *, user_entry *);
int read_user_entry ( char *, user_entry *);
void otp_make_challenge ( char *, char *);
int otp_check_response( char *, char *);
void otp_login_user( char * );
#endif _USER_TABLE_H
