Skip to content

Commit

Permalink
nssdb: Properly set PIN initialization flag
Browse files Browse the repository at this point in the history
Signed-off-by: Simo Sorce <[email protected]>
  • Loading branch information
simo5 committed Dec 12, 2024
1 parent abfb25c commit c466d0d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/storage/nssdb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ impl NSSStorage {
if self.config.password_required {
info.flags |= CKF_LOGIN_REQUIRED;
}
match self.fetch_password() {
Ok(_) => info.flags |= CKF_USER_PIN_INITIALIZED,
Err(e) => {
if e.rv() != CKR_USER_PIN_NOT_INITIALIZED {
return Err(e);
}
}
}
Ok(info)
}

Expand Down Expand Up @@ -803,6 +811,10 @@ impl Storage for NSSStorage {
if ret != CKR_OK {
return Err(ret)?;
}
/* ensure we drop the lock here, otherwise we deadlock inside
* get_token_info() where we try to acquire it again to search
* the database. */
drop(conn);
self.get_token_info()
}

Expand Down

0 comments on commit c466d0d

Please sign in to comment.