5 #define SESSION_FOLDER "/var/run/cwebfiles/sessions/"
6 #define SESSION_LENGTH 60 * 60 * 3 /* unit is seconds; we allow three-hour-sessions */
8 #define COOKIE_NAME "WEBFILESESS"
9 #define COOKIE_LENGTH 64
11 #define RANDDEV "/dev/urandom"
14 #define NOTMYFAULT false
16 struct cgi_serialized_session_status {
17 // "man useradd" says 32 chars is the length limit
23 extern struct cgi_serialized_session_status session;
25 void unhex(unsigned char *out, char *in, size_t in_len);
26 void hex(char *out, unsigned char *in, size_t in_len);
27 bool checkhex(char *p, size_t l);
29 int authenticate_by_cookie(char *cookie);
30 void persist_session(char *cookie);
31 void senderr(char *errmsg, bool myfault);
32 void grabrand(unsigned char *out, size_t len);
33 void login_and_setup();
35 #define OUTBUFSIZE 64*1024
37 char outbuf[OUTBUFSIZE]; \
38 setvbuf(stdout, outbuf, _IOFBF, OUTBUFSIZE); \