#ifndef WS_AUTH_H
#define WS_AUTH_H
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef XP_WIN32
typedef int uid_t;
typedef int gid_t;
#endif
typedef struct auth_db AuthDB;
typedef struct user User;
typedef User*(*authdb_get_user_f)(AuthDB*, char*);
struct auth_db {
char *name;
authdb_get_user_f get_user;
int use_cache;
};
typedef int(*user_verify_passwd_f)(User*, char*);
typedef int(*user_check_group_f)(User*, char*);
typedef void(*user_free_f)(User*);
struct user {
char *name;
uid_t uid;
gid_t gid;
user_verify_passwd_f verify_password;
user_check_group_f check_group;
user_free_f free;
};
User* authdb_get_user(AuthDB *db, char *user);
User* authdb_get_and_verify(AuthDB *db, char *user, char *password, int *pw);
#ifdef __cplusplus
}
#endif
#endif