summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--libiphone-1.0.pc.in2
-rw-r--r--src/lockdown.c20
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)
PKG_CHECK_MODULES(libgnutls, gnutls >= 1.6.3 )
PKG_CHECK_MODULES(libtasn1, libtasn1 >= 1.1)
PKG_CHECK_MODULES(libplist, libplist >= 0.12)
+AC_CHECK_LIB(gcrypt, gcry_control, [AC_SUBST(libgcrypt_LIBS,[-lgcrypt])], ["libgcrypt is required to build libiphone"])
# Checks for header files.
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@
Name: libiphone
Description: A library to communicate with the Lockdown server on the iPhone
Version: @VERSION@
-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
+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
Libs: -L${libdir} -liphone
Cflags: -I${includedir}
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)
}
}
datalen = ntohl(datalen);
+ log_dbg_msg(DBGMASK_LOCKDOWND, "%s: datalen = %d\n", __func__, datalen);
receive = (char *) malloc(sizeof(char) * datalen);
+ /* fill buffer and request more packets if needed */
if (!client->in_SSL) {
- /* fill buffer and request more packets if needed */
while ((received_bytes < datalen) && (ret == IPHONE_E_SUCCESS)) {
ret = usbmuxd_recv(client->sfd, receive + received_bytes, datalen - received_bytes, &bytes);
received_bytes += bytes;
}
} else {
- ssize_t res = gnutls_record_recv(*client->ssl_session, receive, datalen);
- if (res < 0) {
- log_dbg_msg(DBGMASK_LOCKDOWND, "gnutls_record_recv: Error occured: %s\n", gnutls_strerror(res));
- ret = IPHONE_E_SSL_ERROR;
- } else {
- received_bytes = res;
- ret = IPHONE_E_SUCCESS;
+ ssize_t res = 0;
+ while ((received_bytes < datalen) && (ret == IPHONE_E_SUCCESS)) {
+ res = gnutls_record_recv(*client->ssl_session, receive + received_bytes, datalen - received_bytes);
+ if (res < 0) {
+ log_dbg_msg(DBGMASK_LOCKDOWND, "gnutls_record_recv: Error occured: %s\n", gnutls_strerror(res));
+ ret = IPHONE_E_SSL_ERROR;
+ } else {
+ received_bytes += res;
+ ret = IPHONE_E_SUCCESS;
+ }
}
}