summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2010-01-10 23:30:32 +0100
committerGravatar Matt Colyer2010-01-10 19:22:11 -0800
commit53a2b6ae429abc6979e6adab107f24d14c0f5a20 (patch)
treec98332b7043e542f6b53e014b2e84f55f9c916f6
parent69b4015bea6c32e523404e9784c225be8bfc0ef3 (diff)
downloadlibimobiledevice-53a2b6ae429abc6979e6adab107f24d14c0f5a20.tar.gz
libimobiledevice-53a2b6ae429abc6979e6adab107f24d14c0f5a20.tar.bz2
Fix receiving encrypted plists due to missing gnutls_record_read call
[#106 state:resolved] Signed-off-by: Matt Colyer <matt@colyer.name>
-rw-r--r--src/iphone.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/iphone.c b/src/iphone.c
index 3c13859..4a54848 100644
--- a/src/iphone.c
+++ b/src/iphone.c
@@ -403,7 +403,7 @@ static iphone_error_t internal_plist_send(iphone_connection_t connection, plist_
403 iphone_device_send(connection, content, length, (uint32_t*)&bytes); 403 iphone_device_send(connection, content, length, (uint32_t*)&bytes);
404 } 404 }
405 if (bytes > 0) { 405 if (bytes > 0) {
406 log_debug_msg("%s: received %d bytes\n", __func__, bytes); 406 log_debug_msg("%s: sent %d bytes\n", __func__, bytes);
407 log_debug_buffer(content, bytes); 407 log_debug_buffer(content, bytes);
408 if ((uint32_t)bytes == length) { 408 if ((uint32_t)bytes == length) {
409 res = IPHONE_E_SUCCESS; 409 res = IPHONE_E_SUCCESS;
@@ -508,7 +508,11 @@ static iphone_error_t internal_plist_recv_timeout(iphone_connection_t connection
508 return IPHONE_E_INVALID_ARG; 508 return IPHONE_E_INVALID_ARG;
509 } 509 }
510 510
511 iphone_device_recv_timeout(connection, (char*)&pktlen, sizeof(pktlen), &bytes, timeout); 511 if (ssl_session) {
512 bytes = gnutls_record_recv(ssl_session, (char*)&pktlen, sizeof(pktlen));
513 } else {
514 iphone_device_recv_timeout(connection, (char*)&pktlen, sizeof(pktlen), &bytes, timeout);
515 }
512 log_debug_msg("%s: initial read=%i\n", __func__, bytes); 516 log_debug_msg("%s: initial read=%i\n", __func__, bytes);
513 if (bytes < 4) { 517 if (bytes < 4) {
514 log_debug_msg("%s: initial read failed!\n", __func__); 518 log_debug_msg("%s: initial read failed!\n", __func__);
@@ -522,7 +526,11 @@ static iphone_error_t internal_plist_recv_timeout(iphone_connection_t connection
522 content = (char*)malloc(pktlen); 526 content = (char*)malloc(pktlen);
523 527
524 while (curlen < pktlen) { 528 while (curlen < pktlen) {
525 iphone_device_recv(connection, content+curlen, pktlen-curlen, &bytes); 529 if (ssl_session) {
530 bytes = gnutls_record_recv(ssl_session, content+curlen, pktlen-curlen);
531 } else {
532 iphone_device_recv(connection, content+curlen, pktlen-curlen, &bytes);
533 }
526 if (bytes <= 0) { 534 if (bytes <= 0) {
527 res = IPHONE_E_UNKNOWN_ERROR; 535 res = IPHONE_E_UNKNOWN_ERROR;
528 break; 536 break;