diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lockdown.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lockdown.c b/src/lockdown.c index 452ee0e..7cee12e 100644 --- a/src/lockdown.c +++ b/src/lockdown.c @@ -315,18 +315,18 @@ int lockdownd_init(iPhone_t phone, lockdownd_client_t *control) if (!phone) return 0; - *control = new_lockdownd_client(phone); - if (!lockdownd_hello(*control)){ + lockdownd_client *control_loc = new_lockdownd_client( (iPhone*)phone ); + if (!lockdownd_hello(control_loc)){ fprintf(stderr, "Hello failed in the lockdownd client.\n"); } char *uid = NULL; - if(!lockdownd_get_device_uid(*control, &uid)){ + if(!lockdownd_get_device_uid(control_loc, &uid)){ fprintf(stderr, "Device refused to send public key.\n"); } host_id = get_host_id(); - + if (!is_device_known(uid)) ret = lockdownd_pair_device(*control, uid, host_id); else @@ -337,7 +337,8 @@ int lockdownd_init(iPhone_t phone, lockdownd_client_t *control) uid = NULL; } - if (ret && host_id && lockdownd_start_SSL_session(*control, host_id)) { + + if (ret && host_id && lockdownd_start_SSL_session(control_loc, host_id)) { ret = 1; } else { ret = 0; @@ -349,6 +350,8 @@ int lockdownd_init(iPhone_t phone, lockdownd_client_t *control) host_id = NULL; } + *control = (lockdownd_client_t)control_loc; + return ret; } |