summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2021-01-09 17:16:23 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2021-01-09 17:16:23 (GMT)
commit1a434fb2a1ebe2634d3ba6a29c7add66c17e3e0b (patch)
tree8fa90efa86400ac358aff76f07f120bd66e1ac57
parent55a5d2a08f0b168059571cddf8d6d963318903a1 (diff)
Looked for extra plugins from the CHRYSALIDE_PLUGINS_PATH environment variable.
-rw-r--r--doc/chrysalide.110
-rw-r--r--src/plugins/pglist.c17
2 files changed, 26 insertions, 1 deletions
diff --git a/doc/chrysalide.1 b/doc/chrysalide.1
index 41fabc0..599c609 100644
--- a/doc/chrysalide.1
+++ b/doc/chrysalide.1
@@ -61,6 +61,14 @@ Location of Chrysalide Databases storing the configuration of each loaded binari
.B $HOME/.config/chrysalide/servers/
Credentials used to share information about processed analysis.
+.SH ENVIRONMENT VARIABLES
+
+.TP 8
+.B CHRYSALIDE_PLUGINS_PATH
+A colon-separated list of directories to search for extra native plugins. The default directory will always be searched before browsing theses directories.
+
+The default directory depends on the installation configuration; it is \fIlibdir\fR/chrysalide-plugins, where \fIlibdir\fR is usually /usr/lib/.
+
.SH FEATURE REQUESTS AND BUG REPORTS
Any bugs found should be reported to the online bug-tracking system
@@ -75,4 +83,4 @@ When reporting bugs, it is important to include a reliable way to
reproduce the bugs.
.SH AUTHORS
-Cyrille BAGARD.
+Cyrille BAGARD
diff --git a/src/plugins/pglist.c b/src/plugins/pglist.c
index c1d96ed..18a2f3f 100644
--- a/src/plugins/pglist.c
+++ b/src/plugins/pglist.c
@@ -28,6 +28,7 @@
#include <assert.h>
#include <dirent.h>
#include <malloc.h>
+#include <stdlib.h>
#include <string.h>
@@ -77,6 +78,9 @@ bool init_all_plugins(bool load)
#ifdef DISCARD_LOCAL
char *edir; /* Répertoire de base effectif */
#endif
+ char *env; /* Contenu environnemental */
+ char *saveptr; /* Sauvegarde pour parcours */
+ char *udir; /* Répertoire supplémentaire ? */
g_rw_lock_init(&_pg_lock);
@@ -88,6 +92,19 @@ bool init_all_plugins(bool load)
free(edir);
#endif
+ env = getenv("CHRYSALIDE_PLUGINS_PATH");
+
+ if (env != NULL)
+ {
+ env = strdup(env);
+
+ for (udir = strtok_r(env, ":", &saveptr); udir != NULL; udir = strtok_r(NULL, ":", &saveptr))
+ browse_directory_for_plugins(udir);
+
+ free(env);
+
+ }
+
if (load)
load_remaning_plugins();