diff options
| author | 2010-01-12 17:53:55 +0100 | |
|---|---|---|
| committer | 2010-01-12 17:53:55 +0100 | |
| commit | bf3dc421b2b5ccfe2fcd3cd4ec1ef90f39599600 (patch) | |
| tree | 9108ac43b6fbbc45eb9ea4aed3a2234590aaf501 | |
| parent | 3b57fa5d0ed2d8060233fa9604bd7f98a7d6cdab (diff) | |
| download | libimobiledevice-bf3dc421b2b5ccfe2fcd3cd4ec1ef90f39599600.tar.gz libimobiledevice-bf3dc421b2b5ccfe2fcd3cd4ec1ef90f39599600.tar.bz2 | |
Remove support for debug masks due to inconsistent use
| -rw-r--r-- | dev/afccheck.c | 2 | ||||
| -rw-r--r-- | dev/iphoneclient.c | 2 | ||||
| -rw-r--r-- | dev/iphoneenterrecovery.c | 1 | ||||
| -rw-r--r-- | dev/msyncclient.c | 2 | ||||
| -rw-r--r-- | include/libiphone/libiphone.h | 8 | ||||
| -rw-r--r-- | src/InstallationProxy.c | 36 | ||||
| -rw-r--r-- | src/MobileSync.c | 6 | ||||
| -rw-r--r-- | src/debug.c | 27 | ||||
| -rw-r--r-- | src/debug.h | 2 | ||||
| -rw-r--r-- | src/lockdown.c | 82 | ||||
| -rw-r--r-- | swig/iphone.i | 9 | ||||
| -rw-r--r-- | tools/iphone_id.c | 1 | ||||
| -rw-r--r-- | tools/iphoneinfo.c | 1 | ||||
| -rw-r--r-- | tools/iphonesyslog.c | 1 |
14 files changed, 63 insertions, 117 deletions
diff --git a/dev/afccheck.c b/dev/afccheck.c index 7a17a31..8e11b8a 100644 --- a/dev/afccheck.c +++ b/dev/afccheck.c | |||
| @@ -98,10 +98,8 @@ int main(int argc, char *argv[]) | |||
| 98 | 98 | ||
| 99 | if (argc > 1 && !strcasecmp(argv[1], "--debug")) { | 99 | if (argc > 1 && !strcasecmp(argv[1], "--debug")) { |
| 100 | iphone_set_debug_level(1); | 100 | iphone_set_debug_level(1); |
| 101 | iphone_set_debug_mask(DBGMASK_ALL); | ||
| 102 | } else { | 101 | } else { |
| 103 | iphone_set_debug_level(0); | 102 | iphone_set_debug_level(0); |
| 104 | iphone_set_debug_mask(DBGMASK_NONE); | ||
| 105 | } | 103 | } |
| 106 | 104 | ||
| 107 | if (IPHONE_E_SUCCESS != iphone_device_new(&phone, NULL)) { | 105 | if (IPHONE_E_SUCCESS != iphone_device_new(&phone, NULL)) { |
diff --git a/dev/iphoneclient.c b/dev/iphoneclient.c index dbdf0f1..eaced60 100644 --- a/dev/iphoneclient.c +++ b/dev/iphoneclient.c | |||
| @@ -68,10 +68,8 @@ int main(int argc, char *argv[]) | |||
| 68 | 68 | ||
| 69 | if (argc > 1 && !strcasecmp(argv[1], "--debug")) { | 69 | if (argc > 1 && !strcasecmp(argv[1], "--debug")) { |
| 70 | iphone_set_debug_level(1); | 70 | iphone_set_debug_level(1); |
| 71 | iphone_set_debug_mask(DBGMASK_ALL); | ||
| 72 | } else { | 71 | } else { |
| 73 | iphone_set_debug_level(0); | 72 | iphone_set_debug_level(0); |
| 74 | iphone_set_debug_mask(DBGMASK_NONE); | ||
| 75 | } | 73 | } |
| 76 | 74 | ||
| 77 | if (IPHONE_E_SUCCESS != iphone_device_new(&phone, NULL)) { | 75 | if (IPHONE_E_SUCCESS != iphone_device_new(&phone, NULL)) { |
diff --git a/dev/iphoneenterrecovery.c b/dev/iphoneenterrecovery.c index cab41f8..153df15 100644 --- a/dev/iphoneenterrecovery.c +++ b/dev/iphoneenterrecovery.c | |||
| @@ -51,7 +51,6 @@ int main(int argc, char *argv[]) | |||
| 51 | /* parse cmdline args */ | 51 | /* parse cmdline args */ |
| 52 | for (i = 1; i < argc; i++) { | 52 | for (i = 1; i < argc; i++) { |
| 53 | if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { | 53 | if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { |
| 54 | iphone_set_debug_mask(DBGMASK_ALL); | ||
| 55 | iphone_set_debug_level(1); | 54 | iphone_set_debug_level(1); |
| 56 | continue; | 55 | continue; |
| 57 | } | 56 | } |
diff --git a/dev/msyncclient.c b/dev/msyncclient.c index 6e40390..6134649 100644 --- a/dev/msyncclient.c +++ b/dev/msyncclient.c | |||
| @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) | |||
| 146 | iphone_device_t phone = NULL; | 146 | iphone_device_t phone = NULL; |
| 147 | 147 | ||
| 148 | if (argc > 1 && !strcasecmp(argv[1], "--debug")) | 148 | if (argc > 1 && !strcasecmp(argv[1], "--debug")) |
| 149 | iphone_set_debug_mask(DBGMASK_MOBILESYNC); | 149 | iphone_set_debug_level(1); |
| 150 | 150 | ||
| 151 | if (IPHONE_E_SUCCESS != iphone_device_new(&phone, NULL)) { | 151 | if (IPHONE_E_SUCCESS != iphone_device_new(&phone, NULL)) { |
| 152 | printf("No iPhone found, is it plugged in?\n"); | 152 | printf("No iPhone found, is it plugged in?\n"); |
diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index eb58d5c..70e0068 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h | |||
| @@ -49,15 +49,7 @@ typedef struct iphone_device_int *iphone_device_t; | |||
| 49 | struct iphone_connection_int; | 49 | struct iphone_connection_int; |
| 50 | typedef struct iphone_connection_int *iphone_connection_t; | 50 | typedef struct iphone_connection_int *iphone_connection_t; |
| 51 | 51 | ||
| 52 | /* Debugging */ | ||
| 53 | #define DBGMASK_ALL 0xFFFF | ||
| 54 | #define DBGMASK_NONE 0x0000 | ||
| 55 | #define DBGMASK_LOCKDOWND (1 << 1) | ||
| 56 | #define DBGMASK_MOBILESYNC (1 << 2) | ||
| 57 | #define DBGMASK_INSTPROXY (1 << 3) | ||
| 58 | |||
| 59 | /* generic */ | 52 | /* generic */ |
| 60 | void iphone_set_debug_mask(uint16_t mask); | ||
| 61 | void iphone_set_debug_level(int level); | 53 | void iphone_set_debug_level(int level); |
| 62 | 54 | ||
| 63 | /* discovery (events/asynchronous) */ | 55 | /* discovery (events/asynchronous) */ |
diff --git a/src/InstallationProxy.c b/src/InstallationProxy.c index 8d994c6..6b267c4 100644 --- a/src/InstallationProxy.c +++ b/src/InstallationProxy.c | |||
| @@ -131,7 +131,7 @@ instproxy_error_t instproxy_client_free(instproxy_client_t client) | |||
| 131 | property_list_service_client_free(client->parent); | 131 | property_list_service_client_free(client->parent); |
| 132 | client->parent = NULL; | 132 | client->parent = NULL; |
| 133 | if (client->status_updater) { | 133 | if (client->status_updater) { |
| 134 | log_dbg_msg(DBGMASK_INSTPROXY, "joining status_updater"); | 134 | log_debug_msg("joining status_updater"); |
| 135 | g_thread_join(client->status_updater); | 135 | g_thread_join(client->status_updater); |
| 136 | } | 136 | } |
| 137 | if (client->mutex) { | 137 | if (client->mutex) { |
| @@ -174,7 +174,7 @@ instproxy_error_t instproxy_browse(instproxy_client_t client, instproxy_apptype_ | |||
| 174 | p_apptype = plist_new_string("User"); | 174 | p_apptype = plist_new_string("User"); |
| 175 | break; | 175 | break; |
| 176 | default: | 176 | default: |
| 177 | log_dbg_msg(DBGMASK_INSTPROXY, "%s: unknown apptype %d given, using INSTPROXY_APPTYPE_USER instead\n", __func__, apptype); | 177 | log_debug_msg("%s: unknown apptype %d given, using INSTPROXY_APPTYPE_USER instead\n", __func__, apptype); |
| 178 | p_apptype = plist_new_string("User"); | 178 | p_apptype = plist_new_string("User"); |
| 179 | break; | 179 | break; |
| 180 | } | 180 | } |
| @@ -187,7 +187,7 @@ instproxy_error_t instproxy_browse(instproxy_client_t client, instproxy_apptype_ | |||
| 187 | res = instproxy_error(property_list_service_send_xml_plist(client->parent, dict)); | 187 | res = instproxy_error(property_list_service_send_xml_plist(client->parent, dict)); |
| 188 | plist_free(dict); | 188 | plist_free(dict); |
| 189 | if (res != INSTPROXY_E_SUCCESS) { | 189 | if (res != INSTPROXY_E_SUCCESS) { |
| 190 | log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not send plist\n", __func__); | 190 | log_debug_msg("%s: could not send plist\n", __func__); |
| 191 | goto leave_unlock; | 191 | goto leave_unlock; |
| 192 | } | 192 | } |
| 193 | 193 | ||
| @@ -223,7 +223,7 @@ instproxy_error_t instproxy_browse(instproxy_client_t client, instproxy_apptype_ | |||
| 223 | if (!strcmp(status, "BrowsingApplications")) { | 223 | if (!strcmp(status, "BrowsingApplications")) { |
| 224 | browsing = 1; | 224 | browsing = 1; |
| 225 | } else if (!strcmp(status, "Complete")) { | 225 | } else if (!strcmp(status, "Complete")) { |
| 226 | log_dbg_msg(DBGMASK_INSTPROXY, "%s: Browsing applications completed\n"); | 226 | log_debug_msg("%s: Browsing applications completed\n"); |
| 227 | res = INSTPROXY_E_SUCCESS; | 227 | res = INSTPROXY_E_SUCCESS; |
| 228 | } | 228 | } |
| 229 | free(status); | 229 | free(status); |
| @@ -264,7 +264,7 @@ static instproxy_error_t instproxy_perform_operation(instproxy_client_t client, | |||
| 264 | res = instproxy_error(property_list_service_receive_plist_with_timeout(client->parent, &dict, 30000)); | 264 | res = instproxy_error(property_list_service_receive_plist_with_timeout(client->parent, &dict, 30000)); |
| 265 | instproxy_unlock(client); | 265 | instproxy_unlock(client); |
| 266 | if (res != INSTPROXY_E_SUCCESS) { | 266 | if (res != INSTPROXY_E_SUCCESS) { |
| 267 | log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not receive plist, error %d\n", __func__, res); | 267 | log_debug_msg("%s: could not receive plist, error %d\n", __func__, res); |
| 268 | break; | 268 | break; |
| 269 | } | 269 | } |
| 270 | if (dict) { | 270 | if (dict) { |
| @@ -279,7 +279,7 @@ static instproxy_error_t instproxy_perform_operation(instproxy_client_t client, | |||
| 279 | char *err_msg = NULL; | 279 | char *err_msg = NULL; |
| 280 | plist_get_string_val(err, &err_msg); | 280 | plist_get_string_val(err, &err_msg); |
| 281 | if (err_msg) { | 281 | if (err_msg) { |
| 282 | log_dbg_msg(DBGMASK_INSTPROXY, "%s(%s): ERROR: %s\n", __func__, operation, err_msg); | 282 | log_debug_msg("%s(%s): ERROR: %s\n", __func__, operation, err_msg); |
| 283 | free(err_msg); | 283 | free(err_msg); |
| 284 | } | 284 | } |
| 285 | #endif | 285 | #endif |
| @@ -303,9 +303,9 @@ static instproxy_error_t instproxy_perform_operation(instproxy_client_t client, | |||
| 303 | int percent; | 303 | int percent; |
| 304 | plist_get_uint_val(npercent, &val); | 304 | plist_get_uint_val(npercent, &val); |
| 305 | percent = val; | 305 | percent = val; |
| 306 | log_dbg_msg(DBGMASK_INSTPROXY, "%s(%s): %s (%d%%)\n", __func__, operation, status_msg, percent); | 306 | log_debug_msg("%s(%s): %s (%d%%)\n", __func__, operation, status_msg, percent); |
| 307 | } else { | 307 | } else { |
| 308 | log_dbg_msg(DBGMASK_INSTPROXY, "%s(%s): %s\n", __func__, operation, status_msg); | 308 | log_debug_msg("%s(%s): %s\n", __func__, operation, status_msg); |
| 309 | } | 309 | } |
| 310 | #endif | 310 | #endif |
| 311 | free(status_msg); | 311 | free(status_msg); |
| @@ -338,7 +338,7 @@ static gpointer instproxy_status_updater(gpointer arg) | |||
| 338 | 338 | ||
| 339 | /* cleanup */ | 339 | /* cleanup */ |
| 340 | instproxy_lock(data->client); | 340 | instproxy_lock(data->client); |
| 341 | log_dbg_msg(DBGMASK_INSTPROXY, "%s: done, cleaning up.\n", __func__); | 341 | log_debug_msg("%s: done, cleaning up.\n", __func__); |
| 342 | if (data->operation) { | 342 | if (data->operation) { |
| 343 | free(data->operation); | 343 | free(data->operation); |
| 344 | } | 344 | } |
| @@ -408,11 +408,11 @@ static instproxy_error_t instproxy_install_or_upgrade(instproxy_client_t client, | |||
| 408 | return INSTPROXY_E_INVALID_ARG; | 408 | return INSTPROXY_E_INVALID_ARG; |
| 409 | } | 409 | } |
| 410 | if (sinf && (plist_get_node_type(sinf) != PLIST_DATA)) { | 410 | if (sinf && (plist_get_node_type(sinf) != PLIST_DATA)) { |
| 411 | log_dbg_msg(DBGMASK_INSTPROXY, "%s(%s): ERROR: sinf data is not a PLIST_DATA node!\n", __func__, command); | 411 | log_debug_msg("%s(%s): ERROR: sinf data is not a PLIST_DATA node!\n", __func__, command); |
| 412 | return INSTPROXY_E_INVALID_ARG; | 412 | return INSTPROXY_E_INVALID_ARG; |
| 413 | } | 413 | } |
| 414 | if (metadata && (plist_get_node_type(metadata) != PLIST_DATA)) { | 414 | if (metadata && (plist_get_node_type(metadata) != PLIST_DATA)) { |
| 415 | log_dbg_msg(DBGMASK_INSTPROXY, "%s(%s): ERROR: metadata is not a PLIST_DATA node!\n", __func__, command); | 415 | log_debug_msg("%s(%s): ERROR: metadata is not a PLIST_DATA node!\n", __func__, command); |
| 416 | return INSTPROXY_E_INVALID_ARG; | 416 | return INSTPROXY_E_INVALID_ARG; |
| 417 | } | 417 | } |
| 418 | 418 | ||
| @@ -439,7 +439,7 @@ static instproxy_error_t instproxy_install_or_upgrade(instproxy_client_t client, | |||
| 439 | plist_free(dict); | 439 | plist_free(dict); |
| 440 | 440 | ||
| 441 | if (res != INSTPROXY_E_SUCCESS) { | 441 | if (res != INSTPROXY_E_SUCCESS) { |
| 442 | log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not send plist, error %d\n", __func__, res); | 442 | log_debug_msg("%s: could not send plist, error %d\n", __func__, res); |
| 443 | return res; | 443 | return res; |
| 444 | } | 444 | } |
| 445 | 445 | ||
| @@ -532,7 +532,7 @@ instproxy_error_t instproxy_uninstall(instproxy_client_t client, const char *app | |||
| 532 | plist_free(dict); | 532 | plist_free(dict); |
| 533 | 533 | ||
| 534 | if (res != INSTPROXY_E_SUCCESS) { | 534 | if (res != INSTPROXY_E_SUCCESS) { |
| 535 | log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not send plist, error %d\n", __func__, res); | 535 | log_debug_msg("%s: could not send plist, error %d\n", __func__, res); |
| 536 | return res; | 536 | return res; |
| 537 | } | 537 | } |
| 538 | 538 | ||
| @@ -567,13 +567,13 @@ instproxy_error_t instproxy_lookup_archives(instproxy_client_t client, plist_t * | |||
| 567 | plist_free(dict); | 567 | plist_free(dict); |
| 568 | 568 | ||
| 569 | if (res != INSTPROXY_E_SUCCESS) { | 569 | if (res != INSTPROXY_E_SUCCESS) { |
| 570 | log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not send plist, error %d\n", __func__, res); | 570 | log_debug_msg("%s: could not send plist, error %d\n", __func__, res); |
| 571 | goto leave_unlock; | 571 | goto leave_unlock; |
| 572 | } | 572 | } |
| 573 | 573 | ||
| 574 | res = instproxy_error(property_list_service_receive_plist(client->parent, result)); | 574 | res = instproxy_error(property_list_service_receive_plist(client->parent, result)); |
| 575 | if (res != INSTPROXY_E_SUCCESS) { | 575 | if (res != INSTPROXY_E_SUCCESS) { |
| 576 | log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not receive plist, error %d\n", __func__, res); | 576 | log_debug_msg("%s: could not receive plist, error %d\n", __func__, res); |
| 577 | goto leave_unlock; | 577 | goto leave_unlock; |
| 578 | } | 578 | } |
| 579 | 579 | ||
| @@ -640,7 +640,7 @@ instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid | |||
| 640 | plist_free(dict); | 640 | plist_free(dict); |
| 641 | 641 | ||
| 642 | if (res != INSTPROXY_E_SUCCESS) { | 642 | if (res != INSTPROXY_E_SUCCESS) { |
| 643 | log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not send plist, error %d\n", __func__, res); | 643 | log_debug_msg("%s: could not send plist, error %d\n", __func__, res); |
| 644 | return res; | 644 | return res; |
| 645 | } | 645 | } |
| 646 | return instproxy_create_status_updater(client, status_cb, "Archive"); | 646 | return instproxy_create_status_updater(client, status_cb, "Archive"); |
| @@ -686,7 +686,7 @@ instproxy_error_t instproxy_restore(instproxy_client_t client, const char *appid | |||
| 686 | plist_free(dict); | 686 | plist_free(dict); |
| 687 | 687 | ||
| 688 | if (res != INSTPROXY_E_SUCCESS) { | 688 | if (res != INSTPROXY_E_SUCCESS) { |
| 689 | log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not send plist, error %d\n", __func__, res); | 689 | log_debug_msg("%s: could not send plist, error %d\n", __func__, res); |
| 690 | return res; | 690 | return res; |
| 691 | } | 691 | } |
| 692 | return instproxy_create_status_updater(client, status_cb, "Restore"); | 692 | return instproxy_create_status_updater(client, status_cb, "Restore"); |
| @@ -732,7 +732,7 @@ instproxy_error_t instproxy_remove_archive(instproxy_client_t client, const char | |||
| 732 | plist_free(dict); | 732 | plist_free(dict); |
| 733 | 733 | ||
| 734 | if (res != INSTPROXY_E_SUCCESS) { | 734 | if (res != INSTPROXY_E_SUCCESS) { |
| 735 | log_dbg_msg(DBGMASK_INSTPROXY, "%s: could not send plist, error %d\n", __func__, res); | 735 | log_debug_msg("%s: could not send plist, error %d\n", __func__, res); |
| 736 | return res; | 736 | return res; |
| 737 | } | 737 | } |
| 738 | return instproxy_create_status_updater(client, status_cb, "RemoveArchive"); | 738 | return instproxy_create_status_updater(client, status_cb, "RemoveArchive"); |
diff --git a/src/MobileSync.c b/src/MobileSync.c index e904fcc..ef3571a 100644 --- a/src/MobileSync.c +++ b/src/MobileSync.c | |||
| @@ -77,7 +77,7 @@ mobilesync_error_t mobilesync_client_new(iphone_device_t device, int dst_port, | |||
| 77 | /* perform handshake */ | 77 | /* perform handshake */ |
| 78 | ret = mobilesync_error(device_link_service_version_exchange(dlclient, MSYNC_VERSION_INT1, MSYNC_VERSION_INT2)); | 78 | ret = mobilesync_error(device_link_service_version_exchange(dlclient, MSYNC_VERSION_INT1, MSYNC_VERSION_INT2)); |
| 79 | if (ret != MOBILESYNC_E_SUCCESS) { | 79 | if (ret != MOBILESYNC_E_SUCCESS) { |
| 80 | log_dbg_msg(DBGMASK_MOBILESYNC, "%s: version exchange failed, error %d\n", __func__, ret); | 80 | log_debug_msg("%s: version exchange failed, error %d\n", __func__, ret); |
| 81 | mobilesync_client_free(client_loc); | 81 | mobilesync_client_free(client_loc); |
| 82 | return ret; | 82 | return ret; |
| 83 | } | 83 | } |
| @@ -116,7 +116,7 @@ mobilesync_error_t mobilesync_recv(mobilesync_client_t client, plist_t * plist) | |||
| 116 | char *XMLContent = NULL; | 116 | char *XMLContent = NULL; |
| 117 | uint32_t length = 0; | 117 | uint32_t length = 0; |
| 118 | plist_to_xml(*plist, &XMLContent, &length); | 118 | plist_to_xml(*plist, &XMLContent, &length); |
| 119 | log_dbg_msg(DBGMASK_MOBILESYNC, "%s: plist size: %i\nbuffer :\n%s\n", __func__, length, XMLContent); | 119 | log_debug_msg("%s: plist size: %i\nbuffer :\n%s\n", __func__, length, XMLContent); |
| 120 | free(XMLContent); | 120 | free(XMLContent); |
| 121 | #endif | 121 | #endif |
| 122 | return ret; | 122 | return ret; |
| @@ -141,7 +141,7 @@ mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist_t plist) | |||
| 141 | char *XMLContent = NULL; | 141 | char *XMLContent = NULL; |
| 142 | uint32_t length = 0; | 142 | uint32_t length = 0; |
| 143 | plist_to_xml(plist, &XMLContent, &length); | 143 | plist_to_xml(plist, &XMLContent, &length); |
| 144 | log_dbg_msg(DBGMASK_MOBILESYNC, "%s: plist size: %i\nbuffer :\n%s\n", __func__, length, XMLContent); | 144 | log_debug_msg("%s: plist size: %i\nbuffer :\n%s\n", __func__, length, XMLContent); |
| 145 | free(XMLContent); | 145 | free(XMLContent); |
| 146 | #endif | 146 | #endif |
| 147 | return mobilesync_error(device_link_service_send(client->parent, plist)); | 147 | return mobilesync_error(device_link_service_send(client->parent, plist)); |
diff --git a/src/debug.c b/src/debug.c index b5f74ad..78f3a17 100644 --- a/src/debug.c +++ b/src/debug.c | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | #include "libiphone/libiphone.h" | 26 | #include "libiphone/libiphone.h" |
| 27 | 27 | ||
| 28 | int toto_debug = 0; | 28 | int toto_debug = 0; |
| 29 | uint16_t dbg_mask = 0; | ||
| 30 | 29 | ||
| 31 | /** | 30 | /** |
| 32 | * Sets the level of debugging. Currently the only acceptable values are 0 and | 31 | * Sets the level of debugging. Currently the only acceptable values are 0 and |
| @@ -39,17 +38,6 @@ void iphone_set_debug_level(int level) | |||
| 39 | toto_debug = level; | 38 | toto_debug = level; |
| 40 | } | 39 | } |
| 41 | 40 | ||
| 42 | |||
| 43 | /** | ||
| 44 | * Set debug ids to display. Values can be OR-ed | ||
| 45 | * | ||
| 46 | * @param level Set to 0 for no debugging or 1 for debugging. | ||
| 47 | */ | ||
| 48 | void iphone_set_debug_mask(uint16_t mask) | ||
| 49 | { | ||
| 50 | dbg_mask = mask; | ||
| 51 | } | ||
| 52 | |||
| 53 | void log_debug_msg(const char *format, ...) | 41 | void log_debug_msg(const char *format, ...) |
| 54 | { | 42 | { |
| 55 | #ifndef STRIP_DEBUG_CODE | 43 | #ifndef STRIP_DEBUG_CODE |
| @@ -66,21 +54,6 @@ void log_debug_msg(const char *format, ...) | |||
| 66 | #endif | 54 | #endif |
| 67 | } | 55 | } |
| 68 | 56 | ||
| 69 | void log_dbg_msg(uint16_t id, const char *format, ...) | ||
| 70 | { | ||
| 71 | #ifndef STRIP_DEBUG_CODE | ||
| 72 | if (id & dbg_mask) { | ||
| 73 | va_list args; | ||
| 74 | /* run the real fprintf */ | ||
| 75 | va_start(args, format); | ||
| 76 | |||
| 77 | vfprintf(stderr, format, args); | ||
| 78 | |||
| 79 | va_end(args); | ||
| 80 | } | ||
| 81 | #endif | ||
| 82 | } | ||
| 83 | |||
| 84 | inline void log_debug_buffer(const char *data, const int length) | 57 | inline void log_debug_buffer(const char *data, const int length) |
| 85 | { | 58 | { |
| 86 | #ifndef STRIP_DEBUG_CODE | 59 | #ifndef STRIP_DEBUG_CODE |
diff --git a/src/debug.h b/src/debug.h index 96844dd..398508e 100644 --- a/src/debug.h +++ b/src/debug.h | |||
| @@ -25,8 +25,6 @@ | |||
| 25 | #include <glib.h> | 25 | #include <glib.h> |
| 26 | 26 | ||
| 27 | G_GNUC_INTERNAL inline void log_debug_msg(const char *format, ...); | 27 | G_GNUC_INTERNAL inline void log_debug_msg(const char *format, ...); |
| 28 | G_GNUC_INTERNAL inline void log_dbg_msg(uint16_t id, const char *format, ...); | ||
| 29 | |||
| 30 | G_GNUC_INTERNAL inline void log_debug_buffer(const char *data, const int length); | 28 | G_GNUC_INTERNAL inline void log_debug_buffer(const char *data, const int length); |
| 31 | G_GNUC_INTERNAL inline void dump_debug_buffer(const char *file, const char *data, const int length); | 29 | G_GNUC_INTERNAL inline void dump_debug_buffer(const char *file, const char *data, const int length); |
| 32 | 30 | ||
diff --git a/src/lockdown.c b/src/lockdown.c index 5927192..5e0f579 100644 --- a/src/lockdown.c +++ b/src/lockdown.c | |||
| @@ -99,7 +99,7 @@ static int lockdown_check_result(plist_t dict, const char *query_match) | |||
| 99 | } else if (!strcmp(result_value, "Failure")) { | 99 | } else if (!strcmp(result_value, "Failure")) { |
| 100 | ret = RESULT_FAILURE; | 100 | ret = RESULT_FAILURE; |
| 101 | } else { | 101 | } else { |
| 102 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: ERROR: unknown result value '%s'\n", __func__, result_value); | 102 | log_debug_msg("%s: ERROR: unknown result value '%s'\n", __func__, result_value); |
| 103 | } | 103 | } |
| 104 | } | 104 | } |
| 105 | if (result_value) | 105 | if (result_value) |
| @@ -136,9 +136,9 @@ static ssize_t lockdownd_ssl_write(gnutls_transport_ptr_t transport, char *buffe | |||
| 136 | uint32_t bytes = 0; | 136 | uint32_t bytes = 0; |
| 137 | lockdownd_client_t client; | 137 | lockdownd_client_t client; |
| 138 | client = (lockdownd_client_t) transport; | 138 | client = (lockdownd_client_t) transport; |
| 139 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: pre-send length = %zi\n", __func__, length); | 139 | log_debug_msg("%s: pre-send length = %zi\n", __func__, length); |
| 140 | iphone_device_send(property_list_service_get_connection(client->parent), buffer, length, &bytes); | 140 | iphone_device_send(property_list_service_get_connection(client->parent), buffer, length, &bytes); |
| 141 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: post-send sent %i bytes\n", __func__, bytes); | 141 | log_debug_msg("%s: post-send sent %i bytes\n", __func__, bytes); |
| 142 | return bytes; | 142 | return bytes; |
| 143 | } | 143 | } |
| 144 | 144 | ||
| @@ -207,7 +207,7 @@ static lockdownd_error_t lockdownd_ssl_start_session(lockdownd_client_t client) | |||
| 207 | uint32_t return_me = 0; | 207 | uint32_t return_me = 0; |
| 208 | 208 | ||
| 209 | // Set up GnuTLS... | 209 | // Set up GnuTLS... |
| 210 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: enabling SSL mode\n", __func__); | 210 | log_debug_msg("%s: enabling SSL mode\n", __func__); |
| 211 | errno = 0; | 211 | errno = 0; |
| 212 | gnutls_global_init(); | 212 | gnutls_global_init(); |
| 213 | gnutls_certificate_allocate_credentials(&client->ssl_certificate); | 213 | gnutls_certificate_allocate_credentials(&client->ssl_certificate); |
| @@ -228,26 +228,26 @@ static lockdownd_error_t lockdownd_ssl_start_session(lockdownd_client_t client) | |||
| 228 | } | 228 | } |
| 229 | gnutls_credentials_set(client->ssl_session, GNUTLS_CRD_CERTIFICATE, client->ssl_certificate); // this part is killing me. | 229 | gnutls_credentials_set(client->ssl_session, GNUTLS_CRD_CERTIFICATE, client->ssl_certificate); // this part is killing me. |
| 230 | 230 | ||
| 231 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: GnuTLS step 1...\n", __func__); | 231 | log_debug_msg("%s: GnuTLS step 1...\n", __func__); |
| 232 | gnutls_transport_set_ptr(client->ssl_session, (gnutls_transport_ptr_t) client); | 232 | gnutls_transport_set_ptr(client->ssl_session, (gnutls_transport_ptr_t) client); |
| 233 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: GnuTLS step 2...\n", __func__); | 233 | log_debug_msg("%s: GnuTLS step 2...\n", __func__); |
| 234 | gnutls_transport_set_push_function(client->ssl_session, (gnutls_push_func) & lockdownd_ssl_write); | 234 | gnutls_transport_set_push_function(client->ssl_session, (gnutls_push_func) & lockdownd_ssl_write); |
| 235 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: GnuTLS step 3...\n", __func__); | 235 | log_debug_msg("%s: GnuTLS step 3...\n", __func__); |
| 236 | gnutls_transport_set_pull_function(client->ssl_session, (gnutls_pull_func) & lockdownd_ssl_read); | 236 | gnutls_transport_set_pull_function(client->ssl_session, (gnutls_pull_func) & lockdownd_ssl_read); |
| 237 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: GnuTLS step 4 -- now handshaking...\n", __func__); | 237 | log_debug_msg("%s: GnuTLS step 4 -- now handshaking...\n", __func__); |
| 238 | if (errno) | 238 | if (errno) |
| 239 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: WARN: errno says %s before handshake!\n", __func__, strerror(errno)); | 239 | log_debug_msg("%s: WARN: errno says %s before handshake!\n", __func__, strerror(errno)); |
| 240 | return_me = gnutls_handshake(client->ssl_session); | 240 | return_me = gnutls_handshake(client->ssl_session); |
| 241 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: GnuTLS handshake done...\n", __func__); | 241 | log_debug_msg("%s: GnuTLS handshake done...\n", __func__); |
| 242 | 242 | ||
| 243 | if (return_me != GNUTLS_E_SUCCESS) { | 243 | if (return_me != GNUTLS_E_SUCCESS) { |
| 244 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: GnuTLS reported something wrong.\n", __func__); | 244 | log_debug_msg("%s: GnuTLS reported something wrong.\n", __func__); |
| 245 | gnutls_perror(return_me); | 245 | gnutls_perror(return_me); |
| 246 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: oh.. errno says %s\n", __func__, strerror(errno)); | 246 | log_debug_msg("%s: oh.. errno says %s\n", __func__, strerror(errno)); |
| 247 | } else { | 247 | } else { |
| 248 | client->ssl_enabled = 1; | 248 | client->ssl_enabled = 1; |
| 249 | ret = LOCKDOWN_E_SUCCESS; | 249 | ret = LOCKDOWN_E_SUCCESS; |
| 250 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: SSL mode enabled\n", __func__); | 250 | log_debug_msg("%s: SSL mode enabled\n", __func__); |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | return ret; | 253 | return ret; |
| @@ -264,13 +264,13 @@ static lockdownd_error_t lockdownd_ssl_start_session(lockdownd_client_t client) | |||
| 264 | static lockdownd_error_t lockdownd_ssl_stop_session(lockdownd_client_t client) | 264 | static lockdownd_error_t lockdownd_ssl_stop_session(lockdownd_client_t client) |
| 265 | { | 265 | { |
| 266 | if (!client) { | 266 | if (!client) { |
| 267 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: invalid argument!\n", __func__); | 267 | log_debug_msg("%s: invalid argument!\n", __func__); |
| 268 | return LOCKDOWN_E_INVALID_ARG; | 268 | return LOCKDOWN_E_INVALID_ARG; |
| 269 | } | 269 | } |
| 270 | lockdownd_error_t ret = LOCKDOWN_E_SUCCESS; | 270 | lockdownd_error_t ret = LOCKDOWN_E_SUCCESS; |
| 271 | 271 | ||
| 272 | if (client->ssl_enabled) { | 272 | if (client->ssl_enabled) { |
| 273 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: sending SSL close notify\n", __func__); | 273 | log_debug_msg("%s: sending SSL close notify\n", __func__); |
| 274 | gnutls_bye(client->ssl_session, GNUTLS_SHUT_RDWR); | 274 | gnutls_bye(client->ssl_session, GNUTLS_SHUT_RDWR); |
| 275 | } | 275 | } |
| 276 | if (client->ssl_session) { | 276 | if (client->ssl_session) { |
| @@ -285,7 +285,7 @@ static lockdownd_error_t lockdownd_ssl_stop_session(lockdownd_client_t client) | |||
| 285 | free(client->session_id); | 285 | free(client->session_id); |
| 286 | client->session_id = NULL; | 286 | client->session_id = NULL; |
| 287 | 287 | ||
| 288 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: SSL mode disabled\n", __func__); | 288 | log_debug_msg("%s: SSL mode disabled\n", __func__); |
| 289 | 289 | ||
| 290 | return ret; | 290 | return ret; |
| 291 | } | 291 | } |
| @@ -307,7 +307,7 @@ lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client, const char * | |||
| 307 | return LOCKDOWN_E_INVALID_ARG; | 307 | return LOCKDOWN_E_INVALID_ARG; |
| 308 | 308 | ||
| 309 | if (!session_id) { | 309 | if (!session_id) { |
| 310 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: no session_id given, cannot stop session\n", __func__); | 310 | log_debug_msg("%s: no session_id given, cannot stop session\n", __func__); |
| 311 | return LOCKDOWN_E_INVALID_ARG; | 311 | return LOCKDOWN_E_INVALID_ARG; |
| 312 | } | 312 | } |
| 313 | 313 | ||
| @@ -318,7 +318,7 @@ lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client, const char * | |||
| 318 | plist_dict_insert_item(dict,"Request", plist_new_string("StopSession")); | 318 | plist_dict_insert_item(dict,"Request", plist_new_string("StopSession")); |
| 319 | plist_dict_insert_item(dict,"SessionID", plist_new_string(session_id)); | 319 | plist_dict_insert_item(dict,"SessionID", plist_new_string(session_id)); |
| 320 | 320 | ||
| 321 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: stopping session %s\n", __func__, session_id); | 321 | log_debug_msg("%s: stopping session %s\n", __func__, session_id); |
| 322 | 322 | ||
| 323 | ret = lockdownd_send(client, dict); | 323 | ret = lockdownd_send(client, dict); |
| 324 | 324 | ||
| @@ -328,13 +328,13 @@ lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client, const char * | |||
| 328 | ret = lockdownd_recv(client, &dict); | 328 | ret = lockdownd_recv(client, &dict); |
| 329 | 329 | ||
| 330 | if (!dict) { | 330 | if (!dict) { |
| 331 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: LOCKDOWN_E_PLIST_ERROR\n", __func__); | 331 | log_debug_msg("%s: LOCKDOWN_E_PLIST_ERROR\n", __func__); |
| 332 | return LOCKDOWN_E_PLIST_ERROR; | 332 | return LOCKDOWN_E_PLIST_ERROR; |
| 333 | } | 333 | } |
| 334 | 334 | ||
| 335 | ret = LOCKDOWN_E_UNKNOWN_ERROR; | 335 | ret = LOCKDOWN_E_UNKNOWN_ERROR; |
| 336 | if (lockdown_check_result(dict, "StopSession") == RESULT_SUCCESS) { | 336 | if (lockdown_check_result(dict, "StopSession") == RESULT_SUCCESS) { |
| 337 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success\n", __func__); | 337 | log_debug_msg("%s: success\n", __func__); |
| 338 | ret = LOCKDOWN_E_SUCCESS; | 338 | ret = LOCKDOWN_E_SUCCESS; |
| 339 | } | 339 | } |
| 340 | plist_free(dict); | 340 | plist_free(dict); |
| @@ -480,7 +480,7 @@ lockdownd_error_t lockdownd_query_type(lockdownd_client_t client, char **type) | |||
| 480 | plist_dict_add_label(dict, client->label); | 480 | plist_dict_add_label(dict, client->label); |
| 481 | plist_dict_insert_item(dict,"Request", plist_new_string("QueryType")); | 481 | plist_dict_insert_item(dict,"Request", plist_new_string("QueryType")); |
| 482 | 482 | ||
| 483 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: called\n", __func__); | 483 | log_debug_msg("%s: called\n", __func__); |
| 484 | ret = lockdownd_send(client, dict); | 484 | ret = lockdownd_send(client, dict); |
| 485 | 485 | ||
| 486 | plist_free(dict); | 486 | plist_free(dict); |
| @@ -498,7 +498,7 @@ lockdownd_error_t lockdownd_query_type(lockdownd_client_t client, char **type) | |||
| 498 | plist_t type_node = plist_dict_get_item(dict, "Type"); | 498 | plist_t type_node = plist_dict_get_item(dict, "Type"); |
| 499 | plist_get_string_val(type_node, type); | 499 | plist_get_string_val(type_node, type); |
| 500 | } | 500 | } |
| 501 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success with type %s\n", __func__, *type); | 501 | log_debug_msg("%s: success with type %s\n", __func__, *type); |
| 502 | ret = LOCKDOWN_E_SUCCESS; | 502 | ret = LOCKDOWN_E_SUCCESS; |
| 503 | } | 503 | } |
| 504 | plist_free(dict); | 504 | plist_free(dict); |
| @@ -550,7 +550,7 @@ lockdownd_error_t lockdownd_get_value(lockdownd_client_t client, const char *dom | |||
| 550 | return ret; | 550 | return ret; |
| 551 | 551 | ||
| 552 | if (lockdown_check_result(dict, "GetValue") == RESULT_SUCCESS) { | 552 | if (lockdown_check_result(dict, "GetValue") == RESULT_SUCCESS) { |
| 553 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success\n", __func__); | 553 | log_debug_msg("%s: success\n", __func__); |
| 554 | ret = LOCKDOWN_E_SUCCESS; | 554 | ret = LOCKDOWN_E_SUCCESS; |
| 555 | } | 555 | } |
| 556 | if (ret != LOCKDOWN_E_SUCCESS) { | 556 | if (ret != LOCKDOWN_E_SUCCESS) { |
| @@ -561,7 +561,7 @@ lockdownd_error_t lockdownd_get_value(lockdownd_client_t client, const char *dom | |||
| 561 | plist_t value_node = plist_dict_get_item(dict, "Value"); | 561 | plist_t value_node = plist_dict_get_item(dict, "Value"); |
| 562 | 562 | ||
| 563 | if (value_node) { | 563 | if (value_node) { |
| 564 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: has a value\n", __func__); | 564 | log_debug_msg("%s: has a value\n", __func__); |
| 565 | *value = plist_copy(value_node); | 565 | *value = plist_copy(value_node); |
| 566 | } | 566 | } |
| 567 | 567 | ||
| @@ -613,7 +613,7 @@ lockdownd_error_t lockdownd_set_value(lockdownd_client_t client, const char *dom | |||
| 613 | return ret; | 613 | return ret; |
| 614 | 614 | ||
| 615 | if (lockdown_check_result(dict, "SetValue") == RESULT_SUCCESS) { | 615 | if (lockdown_check_result(dict, "SetValue") == RESULT_SUCCESS) { |
| 616 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success\n", __func__); | 616 | log_debug_msg("%s: success\n", __func__); |
| 617 | ret = LOCKDOWN_E_SUCCESS; | 617 | ret = LOCKDOWN_E_SUCCESS; |
| 618 | } | 618 | } |
| 619 | 619 | ||
| @@ -670,7 +670,7 @@ lockdownd_error_t lockdownd_remove_value(lockdownd_client_t client, const char * | |||
| 670 | return ret; | 670 | return ret; |
| 671 | 671 | ||
| 672 | if (lockdown_check_result(dict, "RemoveValue") == RESULT_SUCCESS) { | 672 | if (lockdown_check_result(dict, "RemoveValue") == RESULT_SUCCESS) { |
| 673 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success\n", __func__); | 673 | log_debug_msg("%s: success\n", __func__); |
| 674 | ret = LOCKDOWN_E_SUCCESS; | 674 | ret = LOCKDOWN_E_SUCCESS; |
| 675 | } | 675 | } |
| 676 | 676 | ||
| @@ -944,7 +944,7 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, char *host | |||
| 944 | 944 | ||
| 945 | /* if pairing succeeded */ | 945 | /* if pairing succeeded */ |
| 946 | if (ret == LOCKDOWN_E_SUCCESS) { | 946 | if (ret == LOCKDOWN_E_SUCCESS) { |
| 947 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: %s success\n", __func__, verb); | 947 | log_debug_msg("%s: %s success\n", __func__, verb); |
| 948 | if (!strcmp("Unpair", verb)) { | 948 | if (!strcmp("Unpair", verb)) { |
| 949 | /* remove public key from config */ | 949 | /* remove public key from config */ |
| 950 | userpref_remove_device_public_key(client->uuid); | 950 | userpref_remove_device_public_key(client->uuid); |
| @@ -953,7 +953,7 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, char *host | |||
| 953 | userpref_set_device_public_key(client->uuid, public_key); | 953 | userpref_set_device_public_key(client->uuid, public_key); |
| 954 | } | 954 | } |
| 955 | } else { | 955 | } else { |
| 956 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: %s failure\n", __func__, verb); | 956 | log_debug_msg("%s: %s failure\n", __func__, verb); |
| 957 | plist_t error_node = NULL; | 957 | plist_t error_node = NULL; |
| 958 | /* verify error condition */ | 958 | /* verify error condition */ |
| 959 | error_node = plist_dict_get_item(dict, "Error"); | 959 | error_node = plist_dict_get_item(dict, "Error"); |
| @@ -1041,7 +1041,7 @@ lockdownd_error_t lockdownd_enter_recovery(lockdownd_client_t client) | |||
| 1041 | plist_dict_add_label(dict, client->label); | 1041 | plist_dict_add_label(dict, client->label); |
| 1042 | plist_dict_insert_item(dict,"Request", plist_new_string("EnterRecovery")); | 1042 | plist_dict_insert_item(dict,"Request", plist_new_string("EnterRecovery")); |
| 1043 | 1043 | ||
| 1044 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: telling device to enter recovery mode\n", __func__); | 1044 | log_debug_msg("%s: telling device to enter recovery mode\n", __func__); |
| 1045 | 1045 | ||
| 1046 | ret = lockdownd_send(client, dict); | 1046 | ret = lockdownd_send(client, dict); |
| 1047 | plist_free(dict); | 1047 | plist_free(dict); |
| @@ -1050,7 +1050,7 @@ lockdownd_error_t lockdownd_enter_recovery(lockdownd_client_t client) | |||
| 1050 | ret = lockdownd_recv(client, &dict); | 1050 | ret = lockdownd_recv(client, &dict); |
| 1051 | 1051 | ||
| 1052 | if (lockdown_check_result(dict, "EnterRecovery") == RESULT_SUCCESS) { | 1052 | if (lockdown_check_result(dict, "EnterRecovery") == RESULT_SUCCESS) { |
| 1053 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success\n", __func__); | 1053 | log_debug_msg("%s: success\n", __func__); |
| 1054 | ret = LOCKDOWN_E_SUCCESS; | 1054 | ret = LOCKDOWN_E_SUCCESS; |
| 1055 | } | 1055 | } |
| 1056 | plist_free(dict); | 1056 | plist_free(dict); |
| @@ -1077,7 +1077,7 @@ lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client) | |||
| 1077 | plist_dict_add_label(dict, client->label); | 1077 | plist_dict_add_label(dict, client->label); |
| 1078 | plist_dict_insert_item(dict,"Request", plist_new_string("Goodbye")); | 1078 | plist_dict_insert_item(dict,"Request", plist_new_string("Goodbye")); |
| 1079 | 1079 | ||
| 1080 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: called\n", __func__); | 1080 | log_debug_msg("%s: called\n", __func__); |
| 1081 | 1081 | ||
| 1082 | ret = lockdownd_send(client, dict); | 1082 | ret = lockdownd_send(client, dict); |
| 1083 | plist_free(dict); | 1083 | plist_free(dict); |
| @@ -1085,12 +1085,12 @@ lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client) | |||
| 1085 | 1085 | ||
| 1086 | ret = lockdownd_recv(client, &dict); | 1086 | ret = lockdownd_recv(client, &dict); |
| 1087 | if (!dict) { | 1087 | if (!dict) { |
| 1088 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: did not get goodbye response back\n", __func__); | 1088 | log_debug_msg("%s: did not get goodbye response back\n", __func__); |
| 1089 | return LOCKDOWN_E_PLIST_ERROR; | 1089 | return LOCKDOWN_E_PLIST_ERROR; |
| 1090 | } | 1090 | } |
| 1091 | 1091 | ||
| 1092 | if (lockdown_check_result(dict, "Goodbye") == RESULT_SUCCESS) { | 1092 | if (lockdown_check_result(dict, "Goodbye") == RESULT_SUCCESS) { |
| 1093 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success\n", __func__); | 1093 | log_debug_msg("%s: success\n", __func__); |
| 1094 | ret = LOCKDOWN_E_SUCCESS; | 1094 | ret = LOCKDOWN_E_SUCCESS; |
| 1095 | } | 1095 | } |
| 1096 | plist_free(dict); | 1096 | plist_free(dict); |
| @@ -1294,7 +1294,7 @@ lockdownd_error_t lockdownd_start_session(lockdownd_client_t client, const char | |||
| 1294 | if (enable_ssl && (plist_get_node_type(enable_ssl) == PLIST_BOOLEAN)) { | 1294 | if (enable_ssl && (plist_get_node_type(enable_ssl) == PLIST_BOOLEAN)) { |
| 1295 | plist_get_bool_val(enable_ssl, &use_ssl); | 1295 | plist_get_bool_val(enable_ssl, &use_ssl); |
| 1296 | } | 1296 | } |
| 1297 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: Session startup OK\n", __func__); | 1297 | log_debug_msg("%s: Session startup OK\n", __func__); |
| 1298 | 1298 | ||
| 1299 | if (ssl_enabled != NULL) | 1299 | if (ssl_enabled != NULL) |
| 1300 | *ssl_enabled = use_ssl; | 1300 | *ssl_enabled = use_ssl; |
| @@ -1305,13 +1305,13 @@ lockdownd_error_t lockdownd_start_session(lockdownd_client_t client, const char | |||
| 1305 | plist_get_string_val(session_node, &client->session_id); | 1305 | plist_get_string_val(session_node, &client->session_id); |
| 1306 | } | 1306 | } |
| 1307 | if (client->session_id) { | 1307 | if (client->session_id) { |
| 1308 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: SessionID: %s\n", __func__, client->session_id); | 1308 | log_debug_msg("%s: SessionID: %s\n", __func__, client->session_id); |
| 1309 | if (session_id != NULL) | 1309 | if (session_id != NULL) |
| 1310 | *session_id = strdup(client->session_id); | 1310 | *session_id = strdup(client->session_id); |
| 1311 | } else { | 1311 | } else { |
| 1312 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: Failed to get SessionID!\n", __func__); | 1312 | log_debug_msg("%s: Failed to get SessionID!\n", __func__); |
| 1313 | } | 1313 | } |
| 1314 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: Enable SSL Session: %s\n", __func__, (use_ssl?"true":"false")); | 1314 | log_debug_msg("%s: Enable SSL Session: %s\n", __func__, (use_ssl?"true":"false")); |
| 1315 | if (use_ssl) { | 1315 | if (use_ssl) { |
| 1316 | ret = lockdownd_ssl_start_session(client); | 1316 | ret = lockdownd_ssl_start_session(client); |
| 1317 | } else { | 1317 | } else { |
| @@ -1434,13 +1434,13 @@ lockdownd_error_t lockdownd_activate(lockdownd_client_t client, plist_t activati | |||
| 1434 | 1434 | ||
| 1435 | ret = lockdownd_recv(client, &dict); | 1435 | ret = lockdownd_recv(client, &dict); |
| 1436 | if (!dict) { | 1436 | if (!dict) { |
| 1437 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: LOCKDOWN_E_PLIST_ERROR\n", __func__); | 1437 | log_debug_msg("%s: LOCKDOWN_E_PLIST_ERROR\n", __func__); |
| 1438 | return LOCKDOWN_E_PLIST_ERROR; | 1438 | return LOCKDOWN_E_PLIST_ERROR; |
| 1439 | } | 1439 | } |
| 1440 | 1440 | ||
| 1441 | ret = LOCKDOWN_E_ACTIVATION_FAILED; | 1441 | ret = LOCKDOWN_E_ACTIVATION_FAILED; |
| 1442 | if (lockdown_check_result(dict, "Activate") == RESULT_SUCCESS) { | 1442 | if (lockdown_check_result(dict, "Activate") == RESULT_SUCCESS) { |
| 1443 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success\n", __func__); | 1443 | log_debug_msg("%s: success\n", __func__); |
| 1444 | ret = LOCKDOWN_E_SUCCESS; | 1444 | ret = LOCKDOWN_E_SUCCESS; |
| 1445 | } | 1445 | } |
| 1446 | plist_free(dict); | 1446 | plist_free(dict); |
| @@ -1477,13 +1477,13 @@ lockdownd_error_t lockdownd_deactivate(lockdownd_client_t client) | |||
| 1477 | 1477 | ||
| 1478 | ret = lockdownd_recv(client, &dict); | 1478 | ret = lockdownd_recv(client, &dict); |
| 1479 | if (!dict) { | 1479 | if (!dict) { |
| 1480 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: LOCKDOWN_E_PLIST_ERROR\n", __func__); | 1480 | log_debug_msg("%s: LOCKDOWN_E_PLIST_ERROR\n", __func__); |
| 1481 | return LOCKDOWN_E_PLIST_ERROR; | 1481 | return LOCKDOWN_E_PLIST_ERROR; |
| 1482 | } | 1482 | } |
| 1483 | 1483 | ||
| 1484 | ret = LOCKDOWN_E_UNKNOWN_ERROR; | 1484 | ret = LOCKDOWN_E_UNKNOWN_ERROR; |
| 1485 | if (lockdown_check_result(dict, "Deactivate") == RESULT_SUCCESS) { | 1485 | if (lockdown_check_result(dict, "Deactivate") == RESULT_SUCCESS) { |
| 1486 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: success\n", __func__); | 1486 | log_debug_msg("%s: success\n", __func__); |
| 1487 | ret = LOCKDOWN_E_SUCCESS; | 1487 | ret = LOCKDOWN_E_SUCCESS; |
| 1488 | } | 1488 | } |
| 1489 | plist_free(dict); | 1489 | plist_free(dict); |
diff --git a/swig/iphone.i b/swig/iphone.i index 184f7f9..de6b80f 100644 --- a/swig/iphone.i +++ b/swig/iphone.i | |||
| @@ -36,11 +36,6 @@ PList::Node* new_node_from_plist(plist_t node); | |||
| 36 | %include "cstring.i" | 36 | %include "cstring.i" |
| 37 | %include "plist/swig/plist.i" | 37 | %include "plist/swig/plist.i" |
| 38 | 38 | ||
| 39 | #define DBGMASK_ALL 0xFFFF | ||
| 40 | #define DBGMASK_NONE 0x0000 | ||
| 41 | #define DBGMASK_LOCKDOWND (1 << 1) | ||
| 42 | #define DBGMASK_MOBILESYNC (1 << 2) | ||
| 43 | |||
| 44 | typedef struct { | 39 | typedef struct { |
| 45 | iphone_device_t dev; | 40 | iphone_device_t dev; |
| 46 | } iPhone; | 41 | } iPhone; |
| @@ -149,10 +144,6 @@ PList::Node* new_node_from_plist(plist_t node) | |||
| 149 | my_delete_iPhone($self); | 144 | my_delete_iPhone($self); |
| 150 | } | 145 | } |
| 151 | 146 | ||
| 152 | void set_debug_mask(uint16_t mask) { | ||
| 153 | iphone_set_debug_mask(mask); | ||
| 154 | } | ||
| 155 | |||
| 156 | void set_debug_level(int level) { | 147 | void set_debug_level(int level) { |
| 157 | iphone_set_debug_level(level); | 148 | iphone_set_debug_level(level); |
| 158 | } | 149 | } |
diff --git a/tools/iphone_id.c b/tools/iphone_id.c index a293469..4a2c3af 100644 --- a/tools/iphone_id.c +++ b/tools/iphone_id.c | |||
| @@ -38,7 +38,6 @@ int main(int argc, char **argv) | |||
| 38 | /* parse cmdline args */ | 38 | /* parse cmdline args */ |
| 39 | for (i = 1; i < argc; i++) { | 39 | for (i = 1; i < argc; i++) { |
| 40 | if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { | 40 | if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { |
| 41 | iphone_set_debug_mask(DBGMASK_ALL); | ||
| 42 | iphone_set_debug_level(1); | 41 | iphone_set_debug_level(1); |
| 43 | continue; | 42 | continue; |
| 44 | } | 43 | } |
diff --git a/tools/iphoneinfo.c b/tools/iphoneinfo.c index a8fba5f..7c41033 100644 --- a/tools/iphoneinfo.c +++ b/tools/iphoneinfo.c | |||
| @@ -78,7 +78,6 @@ int main(int argc, char *argv[]) | |||
| 78 | /* parse cmdline args */ | 78 | /* parse cmdline args */ |
| 79 | for (i = 1; i < argc; i++) { | 79 | for (i = 1; i < argc; i++) { |
| 80 | if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { | 80 | if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { |
| 81 | iphone_set_debug_mask(DBGMASK_ALL); | ||
| 82 | iphone_set_debug_level(1); | 81 | iphone_set_debug_level(1); |
| 83 | continue; | 82 | continue; |
| 84 | } | 83 | } |
diff --git a/tools/iphonesyslog.c b/tools/iphonesyslog.c index 14a8223..195fc7c 100644 --- a/tools/iphonesyslog.c +++ b/tools/iphonesyslog.c | |||
| @@ -60,7 +60,6 @@ int main(int argc, char *argv[]) | |||
| 60 | /* parse cmdline args */ | 60 | /* parse cmdline args */ |
| 61 | for (i = 1; i < argc; i++) { | 61 | for (i = 1; i < argc; i++) { |
| 62 | if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { | 62 | if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { |
| 63 | iphone_set_debug_mask(DBGMASK_ALL); | ||
| 64 | iphone_set_debug_level(1); | 63 | iphone_set_debug_level(1); |
| 65 | continue; | 64 | continue; |
| 66 | } | 65 | } |
