diff options
author | FreeArtMan <dos21h@gmail.com> | 2015-01-11 17:49:03 +0900 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2015-01-11 17:49:03 +0900 |
commit | 9b3d5f87e7718b00f786531b58bf102cdadc8264 (patch) | |
tree | 51c445bbfd347353bcbc1412aaec654819739555 /user.h | |
parent | 4e148546810a2902dff9444526e47c9569c79b64 (diff) | |
download | microbbs-9b3d5f87e7718b00f786531b58bf102cdadc8264.tar.gz microbbs-9b3d5f87e7718b00f786531b58bf102cdadc8264.zip |
Added primitive authentification support
Diffstat (limited to 'user.h')
-rw-r--r-- | user.h | 54 |
1 files changed, 54 insertions, 0 deletions
@@ -0,0 +1,54 @@ +#ifndef __MICROBBS_USER_H +#define __MICROBBS_USER_H + +#include <stdlib.h> +#include <stdio.h> +#include <dirent.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <fcntl.h> +#include <termios.h> + +#include "kconfig.h" +#include "sds.h" + +#include "libterm/term.h" +#include "libterm/term_io.h" + +#define BBS_USER_GUEST 0 +#define BBS_USER_LOGEDIN 1 +#define BBS_USER_BLOCKED 2 +#define BBS_USER_LOGEDOUT 3 + + +#define BBS_USER_UN_SZ 32 +typedef struct bbs_user +{ + int login_status; + char username[BBS_USER_UN_SZ]; +} bbs_user; + +typedef struct user_config_file +{ + char *password; +} user_config_file; + +#define BBS_USER_INIT { BBS_USER_GUEST, {0} }; + +//GLOBAL USER +#ifdef __MICROBBS_MAIN +bbs_user g_user = BBS_USER_INIT; +#else +extern bbs_user g_user; +#endif + +int bbs_login( term_screen *ts ); +int bbs_login_auth( const char *dir, const char *username, const char *password ); + +int bbs_user_init( bbs_user *bu ); +int bbs_user_auth( bbs_user *bu ); +int bbs_user_set_status( bbs_user *bu, int status ); +int bbs_user_get_status( bbs_user *bu ); + +#endif
\ No newline at end of file |