diff options
author | mboelen <michael@cisofy.com> | 2014-11-04 04:08:56 +0300 |
---|---|---|
committer | mboelen <michael@cisofy.com> | 2014-11-04 04:08:56 +0300 |
commit | 160f727709ec1ca200ee014a06714f7818cb3526 (patch) | |
tree | f31b57951f3d9ec82aba7aeab9455d9faee721cc | |
parent | 6eedbdd17697280a814787f3cfaf7dee95791265 (diff) |
Try to use OpenSSL for SHA1 related functions if sha1/sha1sum are not present
-rw-r--r-- | include/functions | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/include/functions b/include/functions index 4b54a0d2..c6742072 100644 --- a/include/functions +++ b/include/functions @@ -354,7 +354,7 @@ { HOSTID="-" FIND="" - if [ ! "${SHA1SUMBINARY}" = "" ]; then + if [ ! "${SHA1SUMBINARY}" = "" -a ! "${OPENSSLBINARY}" = "" ]; then case "${OS}" in @@ -472,7 +472,15 @@ done if [ ${FOUND} -eq 1 ]; then FIND=`${IFCONFIGBINARY} ${I} | grep ether | awk '{ if ($1=="ether") { print $2 }}'` - HOSTID=`echo ${FIND} | ${SHA1SUMBINARY} | awk '{ print $1 }'` + if [ ! "${SHA1SUMBINARY}" = "" ]; then + HOSTID=`echo ${FIND} | ${SHA1SUMBINARY} | awk '{ print $1 }'` + else + if [ ! "${OPENSSLBINARY}" = "" ]; then + HOSTID=`echo ${FIND} | ${OPENSSLBINARY} sha -sha1 | awk '{ print $2 }'` + else + ReportException "GetHostID" "Can not find sha1/sha1sum or openssl" + fi + fi else ReportException "GetHostID" "No interface found op Solaris to create HostID" fi @@ -480,11 +488,11 @@ *) - ReportException "GetHostID" "Can't create HOSTID as OS is not supported by this function" + ReportException "GetHostID" "Can't create HOSTID as OS is not supported yet by this function" ;; esac else - report "exception[]=No SHA1/SHA1SUM binary found to create HOSTID" + report "exception[]=No SHA1/SHA1SUM/OPENSSL binaries found to create HOSTID" fi # Search machine ID |