Make sq pki link list
fail if a designated cert has no link.
- Fixes #484.
This commit is contained in:
parent
5c2829fa7a
commit
7397a8a440
@ -59,6 +59,12 @@ where
|
||||
fn as_ref(&self) -> &T;
|
||||
}
|
||||
|
||||
impl MyAsRef<UserID> for UserID {
|
||||
fn as_ref(&self) -> &UserID {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl MyAsRef<UserID> for &UserID {
|
||||
fn as_ref(&self) -> &UserID {
|
||||
self
|
||||
|
@ -191,7 +191,27 @@ pub fn list(sq: Sq, mut c: link::ListCommand)
|
||||
let (certs, errors) = if c.certs.is_empty() {
|
||||
(cert_store.certs(), Vec::new())
|
||||
} else {
|
||||
let (c, e) = sq.resolve_certs(&c.certs, 0)?;
|
||||
let (c, e) = sq.resolve_certs_filter(
|
||||
&c.certs, 0, &mut |designator, cert| {
|
||||
let userids = cert.userids().filter(|uid| {
|
||||
match designator.query_params() {
|
||||
Err(_) => false,
|
||||
Ok(None) => true,
|
||||
Ok(Some((q, p))) => q.check(uid, &p),
|
||||
}
|
||||
});
|
||||
|
||||
if active_certification(
|
||||
&sq, cert.to_cert()?, userids, trust_root_key)
|
||||
.into_iter()
|
||||
.filter(|(_uid, certification)| certification.is_some())
|
||||
.next().is_some()
|
||||
{
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow::anyhow!("not linked"))
|
||||
}
|
||||
})?;
|
||||
(Box::new(c.into_iter().map(|c| Arc::new(LazyCert::from(c))))
|
||||
as Box<dyn Iterator<Item=Arc<LazyCert<'_>>>>,
|
||||
e)
|
||||
|
@ -16,10 +16,7 @@ fn list_empty() {
|
||||
sq.key_import(cert_path);
|
||||
|
||||
// Not linked => error.
|
||||
|
||||
// Reenable when the following issue is fixed:
|
||||
// https://gitlab.com/sequoia-pgp/sequoia-sq/-/issues/484
|
||||
//assert!(sq.try_pki_link_list(&["alice"]).is_err());
|
||||
assert!(sq.try_pki_link_list(&["alice"]).is_err());
|
||||
|
||||
// Not found => error.
|
||||
assert!(sq.try_pki_link_list(&["not found"]).is_err());
|
||||
|
Loading…
Reference in New Issue
Block a user