From b9aa67c7ccf202388b9abca5e9106534aaff0036 Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 10 Jan 2022 23:54:38 -0500 Subject: [PATCH] add ability to retrieve PList of device --- .gitignore | 1 + lockdown/lockdown.go | 19 +++---------------- plist/plist.go | 2 -- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index f1c181e..b3f9505 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ # Output of the go coverage tool, specifically when used with LiteIDE *.out +.devcontainer/ diff --git a/lockdown/lockdown.go b/lockdown/lockdown.go index 1061c92..0ce0c5e 100644 --- a/lockdown/lockdown.go +++ b/lockdown/lockdown.go @@ -17,7 +17,7 @@ type Client interface { Pair() error ValidatePair() error DeviceName() (string, error) - GetPList(string, string) (plist.PList, error) + PList() (plist.PList, error) Close() error } @@ -81,22 +81,9 @@ func (s *client) DeviceName() (string, error) { return result, err } -func (s *client) GetPList(domain, key string) (plist.PList, error) { +func (s *client) PList() (plist.PList, error) { var node C.plist_t - - domainC := C.CString(domain) - keyC := C.CString(key) - defer C.free(unsafe.Pointer(domainC)) - defer C.free(unsafe.Pointer(keyC)) - - if domain == "" { - domainC = nil - } - if key == "" { - keyC = nil - } - - err := resultToError(C.lockdownd_get_value(s.p, domainC, keyC, &node)) + err := resultToError(C.lockdownd_get_value(s.p, nil, nil, &node)) if err != nil { return nil, err } diff --git a/plist/plist.go b/plist/plist.go index 7b2332f..099339a 100644 --- a/plist/plist.go +++ b/plist/plist.go @@ -4,9 +4,7 @@ package plist // #include // #include import "C" - import ( - "C" "unsafe" )