projects
/
EVA-2020-02.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
test(bkgpslog):Add age recipient string processing code
[EVA-2020-02.git]
/
exec
/
bkgpslog
diff --git
a/exec/bkgpslog
b/exec/bkgpslog
index b97f250b8b37f34048dfe6dcdfb986589bf70d61..21c5fc08435c2549dbb68e9632c54331e2fe0e56 100755
(executable)
--- a/
exec/bkgpslog
+++ b/
exec/bkgpslog
@@
-15,6
+15,7
@@
declare -Ag appRollCall # Associative array for storing app status
declare -Ag fileRollCall # Associative array for storing file status
declare -Ag dirRollCall # Associative array for storing dir status
declare -a recPubKeys # for processArguments function
declare -Ag fileRollCall # Associative array for storing file status
declare -Ag dirRollCall # Associative array for storing dir status
declare -a recPubKeys # for processArguments function
+declare recipients # for main function
#===BEGIN Declare local script functions===
checkapp() {
#===BEGIN Declare local script functions===
checkapp() {
@@
-192,7
+193,7
@@
processArguments() {
-o | --output) if [ -d "$2" ]; then DIROUT="$2"; vbm "DEBUG:DIROUT:$DIROUT"; shift; fi ;; # Define output directory.
-e | --encrypt) OPTION_ENCRYPT="true"; vbm "DEBUG:Encrypted output mode enabled.";;
-r | --recipient) # Add 'age' recipient via public key string
-o | --output) if [ -d "$2" ]; then DIROUT="$2"; vbm "DEBUG:DIROUT:$DIROUT"; shift; fi ;; # Define output directory.
-e | --encrypt) OPTION_ENCRYPT="true"; vbm "DEBUG:Encrypted output mode enabled.";;
-r | --recipient) # Add 'age' recipient via public key string
- recPubKeys+=("$2"); shift;;
+ recPubKeys+=("$2");
vbm "pubkey added:""$2";
shift;;
*) echoerr "ERROR: Unrecognized argument."; exit 1;; # Handle unrecognized options.
esac
shift
*) echoerr "ERROR: Unrecognized argument."; exit 1;; # Handle unrecognized options.
esac
shift
@@
-276,8
+277,15
@@
main() {
for pubkey in "${recPubKeys[@]}"; do # Validate recipient pubkey strings by forming test message
vbm "DEBUG:Testing pubkey string:$pubkey"
if ! echo "butts" | age -a -r "$pubkey" 1>/dev/null; then
for pubkey in "${recPubKeys[@]}"; do # Validate recipient pubkey strings by forming test message
vbm "DEBUG:Testing pubkey string:$pubkey"
if ! echo "butts" | age -a -r "$pubkey" 1>/dev/null; then
- yell "ERROR:Exit code ""$?"". Invalid recipient pubkey string. Exiting."; exit 1; fi
+ yell "ERROR:Exit code ""$?"". Invalid recipient pubkey string. Exiting."; exit 1;
+ else
+ # Form age recipient string
+ recipients="$recipients""-r $pubkey ";
+ vbm "Added pubkey:""$pubkey";
+ vbm "DEBUG:recipients:""$recipients";
+ fi
done
done
+ vbm "DEBUG:Finished processing recPubKeys array";
else
yell "ERROR:Encryption enabled but \"age\" not found. Exiting."; exit 1;
fi
else
yell "ERROR:Encryption enabled but \"age\" not found. Exiting."; exit 1;
fi