# HG changeset patch # User bsw # Date 1345322958 -7200 # Node ID 0f29051a49f62c83647fc383a07290d011d82808 # Parent cf0b64e101d99e535b32e8f00862d92c87fedf6a Added support for public access to getpic.c diff -r cf0b64e101d9 -r 0f29051a49f6 fastpath/Makefile --- a/fastpath/Makefile Fri Aug 17 20:52:56 2012 +0200 +++ b/fastpath/Makefile Sat Aug 18 22:49:18 2012 +0200 @@ -1,5 +1,5 @@ getpic: getpic.c - cc -g -Wall -o getpic getpic.c -I `pg_config --includedir` -L `pg_config --libdir` -lpq -Wl,-rpath,`pg_config --libdir` + cc -g -Wall -o getpic getpic.c -I `pg_config --includedir` -L `pg_config --libdir` -lpq -Wl,-rpath,`pg_config --libdir` -D PUBLIC_ACCESS clean:: rm -f getpic diff -r cf0b64e101d9 -r 0f29051a49f6 fastpath/getpic.c --- a/fastpath/getpic.c Fri Aug 17 20:52:56 2012 +0200 +++ b/fastpath/getpic.c Sat Aug 18 22:49:18 2012 +0200 @@ -22,28 +22,33 @@ char *image_type; const char *sql_member_image_params[2]; +#ifndef PUBLIC_ACCESS char *cookies; regex_t session_ident_regex; ssize_t start, length; regmatch_t session_ident_regmatch[3]; char *session_ident; const char *sql_session_params[1]; +#endif PGconn *conn; PGresult *dbr; args_string = getenv("QUERY_STRING"); +#ifndef PUBLIC_ACCESS cookies = getenv("HTTP_COOKIE"); if (!args_string || !cookies) { fputs("Status: 403 Access Denied\n\n", stdout); return 0; } +#endif member_id = strtok(args_string, "+"); image_type = strtok(NULL, "+"); sql_member_image_params[0] = member_id; sql_member_image_params[1] = image_type; +#ifndef PUBLIC_ACCESS if (regcomp(&session_ident_regex, "(^|[; \t])liquid_feedback_session=([0-9A-Za-z]+)", REG_EXTENDED) != 0) { // shouldn't happen abort(); @@ -85,6 +90,7 @@ PQfinish(conn); return 0; } +#endif dbr = PQexecParams(conn, "SELECT content_type, data "