From 1a434fb2a1ebe2634d3ba6a29c7add66c17e3e0b Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Sat, 9 Jan 2021 18:16:23 +0100 Subject: Looked for extra plugins from the CHRYSALIDE_PLUGINS_PATH environment variable. --- doc/chrysalide.1 | 10 +++++++++- src/plugins/pglist.c | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) 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 #include #include +#include #include @@ -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(); -- cgit v0.11.2-87-g4458