diff options
author | Nikias Bassen | 2013-04-24 03:37:49 +0200 |
---|---|---|
committer | Nikias Bassen | 2013-04-24 03:37:49 +0200 |
commit | ddf0da04e26d634eb459a6d4a0d452d34c62e83b (patch) | |
tree | 444bed0730186906a81fbe8aea0699552ee667c5 /src/limera1n.c | |
parent | e4e25ee2b31b92b78ac65e3b493430c587ca09f3 (diff) | |
download | idevicerestore-ddf0da04e26d634eb459a6d4a0d452d34c62e83b.tar.gz idevicerestore-ddf0da04e26d634eb459a6d4a0d452d34c62e83b.tar.bz2 |
limera1n: verify device mode after sending exploit to check for failure
Diffstat (limited to 'src/limera1n.c')
-rw-r--r-- | src/limera1n.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/limera1n.c b/src/limera1n.c index 0d0edcc..29cb02a 100644 --- a/src/limera1n.c +++ b/src/limera1n.c @@ -28,7 +28,7 @@ #include "limera1n.h" #include "limera1n_payload.h" -int limera1n_exploit(struct irecv_device *device, irecv_client_t client) +int limera1n_exploit(struct irecv_device *device, irecv_client_t *pclient) { irecv_error_t err = IRECV_E_SUCCESS; unsigned int i = 0; @@ -56,6 +56,8 @@ int limera1n_exploit(struct irecv_device *device, irecv_client_t client) shellcode_length = sizeof(limera1n_payload); memcpy(shellcode, limera1n_payload, sizeof(limera1n_payload)); + irecv_client_t client = *pclient; + debug("Resetting device counters\n"); err = irecv_reset_counters(client); if (err != IRECV_E_SUCCESS) { @@ -96,11 +98,15 @@ int limera1n_exploit(struct irecv_device *device, irecv_client_t client) debug("Exploit sent\n"); debug("Reconnecting to device\n"); - client = irecv_reconnect(client, 7); - if (client == NULL) { + *pclient = irecv_reconnect(client, 7); + if (*pclient == NULL) { error("Unable to reconnect\n"); return -1; } + if ((*pclient)->mode != kDfuMode) { + error("Device reconnected in non-DFU mode\n"); + return -1; + } return 0; } |