From 17239a1ebdd44a2090bf71575db6e36bcdbd9f75 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Tue, 25 Feb 2025 18:23:26 -0500 Subject: Check for enterprise keychain environment variable in Rust `headless::license_location` We also likely need to check the _actual_ keychain (not the environment variable) later. --- rust/src/headless.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'rust/src') diff --git a/rust/src/headless.rs b/rust/src/headless.rs index f992c27e..9b9f68fc 100644 --- a/rust/src/headless.rs +++ b/rust/src/headless.rs @@ -255,6 +255,8 @@ pub enum LicenseLocation { EnvironmentVariable, /// The license used when initializing will be the file in the Binary Ninja user directory. File, + /// The license is retrieved using keychain credentials for `BN_ENTERPRISE_USERNAME`. + Keychain } /// Attempts to identify the license location type, this follows the same order as core initialization. @@ -269,7 +271,11 @@ pub fn license_location() -> Option { if license_path().exists() { Some(LicenseLocation::File) } else { - None + // Check to see if we might be authorizing with keychain credentials. + match std::env::var("BN_ENTERPRISE_USERNAME") { + Ok(_) => Some(LicenseLocation::Keychain), + Err(_) => None, + } } } } -- cgit v1.3.1