summaryrefslogtreecommitdiffstats
path: root/src/lockdown.c
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2008-08-25 23:50:22 +0200
committerGravatar Jonathan Beck2008-08-31 19:33:18 +0200
commite52da6fe75008174a254254ec83394766afb624b (patch)
tree9ad8cd860525a3340dd49e2dbc8cd685dcf1ca7e /src/lockdown.c
parent6ac4ceb4c6ee63c279f4841381a3eb09598f3517 (diff)
downloadlibimobiledevice-e52da6fe75008174a254254ec83394766afb624b.tar.gz
libimobiledevice-e52da6fe75008174a254254ec83394766afb624b.tar.bz2
make it compile
Diffstat (limited to 'src/lockdown.c')
-rw-r--r--src/lockdown.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/lockdown.c b/src/lockdown.c
index 4950a9e..d30d6e0 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -97,7 +97,7 @@ iphone_lckd_client_t new_lockdownd_client(iphone_device_t phone) {
97void iphone_lckd_free_client( iphone_lckd_client_t client ) { 97void iphone_lckd_free_client( iphone_lckd_client_t client ) {
98 if (!client) return; 98 if (!client) return;
99 if (client->connection) { 99 if (client->connection) {
100 mux_close_connection(client->connection); 100 iphone_mux_free_client(client->connection);
101 } 101 }
102 102
103 if (client->ssl_session) gnutls_deinit(*client->ssl_session); 103 if (client->ssl_session) gnutls_deinit(*client->ssl_session);
@@ -118,12 +118,12 @@ int iphone_lckd_recv ( iphone_lckd_client_t client, char **dump_data ) {
118 char *receive; 118 char *receive;
119 uint32 datalen = 0, bytes = 0; 119 uint32 datalen = 0, bytes = 0;
120 120
121 if (!client->in_SSL) bytes = mux_recv(client->connection, (char *)&datalen, sizeof(datalen)); 121 if (!client->in_SSL) bytes = iphone_mux_recv(client->connection, (char *)&datalen, sizeof(datalen));
122 else bytes = gnutls_record_recv(*client->ssl_session, &datalen, sizeof(datalen)); 122 else bytes = gnutls_record_recv(*client->ssl_session, &datalen, sizeof(datalen));
123 datalen = ntohl(datalen); 123 datalen = ntohl(datalen);
124 124
125 receive = (char*)malloc(sizeof(char) * datalen); 125 receive = (char*)malloc(sizeof(char) * datalen);
126 if (!client->in_SSL) bytes = mux_recv(client->connection, receive, datalen); 126 if (!client->in_SSL) bytes = iphone_mux_recv(client->connection, receive, datalen);
127 else bytes = gnutls_record_recv(*client->ssl_session, receive, datalen); 127 else bytes = gnutls_record_recv(*client->ssl_session, receive, datalen);
128 *dump_data = receive; 128 *dump_data = receive;
129 return bytes; 129 return bytes;
@@ -157,7 +157,7 @@ int iphone_lckd_send ( iphone_lckd_client_t client, char *raw_data, uint32_t len
157 packet = NULL; 157 packet = NULL;
158 } 158 }
159 159
160 if (!client->in_SSL) bytes = mux_send(client->connection, real_query, ntohl(length)+sizeof(length)); 160 if (!client->in_SSL) bytes = iphone_mux_send(client->connection, real_query, ntohl(length)+sizeof(length));
161 else gnutls_record_send(*client->ssl_session, real_query, ntohl(length)+sizeof(length)); 161 else gnutls_record_send(*client->ssl_session, real_query, ntohl(length)+sizeof(length));
162 if (debug) printf("lockdownd_send(): sent it!\n"); 162 if (debug) printf("lockdownd_send(): sent it!\n");
163 free(real_query); 163 free(real_query);
@@ -186,11 +186,11 @@ int lockdownd_hello(iphone_lckd_client_t control) {
186 uint32 length; 186 uint32 length;
187 187
188 xmlDocDumpMemory(plist, (xmlChar **)&XML_content, &length); 188 xmlDocDumpMemory(plist, (xmlChar **)&XML_content, &length);
189 bytes = lockdownd_send(control, XML_content, length); 189 bytes = iphone_lckd_send(control, XML_content, length);
190 190
191 xmlFree(XML_content); 191 xmlFree(XML_content);
192 xmlFreeDoc(plist); plist = NULL; 192 xmlFreeDoc(plist); plist = NULL;
193 bytes = lockdownd_recv(control, &XML_content); 193 bytes = iphone_lckd_recv(control, &XML_content);
194 194
195 plist = xmlReadMemory(XML_content, bytes, NULL, NULL, 0); 195 plist = xmlReadMemory(XML_content, bytes, NULL, NULL, 0);
196 if (!plist) return 0; 196 if (!plist) return 0;
@@ -240,13 +240,13 @@ int lockdownd_generic_get_value(iphone_lckd_client_t control, char *req_key, cha
240 xmlDocDumpMemory(plist, (xmlChar**)&XML_content, &length); 240 xmlDocDumpMemory(plist, (xmlChar**)&XML_content, &length);
241 241
242 /* send to iPhone */ 242 /* send to iPhone */
243 bytes = lockdownd_send(control, XML_content, length); 243 bytes = iphone_lckd_send(control, XML_content, length);
244 244
245 xmlFree(XML_content); 245 xmlFree(XML_content);
246 xmlFreeDoc(plist); plist = NULL; 246 xmlFreeDoc(plist); plist = NULL;
247 247
248 /* Now get iPhone's answer */ 248 /* Now get iPhone's answer */
249 bytes = lockdownd_recv(control, &XML_content); 249 bytes = iphone_lckd_recv(control, &XML_content);
250 250
251 plist = xmlReadMemory(XML_content, bytes, NULL, NULL, 0); 251 plist = xmlReadMemory(XML_content, bytes, NULL, NULL, 0);
252 if (!plist) return 0; 252 if (!plist) return 0;
@@ -407,13 +407,13 @@ int lockdownd_pair_device(iphone_lckd_client_t control, char *uid, char *host_id
407 printf("XML Pairing request : %s\n",XML_content); 407 printf("XML Pairing request : %s\n",XML_content);
408 408
409 /* send to iPhone */ 409 /* send to iPhone */
410 bytes = lockdownd_send(control, XML_content, length); 410 bytes = iphone_lckd_send(control, XML_content, length);
411 411
412 xmlFree(XML_content); 412 xmlFree(XML_content);
413 xmlFreeDoc(plist); plist = NULL; 413 xmlFreeDoc(plist); plist = NULL;
414 414
415 /* Now get iPhone's answer */ 415 /* Now get iPhone's answer */
416 bytes = lockdownd_recv(control, &XML_content); 416 bytes = iphone_lckd_recv(control, &XML_content);
417 417
418 if (debug) { 418 if (debug) {
419 printf("lockdown_pair_device: iPhone's response to our pair request:\n"); 419 printf("lockdown_pair_device: iPhone's response to our pair request:\n");
@@ -621,13 +621,13 @@ int lockdownd_start_SSL_session(iphone_lckd_client_t control, const char *HostID
621 } 621 }
622 622
623 xmlDocDumpMemory(plist, (xmlChar **)&what2send, &len); 623 xmlDocDumpMemory(plist, (xmlChar **)&what2send, &len);
624 bytes = lockdownd_send(control, what2send, len); 624 bytes = iphone_lckd_send(control, what2send, len);
625 625
626 xmlFree(what2send); 626 xmlFree(what2send);
627 xmlFreeDoc(plist); 627 xmlFreeDoc(plist);
628 628
629 if (bytes > 0) { 629 if (bytes > 0) {
630 len = lockdownd_recv(control, &what2send); 630 len = iphone_lckd_recv(control, &what2send);
631 plist = xmlReadMemory(what2send, len, NULL, NULL, 0); 631 plist = xmlReadMemory(what2send, len, NULL, NULL, 0);
632 dict = xmlDocGetRootElement(plist); 632 dict = xmlDocGetRootElement(plist);
633 for (dict = dict->children; dict; dict = dict->next) { 633 for (dict = dict->children; dict; dict = dict->next) {
@@ -721,7 +721,7 @@ ssize_t lockdownd_secuwrite(gnutls_transport_ptr_t transport, char *buffer, size
721 control = (iphone_lckd_client_t)transport; 721 control = (iphone_lckd_client_t)transport;
722 if (debug) printf("lockdownd_secuwrite() called\n"); 722 if (debug) printf("lockdownd_secuwrite() called\n");
723 if (debug) printf("pre-send\nlength = %zi\n", length); 723 if (debug) printf("pre-send\nlength = %zi\n", length);
724 bytes = mux_send(control->connection, buffer, length); 724 bytes = iphone_mux_send(control->connection, buffer, length);
725 if (debug) printf("post-send\nsent %i bytes\n", bytes); 725 if (debug) printf("post-send\nsent %i bytes\n", bytes);
726 if (debug) { 726 if (debug) {
727 FILE *my_ssl_packet = fopen("sslpacketwrite.out", "w+"); 727 FILE *my_ssl_packet = fopen("sslpacketwrite.out", "w+");
@@ -779,7 +779,7 @@ ssize_t lockdownd_securead(gnutls_transport_ptr_t transport, char *buffer, size_
779 char *recv_buffer = (char*)malloc(sizeof(char) * (length * 1000)); // ensuring nothing stupid happens 779 char *recv_buffer = (char*)malloc(sizeof(char) * (length * 1000)); // ensuring nothing stupid happens
780 780
781 if (debug) printf("pre-read\nclient wants %zi bytes\n", length); 781 if (debug) printf("pre-read\nclient wants %zi bytes\n", length);
782 bytes = mux_recv(control->connection, recv_buffer, (length * 1000)); 782 bytes = iphone_mux_recv(control->connection, recv_buffer, (length * 1000));
783 if (debug) printf("post-read\nwe got %i bytes\n", bytes); 783 if (debug) printf("post-read\nwe got %i bytes\n", bytes);
784 if (debug && bytes < 0) { 784 if (debug && bytes < 0) {
785 printf("lockdownd_securead(): uh oh\n"); 785 printf("lockdownd_securead(): uh oh\n");
@@ -838,10 +838,10 @@ int iphone_lckd_start_service ( iphone_lckd_client_t client, const char *service
838 838
839 xmlDocDumpMemory(plist, (xmlChar **)&XML_query, &length); 839 xmlDocDumpMemory(plist, (xmlChar **)&XML_query, &length);
840 840
841 lockdownd_send(client, XML_query, length); 841 iphone_lckd_send(client, XML_query, length);
842 free(XML_query); 842 free(XML_query);
843 843
844 length = lockdownd_recv(client, &XML_query); 844 length = iphone_lckd_recv(client, &XML_query);
845 845
846 xmlFreeDoc(plist); 846 xmlFreeDoc(plist);
847 847