URL:
https://github.com/SSSD/sssd/pull/5705
Title: #5705: p11_child: do_card fix loop exit condition
assafmo commented:
"""
Also, the most recent version for Debian is v2.2.3
(8607b4822e4b6437d87dabf714882407f8959ef2), so here's the fix for it:
```diff
[
p11_child.patch.txt](https://github.com/SSSD/sssd/files/6820708/p11_child...
[
p11_child.patch.txt](https://github.com/SSSD/sssd/files/6820710/p11_child...
diff --git a/src/p11_child/p11_child_nss.c b/src/p11_child/p11_child_nss.c
index d3064ff..a7520df 100644
--- a/src/p11_child/p11_child_nss.c
+++ b/src/p11_child/p11_child_nss.c
@@ -595,7 +595,7 @@ errno_t do_card(TALLOC_CTX *mem_ctx, struct p11_ctx *p11_ctx,
(slInfo.flags & CKF_REMOVABLE_DEVICE) ? "true":
"false",
(slInfo.flags & CKF_TOKEN_PRESENT) ? "true":
"false");
- if (rv == SECSuccess && (slInfo.flags &
CKF_REMOVABLE_DEVICE)) {
+ if (rv == SECSuccess && (slInfo.flags & CKF_REMOVABLE_DEVICE)
&& (slInfo.flags & CKF_TOKEN_PRESENT)) {
slot = PK11_ReferenceSlot(mod_list_item->module->slots[s]);
break;
}
diff --git a/src/p11_child/p11_child_openssl.c b/src/p11_child/p11_child_openssl.c
index 56601b1..586af33 100644
--- a/src/p11_child/p11_child_openssl.c
+++ b/src/p11_child/p11_child_openssl.c
@@ -1714,7 +1714,7 @@ errno_t do_card(TALLOC_CTX *mem_ctx, struct p11_ctx *p11_ctx,
}
- if ((info.flags & CKF_REMOVABLE_DEVICE)) {
+ if ((info.flags & CKF_REMOVABLE_DEVICE) && (info.flags &
CKF_TOKEN_PRESENT)) {
break;
}
}
```
"""
See the full comment at
https://github.com/SSSD/sssd/pull/5705#issuecomment-880421092