Skip to content

Commit aa58c50

Browse files
committed
Added the string to sign for the ds3 signature to the DEBUG logging output to help with troubleshooting.
1 parent 2d9d845 commit aa58c50

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/ds3.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,13 +357,17 @@ static char* _generate_date_string(void) {
357357
return date_string;
358358
}
359359

360-
static char* _net_compute_signature(const ds3_creds* creds, http_verb verb, char* resource_name,
360+
static char* _net_compute_signature(const ds3_log* log, const ds3_creds* creds, http_verb verb, char* resource_name,
361361
char* date, char* content_type, char* md5, char* amz_headers) {
362362
GHmac* hmac;
363363
gchar* signature;
364364
gsize bufSize = 256;
365365
guint8 buffer[256];
366366
unsigned char* signature_str = _generate_signature_str(verb, resource_name, date, content_type, md5, amz_headers);
367+
unsigned char* escaped_str = g_strescape(signature_str, NULL);
368+
369+
LOG(log, DEBUG, "signature string: %s", escaped_str);
370+
g_free(escaped_str);
367371

368372
hmac = g_hmac_new(G_CHECKSUM_SHA1, (unsigned char*) creds->secret_key->value, creds->secret_key->size);
369373
g_hmac_update(hmac, signature_str, -1);
@@ -571,7 +575,7 @@ static ds3_error* _net_process_request(const ds3_client* client, const ds3_reque
571575

572576
date = _generate_date_string();
573577
date_header = g_strconcat("Date: ", date, NULL);
574-
signature = _net_compute_signature(client->creds, request->verb, request->path->value, date, "", "", "");
578+
signature = _net_compute_signature(client->log, client->creds, request->verb, request->path->value, date, "", "", "");
575579
headers = NULL;
576580
auth_header = g_strconcat("Authorization: AWS ", client->creds->access_id->value, ":", signature, NULL);
577581

0 commit comments

Comments
 (0)