summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml5
-rw-r--r--3rd_party/libsrp6a-sha512/Makefile.am2
-rw-r--r--3rd_party/libsrp6a-sha512/t_math.c5
-rw-r--r--docs/idevicedebugserverproxy.13
-rwxr-xr-xgit-version-gen2
-rw-r--r--src/lockdown-cu.c3
-rw-r--r--src/restore.c2
-rw-r--r--tools/idevicedebugserverproxy.c33
8 files changed, 46 insertions, 9 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 5302c01..7aee501 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,6 +1,9 @@
name: build
-on: [push]
+on:
+ push:
+ schedule:
+ - cron: '0 0 1 * *'
jobs:
build-linux-ubuntu:
diff --git a/3rd_party/libsrp6a-sha512/Makefile.am b/3rd_party/libsrp6a-sha512/Makefile.am
index 8c6e2f5..d304585 100644
--- a/3rd_party/libsrp6a-sha512/Makefile.am
+++ b/3rd_party/libsrp6a-sha512/Makefile.am
@@ -9,7 +9,7 @@ include_HEADERS = srp.h srp_aux.h cstr.h
AM_CFLAGS = -DHAVE_CONFIG_H
if HAVE_OPENSSL
-AM_CFLAGS += -DOPENSSL=1 -DOPENSSL_ENGINE=1 $(openssl_CFLAGS)
+AM_CFLAGS += -DOPENSSL=1 $(openssl_CFLAGS)
else
if HAVE_GCRYPT
AM_CFLAGS += -DGCRYPT=1 $(libgcrypt_CFLAGS)
diff --git a/3rd_party/libsrp6a-sha512/t_math.c b/3rd_party/libsrp6a-sha512/t_math.c
index 88ae12f..e655daa 100644
--- a/3rd_party/libsrp6a-sha512/t_math.c
+++ b/3rd_party/libsrp6a-sha512/t_math.c
@@ -39,7 +39,8 @@ typedef BIGNUM * BigInteger;
typedef BN_CTX * BigIntegerCtx;
typedef BN_MONT_CTX * BigIntegerModAccel;
#include <limits.h>
-# ifdef OPENSSL_ENGINE
+# ifndef OPENSSL_NO_ENGINE
+# define OPENSSL_ENGINE
# include "openssl/engine.h"
static ENGINE * default_engine = NULL;
# endif /* OPENSSL_ENGINE */
@@ -951,7 +952,7 @@ BigIntegerModAccelFree(accel)
BigIntegerResult
BigIntegerInitialize()
{
-#if OPENSSL_VERSION_NUMBER >= 0x00907000
+#if OPENSSL_VERSION_NUMBER >= 0x00907000 && defined(OPENSSL_ENGINE)
ENGINE_load_builtin_engines();
#endif
return BIG_INTEGER_SUCCESS;
diff --git a/docs/idevicedebugserverproxy.1 b/docs/idevicedebugserverproxy.1
index 248c694..69200ee 100644
--- a/docs/idevicedebugserverproxy.1
+++ b/docs/idevicedebugserverproxy.1
@@ -22,6 +22,9 @@ target specific device by UDID.
.B \-n, \-\-network
connect to network device.
.TP
+.B \-l, \-\-lldb
+Enable lldb support.
+.TP
.B \-d, \-\-debug
enable communication debugging.
.TP
diff --git a/git-version-gen b/git-version-gen
index 3eb6a42..f6cb31c 100755
--- a/git-version-gen
+++ b/git-version-gen
@@ -3,7 +3,7 @@ SRCDIR=`dirname $0`
if test -n "$1"; then
VER=$1
else
- if test -d "${SRCDIR}/.git" && test -x "`which git`" ; then
+ if test -r "${SRCDIR}/.git" && test -x "`which git`" ; then
git update-index -q --refresh
if ! VER=`git describe --tags --dirty 2>/dev/null`; then
COMMIT=`git rev-parse --short HEAD`
diff --git a/src/lockdown-cu.c b/src/lockdown-cu.c
index cdaf02c..61a1c03 100644
--- a/src/lockdown-cu.c
+++ b/src/lockdown-cu.c
@@ -62,6 +62,7 @@
#include <sys/sysctl.h>
#include <SystemConfiguration/SystemConfiguration.h>
#include <CoreFoundation/CoreFoundation.h>
+#include <TargetConditionals.h>
#endif
#include "property_list_service.h"
@@ -647,7 +648,7 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_cu_pairing_create(lockdownd_cli
/* HOST INFORMATION */
char hostname[256];
-#ifdef __APPLE__
+#if defined(__APPLE__) && !defined(TARGET_OS_IPHONE)
CFStringRef cname = SCDynamicStoreCopyComputerName(NULL, NULL);
CFStringGetCString(cname, hostname, sizeof(hostname), kCFStringEncodingUTF8);
CFRelease(cname);
diff --git a/src/restore.c b/src/restore.c
index 591fd16..41bfb9d 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -287,7 +287,7 @@ LIBIMOBILEDEVICE_API restored_error_t restored_get_value(restored_client_t clien
}
*value = plist_copy(item);
- free(item);
+
return RESTORE_E_SUCCESS;
}
diff --git a/tools/idevicedebugserverproxy.c b/tools/idevicedebugserverproxy.c
index 8a3b4ff..9fe7051 100644
--- a/tools/idevicedebugserverproxy.c
+++ b/tools/idevicedebugserverproxy.c
@@ -52,8 +52,10 @@
#define info(...) fprintf(stdout, __VA_ARGS__); fflush(stdout)
#define debug(...) if(debug_mode) fprintf(stdout, __VA_ARGS__)
+static int support_lldb = 0;
static int debug_mode = 0;
static int quit_flag = 0;
+static uint16_t local_port = 0;
typedef struct {
int client_fd;
@@ -90,6 +92,7 @@ static void print_usage(int argc, char **argv, int is_error)
" -u, --udid UDID target specific device by UDID\n"
" -n, --network connect to network device\n"
" -d, --debug enable communication debugging\n"
+ " -l, --lldb enable lldb support\n"
" -h, --help prints usage information\n"
" -v, --version prints version information\n"
"\n"
@@ -98,6 +101,26 @@ static void print_usage(int argc, char **argv, int is_error)
);
}
+static int intercept_packet(char *packet, ssize_t *packet_len) {
+ static const char kReqLaunchServer[] = "$qLaunchGDBServer;#4b";
+
+ char buffer[64] = {0};
+ if (*packet_len == (ssize_t)(sizeof(kReqLaunchServer) - 1)
+ && memcmp(packet, kReqLaunchServer, sizeof(kReqLaunchServer) - 1) == 0) {
+ sprintf(buffer, "port:%d;", local_port);
+ } else {
+ return 0;
+ }
+ int sum = 0;
+ for (size_t i = 0; i < strlen(buffer); i++) {
+ sum += buffer[i];
+ }
+ sum = sum & 255;
+ sprintf(packet, "$%s#%02x", buffer, sum);
+ *packet_len = strlen(packet);
+ return 1;
+}
+
static void* connection_handler(void* data)
{
debugserver_error_t derr = DEBUGSERVER_E_SUCCESS;
@@ -137,7 +160,10 @@ static void* connection_handler(void* data)
fprintf(stderr, "connection closed\n");
break;
}
-
+ if (support_lldb && intercept_packet(buf, &n)) {
+ socket_send(client_fd, buf, n);
+ continue;
+ }
uint32_t sent = 0;
debugserver_client_send(socket_info->debugserver_client, buf, n, &sent);
}
@@ -180,7 +206,6 @@ int main(int argc, char *argv[])
thread_info_t *thread_list = NULL;
const char* udid = NULL;
int use_network = 0;
- uint16_t local_port = 0;
int server_fd;
int result = EXIT_SUCCESS;
int c = 0;
@@ -189,6 +214,7 @@ int main(int argc, char *argv[])
{ "help", no_argument, NULL, 'h' },
{ "udid", required_argument, NULL, 'u' },
{ "network", no_argument, NULL, 'n' },
+ { "lldb", no_argument, NULL, 'l' },
{ "version", no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0}
};
@@ -234,6 +260,9 @@ int main(int argc, char *argv[])
case 'n':
use_network = 1;
break;
+ case 'l':
+ support_lldb = 1;
+ break;
case 'h':
print_usage(argc, argv, 0);
return 0;