Annotation of sbbs/src/sbbs3/userdat.h, revision 1.1.1.2

1.1       root        1: /* userdat.h */
                      2: 
                      3: /* Synchronet user data access routines (exported) */
                      4: 
1.1.1.2 ! root        5: /* $Id: userdat.h,v 1.45 2011/09/23 06:53:26 rswindell Exp $ */
1.1       root        6: 
                      7: /****************************************************************************
                      8:  * @format.tab-size 4          (Plain Text/Source Code File Header)                    *
                      9:  * @format.use-tabs true       (see http://www.synchro.net/ptsc_hdr.html)              *
                     10:  *                                                                                                                                                     *
1.1.1.2 ! root       11:  * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html         *
1.1       root       12:  *                                                                                                                                                     *
                     13:  * This program is free software; you can redistribute it and/or                       *
                     14:  * modify it under the terms of the GNU General Public License                         *
                     15:  * as published by the Free Software Foundation; either version 2                      *
                     16:  * of the License, or (at your option) any later version.                                      *
                     17:  * See the GNU General Public License for more details: gpl.txt or                     *
                     18:  * http://www.fsf.org/copyleft/gpl.html                                                                                *
                     19:  *                                                                                                                                                     *
                     20:  * Anonymous FTP access to the most recent released source is available at     *
                     21:  * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net     *
                     22:  *                                                                                                                                                     *
                     23:  * Anonymous CVS access to the development source and modification history     *
                     24:  * is available at cvs.synchro.net:/cvsroot/sbbs, example:                                     *
                     25:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs login                       *
                     26:  *     (just hit return, no password is necessary)                                                     *
                     27:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src                *
                     28:  *                                                                                                                                                     *
                     29:  * For Synchronet coding style and modification guidelines, see                                *
                     30:  * http://www.synchro.net/source.html                                                                          *
                     31:  *                                                                                                                                                     *
                     32:  * You are encouraged to submit any modifications (preferably in Unix diff     *
                     33:  * format) via e-mail to [email protected]                                                                      *
                     34:  *                                                                                                                                                     *
                     35:  * Note: If this box doesn't appear square, then you need to fix your tabs.    *
                     36:  ****************************************************************************/
                     37: 
                     38: #ifndef _USERDAT_H
                     39: #define _USERDAT_H
                     40: 
                     41: #include "scfgdefs.h"   /* scfg_t */
                     42: #include "dat_rec.h"   /* getrec/putrec prototypes */
