From 2de826110c85feb68d6e5b09c133e2300ae4c0d0 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Sun, 29 Sep 2019 17:34:53 +0200
Subject: Fixed the access to connected clients from the Python API.

---
 plugins/pychrysalide/analysis/binary.c | 4 +++-
 src/analysis/binary.c                  | 5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/plugins/pychrysalide/analysis/binary.c b/plugins/pychrysalide/analysis/binary.c
index e97bea6..eb71a62 100644
--- a/plugins/pychrysalide/analysis/binary.c
+++ b/plugins/pychrysalide/analysis/binary.c
@@ -127,7 +127,7 @@ static PyObject *py_loaded_binary_new(PyTypeObject *type, PyObject *args, PyObje
 static PyObject *py_loaded_binary_get_client(PyObject *self, PyObject *args)
 {
     PyObject *result;                       /* Bilan à retourner           */
-    bool internal;                          /* Nature du client visé       */
+    int internal;                           /* Nature du client visé       */
     int ret;                                /* Bilan de lecture des args.  */
     GLoadedBinary *binary;                  /* Binaire en cours d'analyse  */
     GHubClient *client;                     /* Eventuel client en place    */
@@ -140,6 +140,8 @@ static PyObject *py_loaded_binary_get_client(PyObject *self, PyObject *args)
     " if defined, or return None otherwise.\n"                          \
 )
 
+    internal = 1;
+
     ret = PyArg_ParseTuple(args, "|p", &internal);
     if (!ret) return NULL;
 
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index 05e42c7..fb715bb 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -973,7 +973,10 @@ GHubClient *g_loaded_binary_get_client(const GLoadedBinary *binary, bool interna
 {
     GHubClient *result;                     /* Instance à retourner        */
 
-    result = binary->local;
+    if (internal)
+        result = binary->local;
+    else
+        result = binary->remote;
 
     if (result != NULL)
         g_object_ref(G_OBJECT(result));
-- 
cgit v0.11.2-87-g4458