mirror of
https://github.com/clearlinux/clrtrust.git
synced 2026-06-16 02:55:58 +00:00
Fix issue with multiple duplicates.
This commit is contained in:
@@ -128,9 +128,9 @@ cmd_generate() {
|
||||
if [ ! -z "$dup_certs" ]; then
|
||||
dup_certs_cnt=$(echo "$dup_certs" | wc -l)
|
||||
echo "$dup_certs_cnt certificate(s) are duplicated. Cleaning up..."
|
||||
for h in "${dup_certs}"; do
|
||||
tmp=$(echo "${ca_certs}" | grep $h | head -1)
|
||||
ca_certs=$(echo "${ca_certs}" | grep -v $h)
|
||||
for h in ${dup_certs}; do
|
||||
tmp=$(echo "${ca_certs}" | grep "${h}" | head -1)
|
||||
ca_certs=$(echo "${ca_certs}" | grep -v "${h}")
|
||||
ca_certs="${ca_certs}
|
||||
$tmp"
|
||||
done
|
||||
@@ -143,7 +143,7 @@ $tmp"
|
||||
distrust_certs_cnt=$(echo "$distrust_certs" | wc -l)
|
||||
echo "Distrusting $distrust_certs_cnt certificate(s)."
|
||||
for h in $(echo "$distrust_certs" | cut -f 2); do
|
||||
ca_certs=$(echo "$ca_certs" | grep -v $h)
|
||||
ca_certs=$(echo "$ca_certs" | grep -v "${h}")
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
@@ -10,16 +10,41 @@ setup() {
|
||||
cp $CERTS/c[3-4].pem $CLR_LOCAL_TRUST_SRC/trusted
|
||||
# add duplicate
|
||||
cp $CERTS/c1.pem $CLR_LOCAL_TRUST_SRC/trusted/c1-local.pem
|
||||
cp $CERTS/c1.pem $CLR_LOCAL_TRUST_SRC/trusted/c100-new.pem
|
||||
cp $CERTS/c2.pem $CLR_LOCAL_TRUST_SRC/trusted/c2-local.pem
|
||||
}
|
||||
|
||||
@test "generate store containing duplicates" {
|
||||
@test "generate store containing duplicates, multiple" {
|
||||
run $CLRTRUST generate
|
||||
[ $status -eq 0 ]
|
||||
cnt=$(ls $STORE/anchors | wc -l)
|
||||
[ $cnt -eq 8 ]
|
||||
cnt=$($CLRTRUST list | grep ^id | wc -l)
|
||||
[ $cnt -eq 4 ]
|
||||
}
|
||||
|
||||
@test "generate store containing duplicates, single, many instances" {
|
||||
rm $CLR_LOCAL_TRUST_SRC/trusted/c2-local.pem
|
||||
run $CLRTRUST generate
|
||||
[ $status -eq 0 ]
|
||||
cnt=$(ls $STORE/anchors | wc -l)
|
||||
[ $cnt -eq 8 ]
|
||||
cnt=$($CLRTRUST list | grep ^id | wc -l)
|
||||
[ $cnt -eq 4 ]
|
||||
$CLRTRUST list
|
||||
}
|
||||
|
||||
@test "generate store containing duplicates, single, one instance" {
|
||||
rm $CLR_LOCAL_TRUST_SRC/trusted/c100-new.pem
|
||||
run $CLRTRUST generate
|
||||
[ $status -eq 0 ]
|
||||
cnt=$(ls $STORE/anchors | wc -l)
|
||||
[ $cnt -eq 8 ]
|
||||
cnt=$($CLRTRUST list | grep ^id | wc -l)
|
||||
[ $cnt -eq 4 ]
|
||||
$CLRTRUST list
|
||||
}
|
||||
|
||||
teardown() {
|
||||
remove_fs
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user