summaryrefslogtreecommitdiffstats
path: root/src/installation_proxy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/installation_proxy.c')
-rw-r--r--src/installation_proxy.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/src/installation_proxy.c b/src/installation_proxy.c
index e4484ad..76eb0ba 100644
--- a/src/installation_proxy.c
+++ b/src/installation_proxy.c
@@ -605,25 +605,39 @@ static void instproxy_copy_lookup_result_cb(plist_t command, plist_t status, voi
605 } 605 }
606} 606}
607 607
608LIBIMOBILEDEVICE_API instproxy_error_t instproxy_lookup(instproxy_client_t client, plist_t appids, plist_t client_options, plist_t *result) 608LIBIMOBILEDEVICE_API instproxy_error_t instproxy_lookup(instproxy_client_t client, const char** appids, plist_t client_options, plist_t *result)
609{ 609{
610 if (!client || !client->parent || !result)
611 return INSTPROXY_E_INVALID_ARG;
612
613 if (appids && (plist_get_node_type(appids) != PLIST_ARRAY && plist_get_node_type(appids) != PLIST_STRING))
614 return INSTPROXY_E_INVALID_ARG;
615
616 instproxy_error_t res = INSTPROXY_E_UNKNOWN_ERROR; 610 instproxy_error_t res = INSTPROXY_E_UNKNOWN_ERROR;
617 611 int i = 0;
618 plist_t lookup_result = NULL; 612 plist_t lookup_result = NULL;
613 plist_t command = NULL;
614 plist_t appid_array = NULL;
615 plist_t node = NULL;
619 616
620 plist_t command = plist_new_dict(); 617 if (!client || !client->parent || !result)
618 return INSTPROXY_E_INVALID_ARG;
619
620 command = plist_new_dict();
621 plist_dict_set_item(command, "Command", plist_new_string("Lookup")); 621 plist_dict_set_item(command, "Command", plist_new_string("Lookup"));
622 if (client_options) {
623 node = plist_copy(client_options);
624 } else if (appids) {
625 node = plist_new_dict();
626 }
627
628 /* add bundle identifiers to client options */
622 if (appids) { 629 if (appids) {
623 plist_dict_set_item(client_options, "BundleIDs", plist_copy(appids)); 630 appid_array = plist_new_array();
631 while (appids[i]) {
632 plist_array_append_item(appid_array, plist_new_string(appids[i]));
633 i++;
634 }
635 plist_dict_set_item(node, "BundleIDs", appid_array);
636 }
637
638 if (node) {
639 plist_dict_set_item(command, "ClientOptions", node);
624 } 640 }
625 if (client_options)
626 plist_dict_set_item(command, "ClientOptions", plist_copy(client_options));
627 641
628 res = instproxy_perform_command(client, command, INSTPROXY_COMMAND_TYPE_SYNC, instproxy_copy_lookup_result_cb, (void*)&lookup_result); 642 res = instproxy_perform_command(client, command, INSTPROXY_COMMAND_TYPE_SYNC, instproxy_copy_lookup_result_cb, (void*)&lookup_result);
629 643
@@ -973,12 +987,11 @@ LIBIMOBILEDEVICE_API instproxy_error_t instproxy_client_get_path_for_bundle_iden
973 instproxy_client_options_set_return_attributes(client_opts, "CFBundleIdentifier", "CFBundleExecutable", "Path", NULL); 987 instproxy_client_options_set_return_attributes(client_opts, "CFBundleIdentifier", "CFBundleExecutable", "Path", NULL);
974 988
975 // only query for specific appid 989 // only query for specific appid
976 plist_t appid_node = plist_new_string(appid); 990 const char* appids[] = {appid, NULL};
977 991
978 // query device for list of apps 992 // query device for list of apps
979 instproxy_error_t ierr = instproxy_lookup(client, appid_node, client_opts, &apps); 993 instproxy_error_t ierr = instproxy_lookup(client, appids, client_opts, &apps);
980 994
981 plist_free(appid_node);
982 instproxy_client_options_free(client_opts); 995 instproxy_client_options_free(client_opts);
983 996
984 if (ierr != INSTPROXY_E_SUCCESS) { 997 if (ierr != INSTPROXY_E_SUCCESS) {