diff options
| -rw-r--r-- | cython/lockdown.pxi | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/cython/lockdown.pxi b/cython/lockdown.pxi index 6b88f9d..25edb4c 100644 --- a/cython/lockdown.pxi +++ b/cython/lockdown.pxi | |||
| @@ -210,14 +210,23 @@ cdef class LockdownClient(PropertyListService): | |||
| 210 | raise | 210 | raise |
| 211 | 211 | ||
| 212 | cpdef set_value(self, bytes domain, bytes key, object value): | 212 | cpdef set_value(self, bytes domain, bytes key, object value): |
| 213 | cdef plist.plist_t c_node = plist.native_to_plist_t(value) | 213 | cdef: |
| 214 | plist.plist_t c_node = NULL | ||
| 215 | char* c_domain = NULL | ||
| 216 | char* c_key = NULL | ||
| 217 | |||
| 218 | c_node = plist.native_to_plist_t(value) | ||
| 219 | if domain is not None: | ||
| 220 | c_domain = domain | ||
| 221 | if key is not None: | ||
| 222 | c_key = key | ||
| 214 | try: | 223 | try: |
| 215 | self.handle_error(lockdownd_set_value(self._c_client, domain, key, c_node)) | 224 | self.handle_error(lockdownd_set_value(self._c_client, c_domain, c_key, c_node)) |
| 216 | except BaseError, e: | 225 | except BaseError, e: |
| 217 | raise | 226 | raise |
| 218 | finally: | 227 | finally: |
| 219 | if c_node != NULL: | 228 | if c_node != NULL: |
| 220 | plist.plist_free(c_node) | 229 | c_node = NULL |
| 221 | 230 | ||
| 222 | cpdef remove_value(self, bytes domain, bytes key): | 231 | cpdef remove_value(self, bytes domain, bytes key): |
| 223 | self.handle_error(lockdownd_remove_value(self._c_client, domain, key)) | 232 | self.handle_error(lockdownd_remove_value(self._c_client, domain, key)) |
