From c347f520dc81ad39fe1657c8bb291546852d97ad Mon Sep 17 00:00:00 2001 From: mwolson_admin Date: Wed, 25 Jun 2008 00:08:00 -0400 Subject: [PATCH] s3: Make location of hmac script a constant. --- s3 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/s3 b/s3 index 4d070b4..aa6a075 100755 --- a/s3 +++ b/s3 @@ -3,7 +3,7 @@ # Licensed under the terms of the GNU GPL v2 # Copyright 2007 Victor Lowther - +HMAC=$(dirname $0)/s3-hmac # print a message and bail die() { @@ -39,8 +39,15 @@ check_dep() { (( res == 0 )) || die "aborting." } +check_hmac() { + if test ! -f $HMAC || test ! -x $HMAC; then + die "hmac script not found or not executable." + fi +} + check_deps() { - check_dep openssl date hmac cat grep curl + check_dep openssl date cat grep curl + check_hmac check_s3 } @@ -96,7 +103,7 @@ s3_signature_string() { printf "%s\n%s\n%s\n%s\n%s%s%s" \ "${verb}" "${md5}" "${mime}" "${date}" \ "${headers}" "${bucket}" "${resource}" | \ - hmac sha1 "${S3_SECRET_ACCESS_KEY}" | openssl base64 -e -a + $HMAC sha1 "${S3_SECRET_ACCESS_KEY}" | openssl base64 -e -a } # cheesy, but it is the best way to have multiple headers. -- 2.20.1