summaryrefslogtreecommitdiffstats
path: root/src/lockdown.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lockdown.c')
-rw-r--r--src/lockdown.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/lockdown.c b/src/lockdown.c
index d147f75..b182706 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -971,7 +971,8 @@ lockdownd_error_t lockdownd_gen_pair_cert(gnutls_datum_t public_key, gnutls_datu
971 return ret; 971 return ret;
972} 972}
973 973
974/** Starts SSL communication with lockdownd after the iPhone has been paired. 974/** Starts communication with lockdownd after the iPhone has been paired,
975 * and if the device requires it, switches to SSL mode.
975 * 976 *
976 * @param client The lockdownd client 977 * @param client The lockdownd client
977 * @param HostID The HostID used with this phone 978 * @param HostID The HostID used with this phone
@@ -1038,9 +1039,24 @@ lockdownd_error_t lockdownd_start_ssl_session(lockdownd_client_t client, const c
1038 } 1039 }
1039 1040
1040 ret = LOCKDOWN_E_SSL_ERROR; 1041 ret = LOCKDOWN_E_SSL_ERROR;
1042
1043 int session_ok = 0;
1044 uint8_t UseSSL = 0;
1045
1041 if (lockdown_check_result(dict, "StartSession") == RESULT_SUCCESS) { 1046 if (lockdown_check_result(dict, "StartSession") == RESULT_SUCCESS) {
1047 plist_t enable_ssl = plist_dict_get_item(dict, "EnableSessionSSL");
1048 if (enable_ssl && (plist_get_node_type(enable_ssl) == PLIST_BOOLEAN)) {
1049 plist_get_bool_val(enable_ssl, &UseSSL);
1050 }
1051 log_dbg_msg(DBGMASK_LOCKDOWND, "%s: Session startup OK\n", __func__);
1052 session_ok = 1;
1053 }
1054 if (session_ok && !UseSSL) {
1055 client->in_SSL = 0;
1056 ret = LOCKDOWN_E_SUCCESS;
1057 } else if (session_ok) {
1042 // Set up GnuTLS... 1058 // Set up GnuTLS...
1043 log_dbg_msg(DBGMASK_LOCKDOWND, "%s: started the session OK, now trying GnuTLS\n", __func__); 1059 log_dbg_msg(DBGMASK_LOCKDOWND, "%s: Switching to SSL mode\n", __func__);
1044 errno = 0; 1060 errno = 0;
1045 gnutls_global_init(); 1061 gnutls_global_init();
1046 //gnutls_anon_allocate_client_credentials(&anoncred); 1062 //gnutls_anon_allocate_client_credentials(&anoncred);