mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 12:37:00 +01:00
20230628 tpm minor issue with key regen (#1790)
* Ignore key that cant be loaded * fix handle
This commit is contained in:
parent
69dfea3601
commit
b752ab65b8
|
@ -830,20 +830,22 @@ pub(crate) mod tpm {
|
|||
|
||||
let ex_ctx = if let Some(ctx_data) = ctx_data {
|
||||
// Test loading, blank it out if it fails.
|
||||
// deserialise
|
||||
let maybe_ctx: TpmsContext =
|
||||
serde_json::from_slice(ctx_data.as_slice()).map_err(|e| {
|
||||
warn!("json error -> {:?}", e);
|
||||
})?;
|
||||
|
||||
})
|
||||
// On error, becomes none and we do nothing else.
|
||||
.ok()
|
||||
.and_then(|maybe_ctx: TpmsContext| {
|
||||
// can it load?
|
||||
context
|
||||
.execute_with_nullauth_session(|ctx| ctx.context_load(maybe_ctx.clone()))
|
||||
.map_err(|e| {
|
||||
error!(tpm_err = ?e, "Failed to load tpm context");
|
||||
})?;
|
||||
|
||||
Some(maybe_ctx)
|
||||
})
|
||||
.ok()
|
||||
// It loaded, so sub in our context.
|
||||
.map(|_handle| maybe_ctx)
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue