Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions security-framework/src/access_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use security_framework_sys::access_control::{
};
use security_framework_sys::base::{errSecParam, SecAccessControlRef};
use std::fmt;
use std::ptr::{self, null};
use std::ptr;

declare_TCFType! {
/// A type representing sec access control settings.
Expand Down Expand Up @@ -62,11 +62,13 @@ impl SecAccessControl {
ProtectionMode::AccessibleAfterFirstUnlockThisDeviceOnly => unsafe { CFString::wrap_under_get_rule(kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly) },
ProtectionMode::AccessibleAfterFirstUnlock => unsafe { CFString::wrap_under_get_rule(kSecAttrAccessibleAfterFirstUnlock) },
}
}).unwrap_or_else(|| {
unsafe { CFString::wrap_under_get_rule(kSecAttrAccessibleWhenUnlocked) }
});
unsafe {
let access_control = SecAccessControlCreateWithFlags(
kCFAllocatorDefault,
protection_val.map(|v| v.as_CFTypeRef()).unwrap_or(null()),
protection_val.as_CFTypeRef(),
flags,
ptr::null_mut(),
);
Expand Down
Loading