summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2013-09-24 02:14:54 +0200
committerGravatar Nikias Bassen2013-09-24 02:14:54 +0200
commit959a2a203577b5505468fbaa10e6cd54f497213b (patch)
treeb6299299a88e9df925d9f1072a4fe4f94f4467f3 /src
parent5f44b67732e1fec0bc041928f49b4b0bf9ac854e (diff)
downloadlibimobiledevice-959a2a203577b5505468fbaa10e6cd54f497213b.tar.gz
libimobiledevice-959a2a203577b5505468fbaa10e6cd54f497213b.tar.bz2
lockdown: improve lockdownd_query_type result checking
Diffstat (limited to 'src')
-rw-r--r--src/lockdown.c15
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)
return ret;
ret = LOCKDOWN_E_UNKNOWN_ERROR;
- if (lockdown_check_result(dict, "QueryType") == RESULT_SUCCESS) {
+ plist_t type_node = plist_dict_get_item(dict, "Type");
+ if (type_node && (plist_get_node_type(type_node) == PLIST_STRING)) {
+ char* typestr = NULL;
+ plist_get_string_val(type_node, &typestr);
+ debug_info("success with type %s", typestr);
/* return the type if requested */
if (type != NULL) {
- plist_t type_node = plist_dict_get_item(dict, "Type");
- plist_get_string_val(type_node, type);
+ *type = typestr;
+ } else {
+ free(typestr);
}
- debug_info("success with type %s", *type);
ret = LOCKDOWN_E_SUCCESS;
+ } else {
+ debug_info("hmm. QueryType response does not contain a type?!\n");
+ debug_plist(dict);
}
plist_free(dict);
dict = NULL;