diff options
| author | 2013-09-24 02:14:54 +0200 | |
|---|---|---|
| committer | 2013-09-24 02:14:54 +0200 | |
| commit | 959a2a203577b5505468fbaa10e6cd54f497213b (patch) | |
| tree | b6299299a88e9df925d9f1072a4fe4f94f4467f3 | |
| parent | 5f44b67732e1fec0bc041928f49b4b0bf9ac854e (diff) | |
| download | libimobiledevice-959a2a203577b5505468fbaa10e6cd54f497213b.tar.gz libimobiledevice-959a2a203577b5505468fbaa10e6cd54f497213b.tar.bz2 | |
lockdown: improve lockdownd_query_type result checking
| -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; |
