From 1ccc8762a6564348b775a5038c16b3566114f2eb Mon Sep 17 00:00:00 2001 From: Jonathan Beck Date: Wed, 11 Nov 2009 22:07:28 +0100 Subject: Simplify 'libiphone.iPhone' module to 'iphone' --- swig/Makefile.am | 24 ++++++++++++------------ swig/__init__.py | 3 ++- swig/iphone.i | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/swig/Makefile.am b/swig/Makefile.am index 0da739b..580158d 100644 --- a/swig/Makefile.am +++ b/swig/Makefile.am @@ -6,26 +6,26 @@ 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 $@ $< + $(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 */ -- cgit v1.1-32-gdbae From 3ac7fb460c495d34fc02364b2ff7e56456a1a50f Mon Sep 17 00:00:00 2001 From: Matt Colyer Date: Mon, 16 Nov 2009 08:22:52 -0800 Subject: Preparing for release 0.9.5 --- configure.ac | 2 +- doxygen.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 58aee42..30a8112 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/]) 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. -- cgit v1.1-32-gdbae From c56382f15ec52925219daddd10d2a4cefb4fa166 Mon Sep 17 00:00:00 2001 From: Matt Colyer Date: Tue, 17 Nov 2009 19:21:13 -0800 Subject: Fix spaces that should be tabs. --- swig/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swig/Makefile.am b/swig/Makefile.am index 580158d..a38534d 100644 --- a/swig/Makefile.am +++ b/swig/Makefile.am @@ -27,5 +27,5 @@ _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 $@ $< + $(SWIG) $(SWIG_PYTHON_OPT) $(INCLUDES) -I$(top_srcdir)/src -o $@ $< -- cgit v1.1-32-gdbae From e3b6f3237efae9de0412573ae056b33e0ba48137 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Tue, 17 Nov 2009 21:46:48 +0100 Subject: don't leak memory allocated for gnutls credentials --- src/lockdown.c | 12 ++++++------ src/lockdown.h | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lockdown.c b/src/lockdown.c index 80a89dc..b69fab7 100644 --- a/src/lockdown.c +++ b/src/lockdown.c @@ -178,6 +178,9 @@ static lockdownd_error_t lockdownd_stop_ssl_session(lockdownd_client_t client) gnutls_deinit(*client->ssl_session); free(client->ssl_session); } + if (client->ssl_certificate) { + gnutls_certificate_free_credentials(client->ssl_certificate); + } client->in_SSL = 0; return ret; @@ -1037,15 +1040,12 @@ 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_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 }; @@ -1060,7 +1060,7 @@ lockdownd_error_t lockdownd_start_ssl_session(lockdownd_client_t client, const c 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); diff --git a/src/lockdown.h b/src/lockdown.h index 19cf9f2..5223fbe 100644 --- a/src/lockdown.h +++ b/src/lockdown.h @@ -30,6 +30,7 @@ struct lockdownd_client_int { iphone_connection_t connection; gnutls_session_t *ssl_session; + gnutls_certificate_credentials_t ssl_certificate; int in_SSL; char session_id[40]; }; -- cgit v1.1-32-gdbae From 2d064e04204dc57ba826b0e9ecf83bcd494d008f Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Tue, 17 Nov 2009 21:51:41 +0100 Subject: simplify gnutls_session_t use gnutls_session_t is already a pointer, we don't need to manipulate a gnutls_session_t* [#87 state:resolved] Signed-off-by: Matt Colyer --- src/lockdown.c | 37 ++++++++++++++++++------------------- src/lockdown.h | 2 +- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/lockdown.c b/src/lockdown.c index b69fab7..3bfd16f 100644 --- a/src/lockdown.c +++ b/src/lockdown.c @@ -172,12 +172,11 @@ 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); } @@ -232,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; @@ -255,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; @@ -319,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; @@ -640,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)) { @@ -1046,7 +1045,7 @@ lockdownd_error_t lockdownd_start_ssl_session(lockdownd_client_t client, const c //gnutls_anon_allocate_client_credentials(&anoncred); 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); + 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, client->ssl_certificate); // 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 5223fbe..9312867 100644 --- a/src/lockdown.h +++ b/src/lockdown.h @@ -29,7 +29,7 @@ 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]; -- cgit v1.1-32-gdbae From 91f9e449f7432d8b609d5550a2abae47bb7b9aff Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Tue, 17 Nov 2009 01:58:51 +0100 Subject: silence building output for better overview --- configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index 30a8112..7c59171 100644 --- a/configure.ac +++ b/configure.ac @@ -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) -- cgit v1.1-32-gdbae