Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Apache configuration (httpd.conf)
FlickrUser <user>
FlickrKey <user> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
FlickrSecret <user> xxxxxxxxxxxxxxx
FlickrAuth <user> xxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxx
FlickrAuth <user> xxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxx

3. Enter the following so that the request reached mod_flickr
handler.
Expand Down
4 changes: 2 additions & 2 deletions flick.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ typedef struct {
char *page;
char *user;
char *api_call;

/* curl fetched data */
mem_chunk mem;
char *raw_args;
Expand All @@ -70,7 +70,7 @@ typedef struct {
int iterations;

/* credentials of the user requested */
api_key_secret *creds;
api_key_secret *creds;
} page_data;


Expand Down
52 changes: 26 additions & 26 deletions md5.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
*
*
*
*/


Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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)
*/

Expand All @@ -172,29 +172,29 @@ 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 {
/* Pad block to 56 bytes */
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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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;
}
28 changes: 14 additions & 14 deletions mod_flickr.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* mod_flickr
* Apache module curl'ing flickr api's to
* retrieve user's album etc..
*
*
*/

/*
Expand Down Expand Up @@ -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);
Expand All @@ -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:
Expand All @@ -141,7 +141,7 @@ add_length(void *tbl, char *key, char *value)

t->args_len += strlen(key) + strlen(value);
t->nr_iterations++;

return 1;
}

Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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}
};

/*
Expand Down Expand Up @@ -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 */
Expand All @@ -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 */
/* ----------------------------------------------------------- */

/*
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down