diff options
| author | 2008-08-10 23:36:33 +0200 | |
|---|---|---|
| committer | 2008-08-11 09:39:06 -0700 | |
| commit | eea922593e61a71d3f231578f1e8c4c7f035ec9c (patch) | |
| tree | 823d5ae4e53be4b83377ab205b1aed94fe06c021 /src/lockdown.c | |
| parent | 323459826aeea8b88872e14af9839a0912a80503 (diff) | |
| download | libimobiledevice-eea922593e61a71d3f231578f1e8c4c7f035ec9c.tar.gz libimobiledevice-eea922593e61a71d3f231578f1e8c4c7f035ec9c.tar.bz2 | |
Fix compilation with gcc 4.3 -Wall -Werror -Wno-pointer-sign
Signed-off-by: Matt Colyer <matt@colyer.name>
Diffstat (limited to 'src/lockdown.c')
| -rw-r--r-- | src/lockdown.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lockdown.c b/src/lockdown.c index 78ab6a9..7f938fb 100644 --- a/src/lockdown.c +++ b/src/lockdown.c | |||
| @@ -23,10 +23,12 @@ | |||
| 23 | #include "iphone.h" | 23 | #include "iphone.h" |
| 24 | #include "lockdown.h" | 24 | #include "lockdown.h" |
| 25 | #include "userpref.h" | 25 | #include "userpref.h" |
| 26 | #include <arpa/inet.h> | ||
| 26 | #include <errno.h> | 27 | #include <errno.h> |
| 27 | #include <string.h> | 28 | #include <string.h> |
| 28 | #include <glib.h> | 29 | #include <glib.h> |
| 29 | #include <libtasn1.h> | 30 | #include <libtasn1.h> |
| 31 | #include <gnutls/x509.h> | ||
| 30 | 32 | ||
| 31 | extern int debug; | 33 | extern int debug; |
| 32 | 34 | ||
| @@ -446,9 +448,12 @@ int lockdownd_gen_pair_cert(char *public_key_b64, char **device_cert_b64, char * | |||
| 446 | /* if everything went well, export in PEM format */ | 448 | /* if everything went well, export in PEM format */ |
| 447 | 449 | ||
| 448 | gnutls_datum_t dev_pem = {NULL, 0}; | 450 | gnutls_datum_t dev_pem = {NULL, 0}; |
| 449 | gnutls_x509_crt_export(dev_cert, GNUTLS_X509_FMT_PEM, NULL, &dev_pem.size); | 451 | size_t crt_size; |
| 452 | gnutls_x509_crt_export(dev_cert, GNUTLS_X509_FMT_PEM, NULL, &crt_size); | ||
| 453 | dev_pem.size = crt_size; | ||
| 450 | dev_pem.data = gnutls_malloc(dev_pem.size); | 454 | dev_pem.data = gnutls_malloc(dev_pem.size); |
| 451 | gnutls_x509_crt_export(dev_cert, GNUTLS_X509_FMT_PEM, dev_pem.data, &dev_pem.size); | 455 | gnutls_x509_crt_export(dev_cert, GNUTLS_X509_FMT_PEM, dev_pem.data, &crt_size); |
| 456 | dev_pem.size = crt_size; | ||
| 452 | 457 | ||
| 453 | /* now encode certificates for output */ | 458 | /* now encode certificates for output */ |
| 454 | *device_cert_b64 = g_base64_encode(dev_pem.data, dev_pem.size); | 459 | *device_cert_b64 = g_base64_encode(dev_pem.data, dev_pem.size); |
| @@ -583,7 +588,7 @@ ssize_t lockdownd_secuwrite(gnutls_transport_ptr_t transport, char *buffer, size | |||
| 583 | lockdownd_client *control; | 588 | lockdownd_client *control; |
| 584 | control = (lockdownd_client*)transport; | 589 | control = (lockdownd_client*)transport; |
| 585 | if (debug) printf("lockdownd_secuwrite() called\n"); | 590 | if (debug) printf("lockdownd_secuwrite() called\n"); |
| 586 | if (debug) printf("pre-send\nlength = %i\n", length); | 591 | if (debug) printf("pre-send\nlength = %zi\n", length); |
| 587 | bytes = mux_send(control->connection, buffer, length); | 592 | bytes = mux_send(control->connection, buffer, length); |
| 588 | if (debug) printf("post-send\nsent %i bytes\n", bytes); | 593 | if (debug) printf("post-send\nsent %i bytes\n", bytes); |
| 589 | if (debug) { | 594 | if (debug) { |
| @@ -602,7 +607,7 @@ ssize_t lockdownd_securead(gnutls_transport_ptr_t transport, char *buffer, size_ | |||
| 602 | char *hackhackhack = NULL; | 607 | char *hackhackhack = NULL; |
| 603 | lockdownd_client *control; | 608 | lockdownd_client *control; |
| 604 | control = (lockdownd_client*)transport; | 609 | control = (lockdownd_client*)transport; |
| 605 | if (debug) printf("lockdownd_securead() called\nlength = %i\n", length); | 610 | if (debug) printf("lockdownd_securead() called\nlength = %zi\n", length); |
| 606 | // Buffering hack! Throw what we've got in our "buffer" into the stream first, then get more. | 611 | // Buffering hack! Throw what we've got in our "buffer" into the stream first, then get more. |
| 607 | if (control->gtls_buffer_hack_len > 0) { | 612 | if (control->gtls_buffer_hack_len > 0) { |
| 608 | if (length > control->gtls_buffer_hack_len) { // If it's asking for more than we got | 613 | if (length > control->gtls_buffer_hack_len) { // If it's asking for more than we got |
| @@ -633,7 +638,7 @@ ssize_t lockdownd_securead(gnutls_transport_ptr_t transport, char *buffer, size_ | |||
| 633 | // End buffering hack! | 638 | // End buffering hack! |
| 634 | char *recv_buffer = (char*)malloc(sizeof(char) * (length * 1000)); // ensuring nothing stupid happens | 639 | char *recv_buffer = (char*)malloc(sizeof(char) * (length * 1000)); // ensuring nothing stupid happens |
| 635 | 640 | ||
| 636 | if (debug) printf("pre-read\nclient wants %i bytes\n", length); | 641 | if (debug) printf("pre-read\nclient wants %zi bytes\n", length); |
| 637 | bytes = mux_recv(control->connection, recv_buffer, (length * 1000)); | 642 | bytes = mux_recv(control->connection, recv_buffer, (length * 1000)); |
| 638 | if (debug) printf("post-read\nwe got %i bytes\n", bytes); | 643 | if (debug) printf("post-read\nwe got %i bytes\n", bytes); |
| 639 | if (debug && bytes < 0) { | 644 | if (debug && bytes < 0) { |