1.1.1.2 ! root       43: #include "client.h"            /* client_t */
1.1       root       44: 
                     45: #ifdef DLLEXPORT
                     46: #undef DLLEXPORT
                     47: #endif
                     48: #ifdef DLLCALL
                     49: #undef DLLCALL
                     50: #endif
                     51: 
                     52: #ifdef _WIN32
                     53:        #ifdef SBBS_EXPORTS
                     54:                #define DLLEXPORT __declspec(dllexport)
                     55:        #else
                     56:                #define DLLEXPORT __declspec(dllimport)
                     57:        #endif
                     58:        #ifdef __BORLANDC__
                     59:                #define DLLCALL __stdcall
                     60:        #else
                     61:                #define DLLCALL
                     62:        #endif
                     63: #else
                     64:        #define DLLEXPORT
                     65:        #define DLLCALL
                     66: #endif
                     67: 
                     68: #ifdef __cplusplus
                     69: extern "C" {
                     70: #endif
                     71: 
                     72: extern char* crlf;
                     73: extern char* nulstr;
                     74: 
                     75: DLLEXPORT int  DLLCALL getuserdat(scfg_t* cfg, user_t* user);  /* Fill userdat struct with user data   */
                     76: DLLEXPORT int  DLLCALL putuserdat(scfg_t* cfg, user_t* user);  /* Put userdat struct into user file    */
                     77: DLLEXPORT int  DLLCALL newuserdat(scfg_t* cfg, user_t* user);  /* Create new userdat in user file */
1.1.1.2 ! root       78: DLLEXPORT uint DLLCALL matchuser(scfg_t* cfg, const char *str, BOOL sysop_alias); /* Checks for a username match */
        !            79: DLLEXPORT char* DLLCALL alias(scfg_t* cfg, const char* name, char* buf);
1.1       root       80: DLLEXPORT int  DLLCALL putusername(scfg_t* cfg, int number, char * name);
                     81: DLLEXPORT uint DLLCALL total_users(scfg_t* cfg);
                     82: DLLEXPORT uint DLLCALL lastuser(scfg_t* cfg);
                     83: DLLEXPORT BOOL DLLCALL del_lastuser(scfg_t* cfg);
1.1.1.2 ! root       84: DLLEXPORT uint DLLCALL getage(scfg_t* cfg, char *birthdate);
1.1       root       85: DLLEXPORT char*        DLLCALL username(scfg_t* cfg, int usernumber, char * str);
1.1.1.2 ! root       86: DLLEXPORT char* DLLCALL usermailaddr(scfg_t* cfg, char* addr, const char* name);
1.1       root       87: DLLEXPORT int  DLLCALL getnodedat(scfg_t* cfg, uint number, node_t *node, int* file);
                     88: DLLEXPORT int  DLLCALL putnodedat(scfg_t* cfg, uint number, node_t *node, int file);
                     89: DLLEXPORT char* DLLCALL nodestatus(scfg_t* cfg, node_t* node, char* buf, size_t buflen);
                     90: DLLEXPORT void DLLCALL printnodedat(scfg_t* cfg, uint number, node_t* node);
                     91: DLLEXPORT void DLLCALL packchatpass(char *pass, node_t* node);
                     92: DLLEXPORT char* DLLCALL unpackchatpass(char *pass, node_t* node);
                     93: DLLEXPORT char* DLLCALL getsmsg(scfg_t* cfg, int usernumber);
                     94: DLLEXPORT int  DLLCALL putsmsg(scfg_t* cfg, int usernumber, char *strin);
                     95: DLLEXPORT char* DLLCALL getnmsg(scfg_t* cfg, int node_num);
                     96: DLLEXPORT int  DLLCALL putnmsg(scfg_t* cfg, int num, char *strin);
                     97: 
                     98: DLLEXPORT uint DLLCALL userdatdupe(scfg_t* cfg, uint usernumber, uint offset, uint datlen, char *dat
1.1.1.2 ! root       99:                                                        ,BOOL del, BOOL next);
1.1       root      100: 
1.1.1.2 ! root      101: DLLEXPORT BOOL DLLCALL chk_ar(scfg_t* cfg, uchar* str, user_t*, client_t*); /* checks access requirements */
1.1       root      102: 
                    103: DLLEXPORT int  DLLCALL getuserrec(scfg_t*, int usernumber, int start, int length, char *str);
1.1.1.2 ! root      104: DLLEXPORT int  DLLCALL putuserrec(scfg_t*, int usernumber, int start, uint length, const char *str);
1.1       root      105: DLLEXPORT ulong        DLLCALL adjustuserrec(scfg_t*, int usernumber, int start, int length, long adj);
                    106: DLLEXPORT BOOL DLLCALL logoutuserdat(scfg_t*, user_t*, time_t now, time_t logontime);
1.1.1.2 ! root      107: DLLEXPORT void DLLCALL resetdailyuserdat(scfg_t*, user_t*, BOOL write);
1.1       root      108: DLLEXPORT void DLLCALL subtract_cdt(scfg_t*, user_t*, long amt);
                    109: DLLEXPORT int  DLLCALL user_rec_len(int offset);
1.1.1.2 ! root      110: DLLEXPORT BOOL DLLCALL can_user_access_sub(scfg_t* cfg, uint subnum, user_t* user, client_t* client);
        !           111: DLLEXPORT BOOL DLLCALL can_user_read_sub(scfg_t* cfg, uint subnum, user_t* user, client_t* client);
        !           112: DLLEXPORT BOOL DLLCALL can_user_post(scfg_t* cfg, uint subnum, user_t* user, client_t* client, uint* reason);
        !           113: DLLEXPORT BOOL DLLCALL is_user_subop(scfg_t* cfg, uint subnum, user_t* user, client_t* client);
        !           114: DLLEXPORT BOOL DLLCALL is_download_free(scfg_t* cfg, uint dirnum, user_t* user, client_t* client);
        !           115: DLLEXPORT BOOL DLLCALL filter_ip(scfg_t* cfg, const char* prot, const char* reason, const char* host
        !           116:                                                                  ,const char* ip_addr, const char* username, const char* fname);
1.1       root      117: 
                    118: /* New atomic numeric user field adjustment functions: */
                    119: DLLEXPORT BOOL DLLCALL user_posted_msg(scfg_t* cfg, user_t* user, int count);
                    120: DLLEXPORT BOOL DLLCALL user_sent_email(scfg_t* cfg, user_t* user, int count, BOOL feedback);
                    121: DLLEXPORT BOOL DLLCALL user_downloaded(scfg_t* cfg, user_t* user, int files, long bytes);
                    122: DLLEXPORT BOOL DLLCALL user_uploaded(scfg_t* cfg, user_t* user, int files, long bytes);
                    123: DLLEXPORT BOOL DLLCALL user_adjust_credits(scfg_t* cfg, user_t* user, long amount);
                    124: DLLEXPORT BOOL DLLCALL user_adjust_minutes(scfg_t* cfg, user_t* user, long amount);
                    125: 
1.1.1.2 ! root      126: DLLEXPORT time_t DLLCALL gettimeleft(scfg_t* cfg, user_t* user, time_t starttime);
        !           127: 
        !           128: DLLEXPORT BOOL DLLCALL check_name(scfg_t* cfg, const char* name);
        !           129: 
        !           130: /* Login attempt/hack tracking */
        !           131: typedef struct {
        !           132:        IN_ADDR         addr;   /* host with consecutive failed login attmepts */
        !           133:        ulong           count;  /* number of consecutive failed login attempts */
        !           134:        ulong           dupes;  /* number of consecutive dupliate login attempts (same name and password) */
        !           135:        time_t          time;   /* time of last attempt */
        !           136:        char            prot[32];       /* protocol used in last attempt */
        !           137:        char            user[128];
        !           138:        char            pass[128];
        !           139: } login_attempt_t;
        !           140: 
        !           141: DLLEXPORT link_list_t*         DLLCALL loginAttemptListInit(link_list_t*);
        !           142: DLLEXPORT BOOL                         DLLCALL loginAttemptListFree(link_list_t*);
        !           143: DLLEXPORT long                         DLLCALL loginAttemptListClear(link_list_t*);
        !           144: DLLEXPORT long                         DLLCALL loginAttempts(link_list_t*, SOCKADDR_IN*);
        !           145: DLLEXPORT void                         DLLCALL loginSuccess(link_list_t*, SOCKADDR_IN*);
        !           146: DLLEXPORT ulong                                DLLCALL loginFailure(link_list_t*, SOCKADDR_IN*, const char* prot, const char* user, const char* pass);
        !           147: 
1.1       root      148: #ifdef __cplusplus
                    149: }
                    150: #endif
                    151: 
                    152: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.