summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2009-11-18 20:03:44 +0100
committerGravatar Martin Szulecki2009-11-18 20:03:44 +0100
commitb15705c7b8cf85df53d610bbe5dd34654cdadc6f (patch)
tree057f33e097c4d6ee1538b7f752b5120d0a77bad4
parentfea0152549d5e77f914f75c0ac315f30f9e26426 (diff)
parent91f9e449f7432d8b609d5550a2abae47bb7b9aff (diff)
downloadlibimobiledevice-b15705c7b8cf85df53d610bbe5dd34654cdadc6f.tar.gz
libimobiledevice-b15705c7b8cf85df53d610bbe5dd34654cdadc6f.tar.bz2
Merge branch 'master' of git://github.com/MattColyer/libiphone into martin
-rw-r--r--configure.ac4
-rw-r--r--doxygen.cfg2
-rw-r--r--src/lockdown.c47
-rw-r--r--src/lockdown.h3
-rw-r--r--swig/Makefile.am22
-rw-r--r--swig/__init__.py3
-rw-r--r--swig/iphone.i2
7 files changed, 43 insertions, 40 deletions
diff --git a/configure.ac b/configure.ac
index 58aee42..7c59171 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
-AC_INIT(libiphone, 0.9.4, nospam@nowhere.com)
+AC_INIT(libiphone, 0.9.5, nospam@nowhere.com)
AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
AC_CONFIG_SRCDIR([src/])
@@ -104,4 +104,6 @@ if test "$enable_largefile" != no; then
fi
AC_SUBST(LFS_CFLAGS)
+m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
+
AC_OUTPUT(Makefile src/Makefile include/Makefile fdi/Makefile dev/Makefile tools/Makefile swig/Makefile libiphone-1.0.pc)
diff --git a/doxygen.cfg b/doxygen.cfg
index c51aed7..c411c3d 100644
--- a/doxygen.cfg
+++ b/doxygen.cfg
@@ -31,7 +31,7 @@ PROJECT_NAME = libiphone
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = 0.9.4
+PROJECT_NUMBER = 0.9.5
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
diff --git a/src/lockdown.c b/src/lockdown.c
index 80a89dc..3bfd16f 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -172,12 +172,14 @@ static lockdownd_error_t lockdownd_stop_ssl_session(lockdownd_client_t client)
log_dbg_msg(DBGMASK_LOCKDOWND, "%s: stopping SSL session\n", __func__);
ret = lockdownd_stop_session(client, client->session_id);
log_dbg_msg(DBGMASK_LOCKDOWND, "%s: sending SSL close notify\n", __func__);
- gnutls_bye(*client->ssl_session, GNUTLS_SHUT_RDWR);
+ gnutls_bye(client->ssl_session, GNUTLS_SHUT_RDWR);
}
if (client->ssl_session) {
- gnutls_deinit(*client->ssl_session);
- free(client->ssl_session);
- }
+ gnutls_deinit(client->ssl_session);
+ }
+ if (client->ssl_certificate) {
+ gnutls_certificate_free_credentials(client->ssl_certificate);
+ }
client->in_SSL = 0;
return ret;
@@ -229,7 +231,7 @@ lockdownd_error_t lockdownd_recv(lockdownd_client_t client, plist_t *plist)
if (!client->in_SSL)
ret = iphone_device_recv(client->connection, (char *) &datalen, sizeof(datalen), &bytes);
else {
- ssize_t res = gnutls_record_recv(*client->ssl_session, &datalen, sizeof(datalen));
+ ssize_t res = gnutls_record_recv(client->ssl_session, &datalen, sizeof(datalen));
if (res < 0) {
log_dbg_msg(DBGMASK_LOCKDOWND, "gnutls_record_recv: Error occured: %s\n", gnutls_strerror(res));
return LOCKDOWN_E_SSL_ERROR;
@@ -252,7 +254,7 @@ lockdownd_error_t lockdownd_recv(lockdownd_client_t client, plist_t *plist)
} else {
ssize_t res = 0;
while ((received_bytes < datalen) && (ret == LOCKDOWN_E_SUCCESS)) {
- res = gnutls_record_recv(*client->ssl_session, receive + received_bytes, datalen - received_bytes);
+ 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 = LOCKDOWN_E_SSL_ERROR;
@@ -316,7 +318,7 @@ lockdownd_error_t lockdownd_send(lockdownd_client_t client, plist_t plist)
if (!client->in_SSL)
ret = iphone_device_send(client->connection, real_query, ntohl(length) + sizeof(length), (uint32_t*)&bytes);
else {
- ssize_t res = gnutls_record_send(*client->ssl_session, real_query, ntohl(length) + sizeof(length));
+ ssize_t res = gnutls_record_send(client->ssl_session, real_query, ntohl(length) + sizeof(length));
if (res < 0) {
log_dbg_msg(DBGMASK_LOCKDOWND, "gnutls_record_send: Error occured: %s\n", gnutls_strerror(res));
ret = LOCKDOWN_E_SSL_ERROR;
@@ -637,7 +639,7 @@ lockdownd_error_t lockdownd_client_new(iphone_device_t device, lockdownd_client_
lockdownd_client_t client_loc = (lockdownd_client_t) malloc(sizeof(struct lockdownd_client_int));
client_loc->connection = connection;
- client_loc->ssl_session = (gnutls_session_t *) malloc(sizeof(gnutls_session_t));
+ client_loc->ssl_session = NULL;
client_loc->in_SSL = 0;
if (LOCKDOWN_E_SUCCESS != lockdownd_query_type(client_loc)) {
@@ -1037,16 +1039,13 @@ lockdownd_error_t lockdownd_start_ssl_session(lockdownd_client_t client, const c
ret = LOCKDOWN_E_SSL_ERROR;
if (lockdown_check_result(dict, "StartSession") == RESULT_SUCCESS) {
// Set up GnuTLS...
- //gnutls_anon_client_credentials_t anoncred;
- gnutls_certificate_credentials_t xcred;
-
log_dbg_msg(DBGMASK_LOCKDOWND, "%s: started the session OK, now trying GnuTLS\n", __func__);
errno = 0;
gnutls_global_init();
//gnutls_anon_allocate_client_credentials(&anoncred);
- gnutls_certificate_allocate_credentials(&xcred);
- gnutls_certificate_set_x509_trust_file(xcred, "hostcert.pem", GNUTLS_X509_FMT_PEM);
- gnutls_init(client->ssl_session, GNUTLS_CLIENT);
+ gnutls_certificate_allocate_credentials(&client->ssl_certificate);
+ gnutls_certificate_set_x509_trust_file(client->ssl_certificate, "hostcert.pem", GNUTLS_X509_FMT_PEM);
+ gnutls_init(&client->ssl_session, GNUTLS_CLIENT);
{
int protocol_priority[16] = { GNUTLS_SSL3, 0 };
int kx_priority[16] = { GNUTLS_KX_ANON_DH, GNUTLS_KX_RSA, 0 };
@@ -1054,24 +1053,24 @@ lockdownd_error_t lockdownd_start_ssl_session(lockdownd_client_t client, const c
int mac_priority[16] = { GNUTLS_MAC_SHA1, GNUTLS_MAC_MD5, 0 };
int comp_priority[16] = { GNUTLS_COMP_NULL, 0 };
- gnutls_cipher_set_priority(*client->ssl_session, cipher_priority);
- gnutls_compression_set_priority(*client->ssl_session, comp_priority);
- gnutls_kx_set_priority(*client->ssl_session, kx_priority);
- gnutls_protocol_set_priority(*client->ssl_session, protocol_priority);
- gnutls_mac_set_priority(*client->ssl_session, mac_priority);
+ gnutls_cipher_set_priority(client->ssl_session, cipher_priority);
+ gnutls_compression_set_priority(client->ssl_session, comp_priority);
+ gnutls_kx_set_priority(client->ssl_session, kx_priority);
+ gnutls_protocol_set_priority(client->ssl_session, protocol_priority);
+ gnutls_mac_set_priority(client->ssl_session, mac_priority);
}
- gnutls_credentials_set(*client->ssl_session, GNUTLS_CRD_CERTIFICATE, xcred); // this part is killing me.
+ gnutls_credentials_set(client->ssl_session, GNUTLS_CRD_CERTIFICATE, client->ssl_certificate); // this part is killing me.
log_dbg_msg(DBGMASK_LOCKDOWND, "%s: GnuTLS step 1...\n", __func__);
- gnutls_transport_set_ptr(*client->ssl_session, (gnutls_transport_ptr_t) client);
+ gnutls_transport_set_ptr(client->ssl_session, (gnutls_transport_ptr_t) client);
log_dbg_msg(DBGMASK_LOCKDOWND, "%s: GnuTLS step 2...\n", __func__);
- gnutls_transport_set_push_function(*client->ssl_session, (gnutls_push_func) & lockdownd_secuwrite);
+ gnutls_transport_set_push_function(client->ssl_session, (gnutls_push_func) & lockdownd_secuwrite);
log_dbg_msg(DBGMASK_LOCKDOWND, "%s: GnuTLS step 3...\n", __func__);
- gnutls_transport_set_pull_function(*client->ssl_session, (gnutls_pull_func) & lockdownd_securead);
+ gnutls_transport_set_pull_function(client->ssl_session, (gnutls_pull_func) & lockdownd_securead);
log_dbg_msg(DBGMASK_LOCKDOWND, "%s: GnuTLS step 4 -- now handshaking...\n", __func__);
if (errno)
log_dbg_msg(DBGMASK_LOCKDOWND, "%s: WARN: errno says %s before handshake!\n", __func__, strerror(errno));
- return_me = gnutls_handshake(*client->ssl_session);
+ return_me = gnutls_handshake(client->ssl_session);
log_dbg_msg(DBGMASK_LOCKDOWND, "%s: GnuTLS handshake done...\n", __func__);
if (return_me != GNUTLS_E_SUCCESS) {
diff --git a/src/lockdown.h b/src/lockdown.h
index 19cf9f2..9312867 100644
--- a/src/lockdown.h
+++ b/src/lockdown.h
@@ -29,7 +29,8 @@
struct lockdownd_client_int {
iphone_connection_t connection;
- gnutls_session_t *ssl_session;
+ gnutls_session_t ssl_session;
+ gnutls_certificate_credentials_t ssl_certificate;
int in_SSL;
char session_id[40];
};
diff --git a/swig/Makefile.am b/swig/Makefile.am
index 0da739b..a38534d 100644
--- a/swig/Makefile.am
+++ b/swig/Makefile.am
@@ -6,25 +6,25 @@ SWIG_SOURCES = iphone.i
CLEANFILES = \
*.pyc \
*.pyo \
- _iPhone.so \
- iPhone.py \
+ _iphone.so \
+ iphone.py \
iphone_wrap.cxx
EXTRA_DIST = \
__init__.py \
- iphone.i
+ iphone.i
swigincludedir =$(includedir)/libiphone/swig
swiginclude_HEADERS = $(SWIG_SOURCES)
-iPhonedir = $(pyexecdir)/libiphone
-iPhone_PYTHON = __init__.py
-nodist_iPhone_PYTHON = iPhone.py
-iPhone_LTLIBRARIES = _iPhone.la
-nodist__iPhone_la_SOURCES = iphone_wrap.cxx $(SWIG_SOURCES)
-_iPhone_la_CFLAGS = $(PYTHON_CPPFLAGS) -I$(top_srcdir)/src
-_iPhone_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS)
-_iPhone_la_LIBADD = $(top_builddir)/src/libiphone.la $(libplistmm_LIBS)
+iphonedir = $(pyexecdir)/iphone
+iphone_PYTHON = __init__.py
+nodist_iphone_PYTHON = iphone.py
+iphone_LTLIBRARIES = _iphone.la
+nodist__iphone_la_SOURCES = iphone_wrap.cxx $(SWIG_SOURCES)
+_iphone_la_CFLAGS = $(PYTHON_CPPFLAGS) -I$(top_srcdir)/src
+_iphone_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS)
+_iphone_la_LIBADD = $(top_builddir)/src/libiphone.la $(libplistmm_LIBS)
iphone_wrap.cxx : $(SWIG_SOURCES)
$(SWIG) $(SWIG_PYTHON_OPT) $(INCLUDES) -I$(top_srcdir)/src -o $@ $<
diff --git a/swig/__init__.py b/swig/__init__.py
index 8d1c8b6..e70dcce 100644
--- a/swig/__init__.py
+++ b/swig/__init__.py
@@ -1 +1,2 @@
-
+# -*- coding: utf-8 -*-
+from iphone import *
diff --git a/swig/iphone.i b/swig/iphone.i
index 6604c63..a0ee509 100644
--- a/swig/iphone.i
+++ b/swig/iphone.i
@@ -1,5 +1,5 @@
/* swig.i */
- %module(package="libiphone") iPhone
+ %module iphone
%feature("autodoc", "1");
%{
/* Includes the header in the wrapper code */