-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ragnar Rova
committed
Mar 20, 2022
1 parent
fe43487
commit 5cb7d23
Showing
16 changed files
with
101 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import Foundation | ||
|
||
func noteExit(pid: pid_t, withReply reply: @escaping (Bool) -> Void) { | ||
let procKqueue = kqueue() | ||
if procKqueue == -1 { | ||
logger.log("Error creating kqueue") | ||
} | ||
|
||
var changes = kevent( | ||
ident: UInt(pid), | ||
filter: Int16(EVFILT_PROC), | ||
flags: UInt16(EV_ADD | EV_RECEIPT), | ||
fflags: NOTE_EXIT, | ||
data: 0, | ||
udata: nil | ||
) | ||
kevent(procKqueue, &changes, 1, nil, 0, nil) | ||
|
||
|
||
DispatchQueue.global(qos: .default).async { | ||
while true { | ||
var event = kevent() | ||
let status = kevent(procKqueue, nil, 0, &event, 1, nil) | ||
if status == 0 { | ||
logger.log("Timeout") | ||
} else if status > 0 { | ||
logger.log("OpenConnect exited") | ||
reply(false) | ||
break | ||
} else { | ||
logger.log("Error reading kevent") | ||
close(procKqueue) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,8 @@ | |
<string>identifier "se.rrva.OpenConnectUI2" and anchor apple generic and certificate leaf[subject.CN] = "Apple Development: [email protected] (U34QC433V8)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string> | ||
</array> | ||
<key>CFBundleVersion</key> | ||
<string>642</string> | ||
<string>654</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>"1.642"</string> | ||
<string>"1.654"</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import Foundation | ||
|
||
func findOpenConnectPid() -> pid_t { | ||
let fileContent = try? String(contentsOf: URL(fileURLWithPath: "/var/run/openconnect.pid")) | ||
if let content = fileContent { | ||
let pid = pid_t(content.trimmingCharacters(in: .whitespacesAndNewlines)) ?? 0 | ||
return pid | ||
} | ||
return 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters