diff options
| -rw-r--r-- | configure.ac | 1 | ||||
| -rw-r--r-- | libiphone-1.0.pc.in | 2 | ||||
| -rw-r--r-- | src/lockdown.c | 20 |
3 files changed, 14 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac index 50c7d1b..62023c7 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -26,6 +26,7 @@ PKG_CHECK_MODULES(libgthread2, gthread-2.0 >= 2.14.1) | |||
| 26 | PKG_CHECK_MODULES(libgnutls, gnutls >= 1.6.3 ) | 26 | PKG_CHECK_MODULES(libgnutls, gnutls >= 1.6.3 ) |
| 27 | PKG_CHECK_MODULES(libtasn1, libtasn1 >= 1.1) | 27 | PKG_CHECK_MODULES(libtasn1, libtasn1 >= 1.1) |
| 28 | PKG_CHECK_MODULES(libplist, libplist >= 0.12) | 28 | PKG_CHECK_MODULES(libplist, libplist >= 0.12) |
| 29 | AC_CHECK_LIB(gcrypt, gcry_control, [AC_SUBST(libgcrypt_LIBS,[-lgcrypt])], ["libgcrypt is required to build libiphone"]) | ||
| 29 | 30 | ||
| 30 | # Checks for header files. | 31 | # Checks for header files. |
| 31 | AC_HEADER_STDC | 32 | AC_HEADER_STDC |
diff --git a/libiphone-1.0.pc.in b/libiphone-1.0.pc.in index 562cf56..323a73d 100644 --- a/libiphone-1.0.pc.in +++ b/libiphone-1.0.pc.in | |||
| @@ -6,7 +6,7 @@ includedir=@includedir@ | |||
| 6 | Name: libiphone | 6 | Name: libiphone |
| 7 | Description: A library to communicate with the Lockdown server on the iPhone | 7 | Description: A library to communicate with the Lockdown server on the iPhone |
| 8 | Version: @VERSION@ | 8 | Version: @VERSION@ |
| 9 | Requires: libplist >= 0.12 libusb >= 0.1.12 glib-2.0 >= 2.14.1 gthread-2.0 >= 2.14.1 gnutls >= 1.6.3 libtasn1 >= 1.1 | 9 | Requires: libplist >= 0.12 libusbmuxd >= 0.1.0 glib-2.0 >= 2.14.1 gthread-2.0 >= 2.14.1 gnutls >= 1.6.3 libtasn1 >= 1.1 |
| 10 | Libs: -L${libdir} -liphone | 10 | Libs: -L${libdir} -liphone |
| 11 | Cflags: -I${includedir} | 11 | Cflags: -I${includedir} |
| 12 | 12 | ||
diff --git a/src/lockdown.c b/src/lockdown.c index ae408be..a950ceb 100644 --- a/src/lockdown.c +++ b/src/lockdown.c | |||
| @@ -211,23 +211,27 @@ iphone_error_t iphone_lckd_recv(iphone_lckd_client_t client, plist_t * plist) | |||
| 211 | } | 211 | } |
| 212 | } | 212 | } |
| 213 | datalen = ntohl(datalen); | 213 | datalen = ntohl(datalen); |
| 214 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: datalen = %d\n", __func__, datalen); | ||
| 214 | 215 | ||
| 215 | receive = (char *) malloc(sizeof(char) * datalen); | 216 | receive = (char *) malloc(sizeof(char) * datalen); |
| 216 | 217 | ||
| 218 | /* fill buffer and request more packets if needed */ | ||
| 217 | if (!client->in_SSL) { | 219 | if (!client->in_SSL) { |
| 218 | /* fill buffer and request more packets if needed */ | ||
| 219 | while ((received_bytes < datalen) && (ret == IPHONE_E_SUCCESS)) { | 220 | while ((received_bytes < datalen) && (ret == IPHONE_E_SUCCESS)) { |
| 220 | ret = usbmuxd_recv(client->sfd, receive + received_bytes, datalen - received_bytes, &bytes); | 221 | ret = usbmuxd_recv(client->sfd, receive + received_bytes, datalen - received_bytes, &bytes); |
| 221 | received_bytes += bytes; | 222 | received_bytes += bytes; |
| 222 | } | 223 | } |
| 223 | } else { | 224 | } else { |
| 224 | ssize_t res = gnutls_record_recv(*client->ssl_session, receive, datalen); | 225 | ssize_t res = 0; |
| 225 | if (res < 0) { | 226 | while ((received_bytes < datalen) && (ret == IPHONE_E_SUCCESS)) { |
| 226 | log_dbg_msg(DBGMASK_LOCKDOWND, "gnutls_record_recv: Error occured: %s\n", gnutls_strerror(res)); | 227 | res = gnutls_record_recv(*client->ssl_session, receive + received_bytes, datalen - received_bytes); |
| 227 | ret = IPHONE_E_SSL_ERROR; | 228 | if (res < 0) { |
| 228 | } else { | 229 | log_dbg_msg(DBGMASK_LOCKDOWND, "gnutls_record_recv: Error occured: %s\n", gnutls_strerror(res)); |
| 229 | received_bytes = res; | 230 | ret = IPHONE_E_SSL_ERROR; |
| 230 | ret = IPHONE_E_SUCCESS; | 231 | } else { |
| 232 | received_bytes += res; | ||
| 233 | ret = IPHONE_E_SUCCESS; | ||
| 234 | } | ||
| 231 | } | 235 | } |
| 232 | } | 236 | } |
| 233 | 237 | ||
