diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ac8f968 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.o +*.so +*.pyc + +# Logs and databases # +###################### +*.log + +# OS generated files # +###################### +.DS_Store* +ehthumbs.db +Icon? +Thumbs.db diff --git a/README b/README index b956f88..c9bdd89 100644 --- a/README +++ b/README @@ -46,7 +46,7 @@ Apache configuration (httpd.conf) FlickrUser FlickrKey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx FlickrSecret xxxxxxxxxxxxxxx - FlickrAuth xxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxx + FlickrAuth xxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxx 3. Enter the following so that the request reached mod_flickr handler. diff --git a/flick.h b/flick.h index 849b03a..9cf90e6 100644 --- a/flick.h +++ b/flick.h @@ -61,7 +61,7 @@ typedef struct { char *page; char *user; char *api_call; - + /* curl fetched data */ mem_chunk mem; char *raw_args; @@ -70,7 +70,7 @@ typedef struct { int iterations; /* credentials of the user requested */ - api_key_secret *creds; + api_key_secret *creds; } page_data; diff --git a/md5.h b/md5.h index 42057f3..b5a0437 100644 --- a/md5.h +++ b/md5.h @@ -9,20 +9,20 @@ * md5.c - MD5 Message Digest Algorithm * * Copyright (C) 2007-2008, David Beckett http://www.dajobe.org/ - * + * * This file is licensed under the following three licenses as alternatives: * 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version * 2. GNU General Public License (GPL) V2 or any newer version * 3. Apache License, V2.0 or any newer version - * + * * You may not use this file except in compliance with at least one of * the above three licenses. - * + * * See LICENSE.html or LICENSE.txt at the top of this package for the * complete terms and further detail along with the license texts for * the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively. - * - * + * + * */ @@ -56,7 +56,7 @@ struct MD5Context { }; static void MD5Init(struct MD5Context *context); -static void MD5Update(struct MD5Context *context, +static void MD5Update(struct MD5Context *context, const unsigned char *buf, unsigned len); static void MD5Final(struct MD5Context *context); @@ -114,19 +114,19 @@ static void MD5Update(struct MD5Context *ctx, u32 t; /* Update bitcount */ - + t = ctx->bits[0]; if ((ctx->bits[0] = t + ((u32) len << 3)) < t) ctx->bits[1]++; /* Carry from low to high */ ctx->bits[1] += len >> 29; - + t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ - + /* Handle any leading odd-sized chunks */ - + if (t) { unsigned char *p = (unsigned char *) ctx->in + t; - + t = 64 - t; if (len < t) { memcpy(p, buf, len); @@ -150,12 +150,12 @@ static void MD5Update(struct MD5Context *ctx, } /* Handle any remaining bytes of data. */ - + memcpy(ctx->in, buf, len); } /* - * Final wrapup - pad to 64-byte boundary with the bit pattern + * Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) */ @@ -172,17 +172,17 @@ static void MD5Final(struct MD5Context *ctx) always at least one byte free */ p = ctx->in + count; *p++ = 0x80; - + /* Bytes of padding needed to make 64 bytes */ count = 64 - 1 - count; - + /* Pad out to 56 mod 64 */ if (count < 8) { /* Two lots of padding: Pad the first block to 64 bytes */ memset(p, 0, count); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (u32 *) ctx->in); - + /* Now fill the next block with 56 bytes */ memset(ctx->in, 0, 56); } else { @@ -190,11 +190,11 @@ static void MD5Final(struct MD5Context *ctx) memset(p, 0, count - 8); } byteReverse(ctx->in, 14); - + /* Append length in bits and transform */ ((u32 *) ctx->in)[14] = ctx->bits[0]; ((u32 *) ctx->in)[15] = ctx->bits[1]; - + MD5Transform(ctx->buf, (u32 *) ctx->in); byteReverse((unsigned char *) ctx->buf, 4); memcpy(ctx->digest, ctx->buf, 16); @@ -222,12 +222,12 @@ static void MD5Final(struct MD5Context *ctx) static void MD5Transform(u32 buf[4], u32 const in[16]) { register u32 a, b, c, d; - + a = buf[0]; b = buf[1]; c = buf[2]; d = buf[3]; - + MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); @@ -244,7 +244,7 @@ static void MD5Transform(u32 buf[4], u32 const in[16]) MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); - + MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); @@ -278,7 +278,7 @@ static void MD5Transform(u32 buf[4], u32 const in[16]) MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); - + MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); @@ -295,7 +295,7 @@ static void MD5Transform(u32 buf[4], u32 const in[16]) MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); - + buf[0] += a; buf[1] += b; buf[2] += c; @@ -322,15 +322,15 @@ MD5_string(apr_pool_t *p, char *string) MD5Init(&md5); MD5Update(&md5, (const unsigned char*)string, len); MD5Final(&md5); - + #define MD5_LEN 16 b=(char*)apr_pcalloc(p, (1+(MD5_LEN<<1))); if(!b) return NULL; - + for(i=0; i < MD5_LEN; i++) sprintf(b+(i<<1), "%02x", (unsigned int)md5.digest[i]); b[i<<1]='\0'; - + return b; } diff --git a/mod_flickr.c b/mod_flickr.c index 9574c27..033cfe4 100644 --- a/mod_flickr.c +++ b/mod_flickr.c @@ -23,7 +23,7 @@ * mod_flickr * Apache module curl'ing flickr api's to * retrieve user's album etc.. - * + * */ /* @@ -97,7 +97,7 @@ static char * memory pool. */ -static char +static char *flickr_dup_string(apr_pool_t *p, char *s) { return apr_pstrdup(p, s); @@ -117,7 +117,7 @@ static char #define APIGET(h,k) apr_hash_get(h, k,\ APR_HASH_KEY_STRING) /* - * Duplicate string (key/value) and + * Duplicate string (key/value) and * set it in the table. * * @args: @@ -141,7 +141,7 @@ add_length(void *tbl, char *key, char *value) t->args_len += strlen(key) + strlen(value); t->nr_iterations++; - + return 1; } @@ -243,7 +243,7 @@ flickr_memory_alloc(void *data, size_t size) } static size_t -curl_process_chunk(void *remote_data, size_t sz, +curl_process_chunk(void *remote_data, size_t sz, size_t mems, void *data) { @@ -352,7 +352,7 @@ static void *create_per_server_config(apr_pool_t *p, server_rec *s) { user_cred *uc = apr_pcalloc(p, sizeof(user_cred)); - + uc->on_off = 0; /* Off by default */ uc->user = apr_hash_make(p); @@ -422,7 +422,7 @@ static const command_rec module_cmds[] = { AP_INIT_TAKE2("FlickrAuth", flickr_set_var, (void *)APR_OFFSETOF(api_key_secret, auth_token), RSRC_CONF, "Username and Auth token"), - {NULL} + {NULL} }; /* @@ -471,7 +471,7 @@ static const command_rec module_cmds[] = { #define GETDATA(pg,a) flickr_request_data(&pg->mem, a); #define DATA(pg) pg->mem.api_response - + /* ----------------------------------------------------------- */ /* API CALL ROUTINES */ @@ -482,7 +482,7 @@ static const command_rec module_cmds[] = { /* 2. Else call the param split routine to */ /* get the individual params. */ /* 3. Return one of the two flickr status */ -/* constants defined in flick.h */ +/* constants defined in flick.h */ /* ----------------------------------------------------------- */ /* @@ -498,7 +498,7 @@ flickr_get_my_photos(request_rec *r, page_data *pg) char *xtra_params[2]; table_stat ts = {0,0}; - apr_table_t *method_args = apr_table_make(r->pool, 5); + apr_table_t *method_args = apr_table_make(r->pool, 5); if (!flickr_get_xtra_params(r, pg, xtra_params, 2)) return FLICKR_STATUS_ERR; @@ -546,7 +546,7 @@ flickr_get_my_sets(request_rec *r, page_data *pg) char *api, *hash; table_stat ts = {0,0}; - apr_table_t *method_args = apr_table_make(r->pool, 1); + apr_table_t *method_args = apr_table_make(r->pool, 1); ATSD(r->pool,method_args,"method","flickr.photosets.getList"); GENHASHSTRING(r, pg, ts, method_args); @@ -580,7 +580,7 @@ flickr_get_recent_photos(request_rec *r, page_data *pg) char *xtra_params[2]; table_stat ts = {0,0}; - apr_table_t *method_args = apr_table_make(r->pool, 3); + apr_table_t *method_args = apr_table_make(r->pool, 3); if (!flickr_get_xtra_params(r, pg, xtra_params, 2)) return FLICKR_STATUS_ERR; @@ -620,7 +620,7 @@ flickr_get_photos_in_set(request_rec *r, page_data *pg) char *xtra_params[3]; table_stat ts = {0,0}; - apr_table_t *method_args = apr_table_make(r->pool, 5); + apr_table_t *method_args = apr_table_make(r->pool, 5); if (!flickr_get_xtra_params(r, pg, xtra_params, 3)) return FLICKR_STATUS_ERR; @@ -716,7 +716,7 @@ flickr_child_init(apr_pool_t *pchild, server_rec *s) svr_cfg = apr_pcalloc(pchild, sizeof(svr_constants)); svr_cfg->user_id = DUP(pchild, "user_id"); - svr_cfg->who = DUP(pchild, "me"); + svr_cfg->who = DUP(pchild, "me"); /* initialize the API call table. */ svr_cfg->api_call_table = apr_hash_make(pchild);