user.h (668B)
1 #define NameMin 3 2 #define NameMax 64 3 #define PassMin 8 4 #define PassMax 72 5 6 enum user_error { 7 LoginValid, 8 LoginNotFound, 9 LoginInvalid, 10 LoginSystem, 11 LoginCorrupt, 12 LoginLast 13 }; 14 15 struct user { 16 char *name; 17 char *hash; 18 char *auth; 19 }; 20 21 struct pagedata; 22 23 extern char *user_errors[]; 24 25 int adduser(struct pagedata *pd, char *name, char *key); 26 int deleteuser(struct pagedata *pd, char *hash); 27 void freeuser(struct user *user); 28 enum user_error getuser(struct user **user, struct pagedata *pd, 29 char *field, char *value); 30 enum user_error loginuser(struct user **ruser, struct pagedata *pd, 31 char *name, char *key); 32 int revoketokens(struct pagedata *pd, char *hash);