summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorToni <matzeton@googlemail.com>2024-10-16 14:13:55 +0200
committerGitHub <noreply@github.com>2024-10-16 14:13:55 +0200
commitefed6f196ecab333b76b83a5d256c9e4e6b75867 (patch)
treed8e5963a07a1ea87f3547a0e9ae8d370e6cb06f5 /examples
parent3e2ce661f01545daeb311d671bf222d378729bca (diff)
Read and parse configuration files. Fixes #41. (#42)1.7rc1
Read and parse configuration files. Fixes #41. * supports nDPId / nDPIsrvd via command line parameter `-f` * nDPId: read general/tuning and libnDPI settings * support for settings risk domains libnDPI option via config file or via `-R` (Fixes #45, thanks to @UnveilTech) * added some documentation in the config file * adjusted Systemd and Debian packaging to make use of config files Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/c-analysed/c-analysed.c2
-rw-r--r--examples/c-captured/c-captured.c14
-rw-r--r--examples/c-influxd/c-influxd.c2
3 files changed, 10 insertions, 8 deletions
diff --git a/examples/c-analysed/c-analysed.c b/examples/c-analysed/c-analysed.c
index 71ab7fa4a..2811f70f8 100644
--- a/examples/c-analysed/c-analysed.c
+++ b/examples/c-analysed/c-analysed.c
@@ -2059,7 +2059,7 @@ int main(int argc, char ** argv)
}
errno = 0;
- if (user != NULL && change_user_group(user, group, pidfile, NULL, NULL) != 0)
+ if (user != NULL && change_user_group(user, group, pidfile) != 0)
{
if (errno != 0)
{
diff --git a/examples/c-captured/c-captured.c b/examples/c-captured/c-captured.c
index ce0c46c2e..98df7c4b8 100644
--- a/examples/c-captured/c-captured.c
+++ b/examples/c-captured/c-captured.c
@@ -24,7 +24,7 @@
#include "utarray.h"
#include "utils.h"
-//#define VERBOSE
+// #define VERBOSE
#define DEFAULT_DATADIR "/tmp/nDPId-captured"
struct packet_data
@@ -1355,8 +1355,14 @@ int main(int argc, char ** argv)
return 1;
}
+ if (capture_mode != 0 && chmod_chown(datadir, S_IRWXU | S_IRGRP | S_IXGRP, user, group) != 0)
+ {
+ logger(1, "Could not chmod/chown `%s': %s", datadir, strerror(errno));
+ return 1;
+ }
+
errno = 0;
- if (user != NULL && change_user_group(user, group, pidfile, datadir /* :D */, NULL) != 0)
+ if (user != NULL && change_user_group(user, group, pidfile) != 0)
{
if (errno != 0)
{
@@ -1368,10 +1374,6 @@ int main(int argc, char ** argv)
}
return 1;
}
- if (datadir != NULL)
- {
- chmod(datadir, S_IRWXU);
- }
if (nDPIsrvd_set_read_timeout(ndpisrvd_socket, 180, 0) != 0)
{
diff --git a/examples/c-influxd/c-influxd.c b/examples/c-influxd/c-influxd.c
index fd4ab8cb0..9eabbe461 100644
--- a/examples/c-influxd/c-influxd.c
+++ b/examples/c-influxd/c-influxd.c
@@ -1671,7 +1671,7 @@ int main(int argc, char ** argv)
}
errno = 0;
- if (user != NULL && change_user_group(user, group, pidfile, NULL, NULL) != 0)
+ if (user != NULL && change_user_group(user, group, pidfile) != 0)
{
if (errno != 0)
{