1 #ifndef _PASSWORDS_H_ 2 #define _PASSWORDS_H_ 3 4 char authenticate_user(const char *username, const char *pwd); 5 6 char isallowed(const char *username, const char *perm); 7 8 // Initialise the list of of user passwords permissions from file 9 void init_passwords(const char *filename); 10 // Free all space used for internal data structures 11 void close_passwords(void); 12 13 #define MAX_USERS 128 // Maximum number of users 14 #define USERNAME_LENGTH 12 // Max length of user name 15 #define PWDHASH_LENGTH 40 // Max lenght of pwd hash 16 17 typedef struct { 18 char username[USERNAME_LENGTH + 1]; 19 char pwdhash[PWDHASH_LENGTH + 1]; 20 char *perms; // pointer to string containing ":" delimited permissions 21 } pwdentry; 22 23 typedef pwdentry *p_pwdentry; 24 25 #define GUEST_USER "guest" 26 27 #endif 28