diff options
| author | 2010-01-12 19:09:36 +0100 | |
|---|---|---|
| committer | 2010-01-12 19:09:36 +0100 | |
| commit | 342f4e929888c0aaa088e39fb98a74957bf45fa7 (patch) | |
| tree | 905bafb1b353b8ac21e3fb1f9c773d218a5c878e /src/lockdown.c | |
| parent | bf3dc421b2b5ccfe2fcd3cd4ec1ef90f39599600 (diff) | |
| download | libimobiledevice-342f4e929888c0aaa088e39fb98a74957bf45fa7.tar.gz libimobiledevice-342f4e929888c0aaa088e39fb98a74957bf45fa7.tar.bz2 | |
Refactor and unify internal debug system for ease of use and verbosity
This introduces a new debug_info macro which automatically prints
the calling function, file and line number information instead of
having that information passed to every old log_debug_msg call.
Diffstat (limited to 'src/lockdown.c')
| -rw-r--r-- | src/lockdown.c | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/src/lockdown.c b/src/lockdown.c index 5e0f579..7609426 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_debug_msg("%s: ERROR: unknown result value '%s'\n", __func__, result_value); | 102 | debug_info("ERROR: unknown result value '%s'", 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_debug_msg("%s: pre-send length = %zi\n", __func__, length); | 139 | debug_info("pre-send length = %zi", 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_debug_msg("%s: post-send sent %i bytes\n", __func__, bytes); | 141 | debug_info("post-send sent %i bytes", bytes); |
| 142 | return bytes; | 142 | return bytes; |
| 143 | } | 143 | } |
| 144 | 144 | ||
| @@ -160,17 +160,17 @@ static ssize_t lockdownd_ssl_read(gnutls_transport_ptr_t transport, char *buffer | |||
| 160 | client = (lockdownd_client_t) transport; | 160 | client = (lockdownd_client_t) transport; |
| 161 | char *recv_buffer; | 161 | char *recv_buffer; |
| 162 | 162 | ||
| 163 | log_debug_msg("%s: pre-read client wants %zi bytes\n", __func__, length); | 163 | debug_info("pre-read client wants %zi bytes", length); |
| 164 | 164 | ||
| 165 | recv_buffer = (char *) malloc(sizeof(char) * this_len); | 165 | recv_buffer = (char *) malloc(sizeof(char) * this_len); |
| 166 | 166 | ||
| 167 | /* repeat until we have the full data or an error occurs */ | 167 | /* repeat until we have the full data or an error occurs */ |
| 168 | do { | 168 | do { |
| 169 | if ((res = iphone_device_recv(property_list_service_get_connection(client->parent), recv_buffer, this_len, (uint32_t*)&bytes)) != LOCKDOWN_E_SUCCESS) { | 169 | if ((res = iphone_device_recv(property_list_service_get_connection(client->parent), recv_buffer, this_len, (uint32_t*)&bytes)) != LOCKDOWN_E_SUCCESS) { |
| 170 | log_debug_msg("%s: ERROR: iphone_device_recv returned %d\n", __func__, res); | 170 | debug_info("ERROR: iphone_device_recv returned %d", res); |
| 171 | return res; | 171 | return res; |
| 172 | } | 172 | } |
| 173 | log_debug_msg("%s: post-read we got %i bytes\n", __func__, bytes); | 173 | debug_info("post-read we got %i bytes", bytes); |
| 174 | 174 | ||
| 175 | // increase read count | 175 | // increase read count |
| 176 | tbytes += bytes; | 176 | tbytes += bytes; |
| @@ -184,7 +184,7 @@ static ssize_t lockdownd_ssl_read(gnutls_transport_ptr_t transport, char *buffer | |||
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | this_len = length - tbytes; | 186 | this_len = length - tbytes; |
| 187 | log_debug_msg("%s: re-read trying to read missing %i bytes\n", __func__, this_len); | 187 | debug_info("re-read trying to read missing %i bytes", this_len); |
| 188 | } while (tbytes < length); | 188 | } while (tbytes < length); |
| 189 | 189 | ||
| 190 | if (recv_buffer) { | 190 | if (recv_buffer) { |
| @@ -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_debug_msg("%s: enabling SSL mode\n", __func__); | 210 | debug_info("enabling SSL mode"); |
| 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_debug_msg("%s: GnuTLS step 1...\n", __func__); | 231 | debug_info("GnuTLS step 1..."); |
| 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_debug_msg("%s: GnuTLS step 2...\n", __func__); | 233 | debug_info("GnuTLS step 2..."); |
| 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_debug_msg("%s: GnuTLS step 3...\n", __func__); | 235 | debug_info("GnuTLS step 3..."); |
| 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_debug_msg("%s: GnuTLS step 4 -- now handshaking...\n", __func__); | 237 | debug_info("GnuTLS step 4 -- now handshaking..."); |
| 238 | if (errno) | 238 | if (errno) |
| 239 | log_debug_msg("%s: WARN: errno says %s before handshake!\n", __func__, strerror(errno)); | 239 | debug_info("WARN: errno says %s before handshake!", strerror(errno)); |
| 240 | return_me = gnutls_handshake(client->ssl_session); | 240 | return_me = gnutls_handshake(client->ssl_session); |
| 241 | log_debug_msg("%s: GnuTLS handshake done...\n", __func__); | 241 | debug_info("GnuTLS handshake done..."); |
| 242 | 242 | ||
| 243 | if (return_me != GNUTLS_E_SUCCESS) { | 243 | if (return_me != GNUTLS_E_SUCCESS) { |
| 244 | log_debug_msg("%s: GnuTLS reported something wrong.\n", __func__); | 244 | debug_info("GnuTLS reported something wrong."); |
| 245 | gnutls_perror(return_me); | 245 | gnutls_perror(return_me); |
| 246 | log_debug_msg("%s: oh.. errno says %s\n", __func__, strerror(errno)); | 246 | debug_info("oh.. errno says %s", 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_debug_msg("%s: SSL mode enabled\n", __func__); | 250 | debug_info("SSL mode enabled"); |
| 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_debug_msg("%s: invalid argument!\n", __func__); | 267 | debug_info("invalid argument!"); |
| 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_debug_msg("%s: sending SSL close notify\n", __func__); | 273 | debug_info("sending SSL close notify"); |
| 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_debug_msg("%s: SSL mode disabled\n", __func__); | 288 | debug_info("SSL mode disabled"); |
| 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_debug_msg("%s: no session_id given, cannot stop session\n", __func__); | 310 | debug_info("no session_id given, cannot stop session"); |
| 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_debug_msg("%s: stopping session %s\n", __func__, session_id); | 321 | debug_info("stopping session %s", 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_debug_msg("%s: LOCKDOWN_E_PLIST_ERROR\n", __func__); | 331 | debug_info("LOCKDOWN_E_PLIST_ERROR"); |
| 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_debug_msg("%s: success\n", __func__); | 337 | debug_info("success"); |
| 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_debug_msg("%s: called\n", __func__); | 483 | debug_info("called"); |
| 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_debug_msg("%s: success with type %s\n", __func__, *type); | 501 | debug_info("success with type %s", *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_debug_msg("%s: success\n", __func__); | 553 | debug_info("success"); |
| 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_debug_msg("%s: has a value\n", __func__); | 564 | debug_info("has a value"); |
| 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_debug_msg("%s: success\n", __func__); | 616 | debug_info("success"); |
| 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_debug_msg("%s: success\n", __func__); | 673 | debug_info("success"); |
| 674 | ret = LOCKDOWN_E_SUCCESS; | 674 | ret = LOCKDOWN_E_SUCCESS; |
| 675 | } | 675 | } |
| 676 | 676 | ||
| @@ -769,7 +769,7 @@ lockdownd_error_t lockdownd_client_new(iphone_device_t device, lockdownd_client_ | |||
| 769 | 769 | ||
| 770 | property_list_service_client_t plistclient = NULL; | 770 | property_list_service_client_t plistclient = NULL; |
| 771 | if (property_list_service_client_new(device, 0xf27e, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) { | 771 | if (property_list_service_client_new(device, 0xf27e, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) { |
| 772 | log_debug_msg("%s: could not connect to lockdownd (device %s)\n", __func__, device->uuid); | 772 | debug_info("could not connect to lockdownd (device %s)", device->uuid); |
| 773 | return LOCKDOWN_E_MUX_ERROR; | 773 | return LOCKDOWN_E_MUX_ERROR; |
| 774 | } | 774 | } |
| 775 | 775 | ||
| @@ -818,11 +818,11 @@ lockdownd_error_t lockdownd_client_new_with_handshake(iphone_device_t device, lo | |||
| 818 | 818 | ||
| 819 | /* perform handshake */ | 819 | /* perform handshake */ |
| 820 | if (LOCKDOWN_E_SUCCESS != lockdownd_query_type(client_loc, &type)) { | 820 | if (LOCKDOWN_E_SUCCESS != lockdownd_query_type(client_loc, &type)) { |
| 821 | log_debug_msg("%s: QueryType failed in the lockdownd client.\n", __func__); | 821 | debug_info("QueryType failed in the lockdownd client."); |
| 822 | ret = LOCKDOWN_E_NOT_ENOUGH_DATA; | 822 | ret = LOCKDOWN_E_NOT_ENOUGH_DATA; |
| 823 | } else { | 823 | } else { |
| 824 | if (strcmp("com.apple.mobile.lockdown", type)) { | 824 | if (strcmp("com.apple.mobile.lockdown", type)) { |
| 825 | log_debug_msg("%s: Warning QueryType request returned \"%s\".\n", __func__, type); | 825 | debug_info("Warning QueryType request returned \"%s\".", type); |
| 826 | } | 826 | } |
| 827 | if (type) | 827 | if (type) |
| 828 | free(type); | 828 | free(type); |
| @@ -830,9 +830,9 @@ lockdownd_error_t lockdownd_client_new_with_handshake(iphone_device_t device, lo | |||
| 830 | 830 | ||
| 831 | ret = iphone_device_get_uuid(device, &client_loc->uuid); | 831 | ret = iphone_device_get_uuid(device, &client_loc->uuid); |
| 832 | if (LOCKDOWN_E_SUCCESS != ret) { | 832 | if (LOCKDOWN_E_SUCCESS != ret) { |
| 833 | log_debug_msg("%s: failed to get device uuid.\n", __func__); | 833 | debug_info("failed to get device uuid."); |
| 834 | } | 834 | } |
| 835 | log_debug_msg("%s: device uuid: %s\n", __func__, client_loc->uuid); | 835 | debug_info("device uuid: %s", client_loc->uuid); |
| 836 | 836 | ||
| 837 | userpref_get_host_id(&host_id); | 837 | userpref_get_host_id(&host_id); |
| 838 | if (LOCKDOWN_E_SUCCESS == ret && !host_id) { | 838 | if (LOCKDOWN_E_SUCCESS == ret && !host_id) { |
| @@ -849,7 +849,7 @@ lockdownd_error_t lockdownd_client_new_with_handshake(iphone_device_t device, lo | |||
| 849 | ret = lockdownd_start_session(client_loc, host_id, NULL, NULL); | 849 | ret = lockdownd_start_session(client_loc, host_id, NULL, NULL); |
| 850 | if (LOCKDOWN_E_SUCCESS != ret) { | 850 | if (LOCKDOWN_E_SUCCESS != ret) { |
| 851 | ret = LOCKDOWN_E_SSL_ERROR; | 851 | ret = LOCKDOWN_E_SSL_ERROR; |
| 852 | log_debug_msg("%s: SSL Session opening failed.\n", __func__); | 852 | debug_info("SSL Session opening failed."); |
| 853 | } | 853 | } |
| 854 | 854 | ||
| 855 | if (host_id) { | 855 | if (host_id) { |
| @@ -892,10 +892,10 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, char *host | |||
| 892 | 892 | ||
| 893 | ret = lockdownd_get_device_public_key(client, &public_key); | 893 | ret = lockdownd_get_device_public_key(client, &public_key); |
| 894 | if (ret != LOCKDOWN_E_SUCCESS) { | 894 | if (ret != LOCKDOWN_E_SUCCESS) { |
| 895 | log_debug_msg("%s: device refused to send public key.\n", __func__); | 895 | debug_info("device refused to send public key."); |
| 896 | return ret; | 896 | return ret; |
| 897 | } | 897 | } |
| 898 | log_debug_msg("%s: device public key follows:\n%s\n", __func__, public_key.data); | 898 | debug_info("device public key follows:\n%s", public_key.data); |
| 899 | 899 | ||
| 900 | ret = lockdownd_gen_pair_cert(public_key, &device_cert, &host_cert, &root_cert); | 900 | ret = lockdownd_gen_pair_cert(public_key, &device_cert, &host_cert, &root_cert); |
| 901 | if (ret != LOCKDOWN_E_SUCCESS) { | 901 | if (ret != LOCKDOWN_E_SUCCESS) { |
| @@ -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_debug_msg("%s: %s success\n", __func__, verb); | 947 | debug_info("%s success", 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_debug_msg("%s: %s failure\n", __func__, verb); | 956 | debug_info("%s failure", 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_debug_msg("%s: telling device to enter recovery mode\n", __func__); | 1044 | debug_info("telling device to enter recovery mode"); |
| 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_debug_msg("%s: success\n", __func__); | 1053 | debug_info("success"); |
| 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_debug_msg("%s: called\n", __func__); | 1080 | debug_info("called"); |
| 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_debug_msg("%s: did not get goodbye response back\n", __func__); | 1088 | debug_info("did not get goodbye response back"); |
| 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_debug_msg("%s: success\n", __func__); | 1093 | debug_info("success"); |
| 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_debug_msg("%s: Session startup OK\n", __func__); | 1297 | debug_info("Session startup OK"); |
| 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_debug_msg("%s: SessionID: %s\n", __func__, client->session_id); | 1308 | debug_info("SessionID: %s", 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_debug_msg("%s: Failed to get SessionID!\n", __func__); | 1312 | debug_info("Failed to get SessionID!"); |
| 1313 | } | 1313 | } |
| 1314 | log_debug_msg("%s: Enable SSL Session: %s\n", __func__, (use_ssl?"true":"false")); | 1314 | debug_info("Enable SSL Session: %s", (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_debug_msg("%s: LOCKDOWN_E_PLIST_ERROR\n", __func__); | 1437 | debug_info("LOCKDOWN_E_PLIST_ERROR"); |
| 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_debug_msg("%s: success\n", __func__); | 1443 | debug_info("success"); |
| 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_debug_msg("%s: LOCKDOWN_E_PLIST_ERROR\n", __func__); | 1480 | debug_info("LOCKDOWN_E_PLIST_ERROR"); |
| 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_debug_msg("%s: success\n", __func__); | 1486 | debug_info("success"); |
| 1487 | ret = LOCKDOWN_E_SUCCESS; | 1487 | ret = LOCKDOWN_E_SUCCESS; |
| 1488 | } | 1488 | } |
| 1489 | plist_free(dict); | 1489 | plist_free(dict); |
