summaryrefslogtreecommitdiff
path: root/rust/src/enterprise.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-05-03 23:15:17 -0400
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-05-12 17:45:24 -0400
commit6264254065bbae9d89f51cf3330379b7ace09592 (patch)
tree9ece1d1739215c2faef2d808ef4fdc019ad527fa /rust/src/enterprise.rs
parentc3fdda9727f5507818e3f55576ad32215a22b0f9 (diff)
[Rust] Return `String` instead of `BnString` for cases where lossy conversion can be tolerated
Still need to go and audit all usage, but realistically the most important places to give the user control are with symbols, where the data can come from non utf8 sources This is still incomplete, I just looked for usage of -> BnString so any other variant was omitted.
Diffstat (limited to 'rust/src/enterprise.rs')
-rw-r--r--rust/src/enterprise.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/rust/src/enterprise.rs b/rust/src/enterprise.rs
index 7030b194..9b97a387 100644
--- a/rust/src/enterprise.rs
+++ b/rust/src/enterprise.rs
@@ -98,13 +98,13 @@ pub fn release_license() {
}
// TODO: If "" string return None
-pub fn server_username() -> BnString {
- unsafe { BnString::from_raw(binaryninjacore_sys::BNGetEnterpriseServerUsername()) }
+pub fn server_username() -> String {
+ unsafe { BnString::into_string(binaryninjacore_sys::BNGetEnterpriseServerUsername()) }
}
// TODO: If "" string return None
-pub fn server_url() -> BnString {
- unsafe { BnString::from_raw(binaryninjacore_sys::BNGetEnterpriseServerUrl()) }
+pub fn server_url() -> String {
+ unsafe { BnString::into_string(binaryninjacore_sys::BNGetEnterpriseServerUrl()) }
}
pub fn set_server_url<S: BnStrCompatible>(url: S) -> Result<(), ()> {
@@ -121,24 +121,24 @@ pub fn set_server_url<S: BnStrCompatible>(url: S) -> Result<(), ()> {
}
}
-pub fn server_name() -> BnString {
- unsafe { BnString::from_raw(binaryninjacore_sys::BNGetEnterpriseServerName()) }
+pub fn server_name() -> String {
+ unsafe { BnString::into_string(binaryninjacore_sys::BNGetEnterpriseServerName()) }
}
-pub fn server_id() -> BnString {
- unsafe { BnString::from_raw(binaryninjacore_sys::BNGetEnterpriseServerId()) }
+pub fn server_id() -> String {
+ unsafe { BnString::into_string(binaryninjacore_sys::BNGetEnterpriseServerId()) }
}
pub fn server_version() -> u64 {
unsafe { binaryninjacore_sys::BNGetEnterpriseServerVersion() }
}
-pub fn server_build_id() -> BnString {
- unsafe { BnString::from_raw(binaryninjacore_sys::BNGetEnterpriseServerBuildId()) }
+pub fn server_build_id() -> String {
+ unsafe { BnString::into_string(binaryninjacore_sys::BNGetEnterpriseServerBuildId()) }
}
-pub fn server_token() -> BnString {
- unsafe { BnString::from_raw(binaryninjacore_sys::BNGetEnterpriseServerToken()) }
+pub fn server_token() -> String {
+ unsafe { BnString::into_string(binaryninjacore_sys::BNGetEnterpriseServerToken()) }
}
pub fn license_duration() -> Duration {
@@ -226,8 +226,8 @@ pub fn initialize_server() -> bool {
unsafe { binaryninjacore_sys::BNInitializeEnterpriseServer() }
}
-pub fn server_last_error() -> BnString {
- unsafe { BnString::from_raw(binaryninjacore_sys::BNGetEnterpriseServerLastError()) }
+pub fn server_last_error() -> String {
+ unsafe { BnString::into_string(binaryninjacore_sys::BNGetEnterpriseServerLastError()) }
}
pub fn server_authentication_methods() -> (Array<BnString>, Array<BnString>) {