liquid_feedback_frontend

changeset 871:0f29051a49f6

Added support for public access to getpic.c
author bsw
date Sat Aug 18 22:49:18 2012 +0200 (2012-08-18)
parents cf0b64e101d9
children 176269e11991
files fastpath/Makefile fastpath/getpic.c
line diff
     1.1 --- a/fastpath/Makefile	Fri Aug 17 20:52:56 2012 +0200
     1.2 +++ b/fastpath/Makefile	Sat Aug 18 22:49:18 2012 +0200
     1.3 @@ -1,5 +1,5 @@
     1.4  getpic: getpic.c
     1.5 -	cc -g -Wall -o getpic getpic.c -I `pg_config --includedir` -L `pg_config --libdir` -lpq -Wl,-rpath,`pg_config --libdir`
     1.6 +	cc -g -Wall -o getpic getpic.c -I `pg_config --includedir` -L `pg_config --libdir` -lpq -Wl,-rpath,`pg_config --libdir` -D PUBLIC_ACCESS
     1.7  
     1.8  clean::
     1.9  	rm -f getpic
     2.1 --- a/fastpath/getpic.c	Fri Aug 17 20:52:56 2012 +0200
     2.2 +++ b/fastpath/getpic.c	Sat Aug 18 22:49:18 2012 +0200
     2.3 @@ -22,28 +22,33 @@
     2.4    char *image_type;
     2.5    const char *sql_member_image_params[2];
     2.6  
     2.7 +#ifndef PUBLIC_ACCESS
     2.8    char *cookies;
     2.9    regex_t session_ident_regex;
    2.10    ssize_t start, length;
    2.11    regmatch_t session_ident_regmatch[3];
    2.12    char *session_ident;
    2.13    const char *sql_session_params[1];
    2.14 +#endif
    2.15  
    2.16    PGconn *conn;
    2.17    PGresult *dbr;
    2.18  
    2.19    args_string = getenv("QUERY_STRING");
    2.20 +#ifndef PUBLIC_ACCESS
    2.21    cookies = getenv("HTTP_COOKIE");
    2.22    if (!args_string || !cookies) {
    2.23      fputs("Status: 403 Access Denied\n\n", stdout);
    2.24      return 0;
    2.25    }
    2.26 +#endif
    2.27  
    2.28    member_id   = strtok(args_string, "+");
    2.29    image_type  = strtok(NULL, "+");
    2.30    sql_member_image_params[0] = member_id;
    2.31    sql_member_image_params[1] = image_type;
    2.32  
    2.33 +#ifndef PUBLIC_ACCESS
    2.34    if (regcomp(&session_ident_regex, "(^|[; \t])liquid_feedback_session=([0-9A-Za-z]+)", REG_EXTENDED) != 0) {
    2.35      // shouldn't happen
    2.36      abort();
    2.37 @@ -85,6 +90,7 @@
    2.38      PQfinish(conn);
    2.39      return 0;
    2.40    }
    2.41 +#endif
    2.42  
    2.43    dbr = PQexecParams(conn,
    2.44      "SELECT content_type, data "

Impressum / About Us