X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=server%2Ffastcgi.h;h=de02501c03c3163e5a13515a406bc536581d65b2;hb=1538b01df7b16dc1223c1459620dac4b22c916a4;hp=365aa6c6d0565ae91f3afa215cdb91c6561bd07f;hpb=6a5de8e3b2870ca950f2116aeb9561ad7d707427;p=matches%2FMCTX3420.git diff --git a/server/fastcgi.h b/server/fastcgi.h index 365aa6c..de02501 100644 --- a/server/fastcgi.h +++ b/server/fastcgi.h @@ -33,19 +33,31 @@ typedef enum StatusCodes { #define FCGI_RECEIVED(x) ((x) & FCGI_PARAM_RECEIVED) #define FCGI_TYPE(x) ((x) & ~(FCGI_PARAM_REQUIRED | FCGI_PARAM_RECEIVED)) +#define CONTROL_KEY_BUFSIZ 41 + typedef struct FCGIValue { const char *key; void *value; unsigned flags; } FCGIValue; +typedef enum {USER_UNAUTH, USER_NORMAL, USER_ADMIN} UserType; + /**Contextual information related to FCGI requests*/ typedef struct { - /**The time of last valid user access possessing the control key*/ + /**The time of last valid user access possessing the control key**/ time_t control_timestamp; - char control_key[41]; + /**A SHA-1 hash that is the control key, determining who is logged in**/ + char control_key[CONTROL_KEY_BUFSIZ]; + /**The IPv4 address of the logged-in user**/ char control_ip[16]; + /**Determines if the user is an admin or not**/ + UserType user_type; + /**Name of the logged in user**/ + char user_name[31]; + /**User directory for the logged in user**/ + char user_dir[BUFSIZ]; /**The name of the current module**/ const char *current_module; /**For debugging purposes?**/ @@ -54,7 +66,7 @@ typedef struct typedef void (*ModuleHandler) (FCGIContext *context, char *params); -extern bool FCGI_LockControl(FCGIContext *context, bool force); +extern bool FCGI_LockControl(FCGIContext *context, const char * user_name, UserType user_type); extern void FCGI_ReleaseControl(FCGIContext *context); extern bool FCGI_HasControl(FCGIContext *context, const char *key); extern char *FCGI_KeyPair(char *in, const char **key, const char **value);