Skip to content

Commit

Permalink
Use dlopen2
Browse files Browse the repository at this point in the history
  • Loading branch information
littledivy committed Nov 5, 2023
1 parent a637d53 commit 3c296d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ rustls-native-certs = "0.6.2"

[target.'cfg(target_os = "macos")'.dependencies]
once_cell = "1.17.1"
dlopen = "0.1.8"
dlopen_derive = "0.1.4"
dlopen2 = "0.6.1"
dlopen2_derive = "0.4.0"
rustls-pemfile = "1.0.2"

[target.'cfg(target_os = "macos")'.dev-dependencies]
Expand Down
13 changes: 6 additions & 7 deletions src/macos.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#![allow(non_upper_case_globals)]

use crate::Certificate;
use dlopen::symbor::{Container, Ref, SymBorApi, Symbol};
use dlopen::Error as DlopenError;
use dlopen2::symbor::{Container, Ref, SymBorApi, Symbol};
use dlopen2::Error as DlopenError;
use once_cell::unsync::OnceCell;
use std::collections::HashMap;
use std::ffi::c_char;
use std::ffi::c_void;
use std::io::{Error, ErrorKind};
use std::ptr;
Expand Down Expand Up @@ -126,11 +127,9 @@ const kSecTrustSettingsDomainSystem: SecTrustSettingsDomain = 2;

type SecTrustSettingsResult = u32;

const kSecTrustSettingsResultInvalid: SecTrustSettingsResult = 0;
const kSecTrustSettingsResultTrustRoot: SecTrustSettingsResult = 1;
const kSecTrustSettingsResultTrustAsRoot: SecTrustSettingsResult = 2;
const kSecTrustSettingsResultDeny: SecTrustSettingsResult = 3;
const kSecTrustSettingsResultUnspecified: SecTrustSettingsResult = 4;

const errSecNoTrustSettings: OSStatus = -25263;
const errSecSuccess: OSStatus = 0;
Expand All @@ -139,7 +138,7 @@ enum OpaqueSecCertificateRef {}
type SecCertificateRef = *mut OpaqueSecCertificateRef;

#[allow(non_snake_case)]
#[derive(dlopen_derive::SymBorApi)]
#[derive(dlopen2_derive::SymBorApi)]
struct TrustSettings<'a> {
// TrustSettings
SecTrustSettingsCopyCertificates: Symbol<
Expand All @@ -163,7 +162,7 @@ type CFStringEncoding = u32;
static kCFStringEncodingUTF8: CFStringEncoding = 0x08000100;

#[allow(non_snake_case)]
#[derive(dlopen_derive::SymBorApi)]
#[derive(dlopen2_derive::SymBorApi)]
struct CoreFoundation<'a> {
// CFArray
CFArrayGetValueAtIndex:
Expand Down

0 comments on commit 3c296d6

Please sign in to comment.