diff --git a/testdefs.sh b/testdefs.sh index 942ae12a..28ca2703 100644 --- a/testdefs.sh +++ b/testdefs.sh @@ -702,6 +702,8 @@ create_single_identity() { # - pass [args...] to the keyring add # - if variables DID{I}{1..N} and/or NAME{I}{1..N} are already set, then use # them to set the DIDs and names of each identity +# - if variables PIN{I}{1..N} are already set, then use them as the --entry-pin +# option to set the DIDs and names of each identity # - assert that all SIDs are unique # - assert that all SIDs appear in keyring list # - set variables SID{I}{1..N} to SIDs of identities, eg, SIDA1, SIDA2... @@ -723,11 +725,19 @@ create_identities() { shift local i j for ((i = 1; i <= N; ++i)); do - executeOk_servald keyring add "${servald_options[@]}" - assert [ -e "$SERVALINSTANCE_PATH/serval.keyring" ] + local pinvar=PIN$instance_name$i + local pin="${!pinvar}" + servald_options+=(${pin:+--entry-pin="$pin"}) + done + for ((i = 1; i <= N; ++i)); do + local pinvar=PIN$instance_name$i local sidvar=SID$instance_name$i local didvar=DID$instance_name$i local namevar=NAME$instance_name$i + local pin="${!pinvar}" + [ -n "$pin" ] && tfw_log "$pinvar=$(shellarg "$pin")" + executeOk_servald keyring add "${servald_options[@]}" "$pin" + assert [ -e "$SERVALINSTANCE_PATH/serval.keyring" ] extract_stdout_keyvalue $sidvar sid "$rexp_sid" tfw_log "$sidvar=${!sidvar}" # If the DID and/or NAME is already specified in the variables, then use