diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lockdown.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/lockdown.c b/src/lockdown.c index f616d25..a8f5307 100644 --- a/src/lockdown.c +++ b/src/lockdown.c | |||
| @@ -376,14 +376,21 @@ lockdownd_error_t lockdownd_query_type(lockdownd_client_t client, char **type) | |||
| 376 | return ret; | 376 | return ret; |
| 377 | 377 | ||
| 378 | ret = LOCKDOWN_E_UNKNOWN_ERROR; | 378 | ret = LOCKDOWN_E_UNKNOWN_ERROR; |
| 379 | if (lockdown_check_result(dict, "QueryType") == RESULT_SUCCESS) { | 379 | plist_t type_node = plist_dict_get_item(dict, "Type"); |
| 380 | if (type_node && (plist_get_node_type(type_node) == PLIST_STRING)) { | ||
| 381 | char* typestr = NULL; | ||
| 382 | plist_get_string_val(type_node, &typestr); | ||
| 383 | debug_info("success with type %s", typestr); | ||
| 380 | /* return the type if requested */ | 384 | /* return the type if requested */ |
| 381 | if (type != NULL) { | 385 | if (type != NULL) { |
| 382 | plist_t type_node = plist_dict_get_item(dict, "Type"); | 386 | *type = typestr; |
| 383 | plist_get_string_val(type_node, type); | 387 | } else { |
| 388 | free(typestr); | ||
| 384 | } | 389 | } |
| 385 | debug_info("success with type %s", *type); | ||
| 386 | ret = LOCKDOWN_E_SUCCESS; | 390 | ret = LOCKDOWN_E_SUCCESS; |
| 391 | } else { | ||
| 392 | debug_info("hmm. QueryType response does not contain a type?!\n"); | ||
| 393 | debug_plist(dict); | ||
| 387 | } | 394 | } |
| 388 | plist_free(dict); | 395 | plist_free(dict); |
| 389 | dict = NULL; | 396 | dict = NULL; |
