#ifndef WS_AUTH_H
#define WS_AUTH_H
#include <sys/types.h>
#include "nsapi.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*, Session*, Request*,
const char*);
struct auth_db {
char *name;
authdb_get_user_f get_user;
int use_cache;
};
typedef int(*user_verify_passwd_f)(User*,
const char*);
typedef int(*user_check_group_f)(User*,
const 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, Session *sn, Request *rq,
const char *user);
User* authdb_get_and_verify(AuthDB *db, Session *sn, Request *rq,
const char *user,
const char *password,
int *pw);
#ifdef __cplusplus
}
#endif
#endif