summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2010-01-21 11:54:02 +0100
committerGravatar Martin Szulecki2010-01-21 11:54:02 +0100
commitf725355489c4a203012ba74a58483945772e6578 (patch)
treebcfbfe4704fdbe07f54c54b6347a978eac0bc25f
parentc9e2217059f561f87cf8b6af5067505f827c7297 (diff)
downloadlibimobiledevice-f725355489c4a203012ba74a58483945772e6578.tar.gz
libimobiledevice-f725355489c4a203012ba74a58483945772e6578.tar.bz2
Add LOCKDOWN_E_INVALID_SERVICE error and functionality
This error is returned if the service does not exist on the device. It comes handy to detect if for instance the AFC2 service is actually setup on a device or not.
-rw-r--r--include/libiphone/lockdown.h1
-rw-r--r--src/lockdown.c13
2 files changed, 12 insertions, 2 deletions
diff --git a/include/libiphone/lockdown.h b/include/libiphone/lockdown.h
index 7fa5384..e80851b 100644
--- a/include/libiphone/lockdown.h
+++ b/include/libiphone/lockdown.h
@@ -48,6 +48,7 @@ extern "C" {
#define LOCKDOWN_E_PASSWORD_PROTECTED -14
#define LOCKDOWN_E_NO_RUNNING_SESSION -15
#define LOCKDOWN_E_INVALID_HOST_ID -16
+#define LOCKDOWN_E_INVALID_SERVICE -17
#define LOCKDOWN_E_UNKNOWN_ERROR -256
diff --git a/src/lockdown.c b/src/lockdown.c
index 1befb72..8f15b3f 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -1262,9 +1262,18 @@ lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, const char
if (port && ret == LOCKDOWN_E_SUCCESS)
*port = port_loc;
}
- }
- else
+ } else {
ret = LOCKDOWN_E_START_SERVICE_FAILED;
+ plist_t error_node = plist_dict_get_item(dict, "Error");
+ if (error_node && PLIST_STRING == plist_get_node_type(error_node)) {
+ char *error = NULL;
+ plist_get_string_val(error_node, &error);
+ if (!strcmp(error, "InvalidService")) {
+ ret = LOCKDOWN_E_INVALID_SERVICE;
+ }
+ free(error);
+ }
+ }
plist_free(dict);
dict = NULL;