Skip to content

Commit

Permalink
use updated csdk init apis. be more careful with optionals
Browse files Browse the repository at this point in the history
  • Loading branch information
scareything committed Oct 3, 2023
1 parent eb1c3e8 commit 47c0bed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion deps/ziti-tunnel-sdk-c
13 changes: 8 additions & 5 deletions lib/Ziti.swift
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,11 @@ import CZitiPrivate
let privKeyPEMPtr = UnsafeMutablePointer<Int8>.allocate(capacity: privKeyPEM.count + 1)
privKeyPEMPtr.initialize(from: privKeyPEM, count: privKeyPEM.count + 1)

let caPEMPtr = UnsafeMutablePointer<Int8>.allocate(capacity: id.ca!.count + 1)
caPEMPtr.initialize(from: id.ca!, count: id.ca!.count + 1)
var caPEMPtr:UnsafeMutablePointer<Int8>? = nil
if (id.ca != nil) {
caPEMPtr = UnsafeMutablePointer<Int8>.allocate(capacity: id.ca!.count + 1)
caPEMPtr!.initialize(from: id.ca!, count: id.ca!.count + 1)
}

// set up the ziti_config with our cert, etc.
var zitiCfg = ziti_config(
Expand All @@ -446,11 +449,11 @@ import CZitiPrivate
ctrlPtr.deallocate()
certPEMPtr.deallocate()
privKeyPEMPtr.deallocate()
caPEMPtr.deallocate()
if (caPEMPtr != nil) {
caPEMPtr!.deallocate()
}

zitiOpts = ziti_options(config: nil,
controller: nil,
tls: nil,
disabled: id.startDisabled ?? false,
config_types: ziti_all_configs,
api_page_size: 25,
Expand Down

0 comments on commit 47c0bed

Please sign in to comment.