diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2022-10-20 16:13:27 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2022-10-20 16:13:27 +0200 |
commit | 46c8fc521912e91f44a4f0ebd442209a071dbdff (patch) | |
tree | 49fb938554078a22ccb11b73e36c827b340bb2a6 | |
parent | e5f4af4890634e168b5fd84eea765903db576532 (diff) | |
parent | cd22d5605639ee6151b23c36d9f856e150d81769 (diff) |
Merge branch 'main' of github.com:utoni/nDPId
-rw-r--r-- | packages/archlinux/PKGBUILD | 27 | ||||
-rw-r--r-- | packages/archlinux/README.md | 4 | ||||
-rw-r--r-- | utils.c | 26 |
3 files changed, 50 insertions, 7 deletions
diff --git a/packages/archlinux/PKGBUILD b/packages/archlinux/PKGBUILD new file mode 100644 index 000000000..c7bdf673f --- /dev/null +++ b/packages/archlinux/PKGBUILD @@ -0,0 +1,27 @@ +# Maintainer: Toni Uhlig <toni@impl.cc> + +pkgname=nDPId-testing +pkgver=1.0 +pkgrel=1 +pkgdesc="Tiny nDPI based deep packet inspection daemons / toolkit." +arch=('i686' 'x86_64') +url="https://github.com/utoni/nDPId" +license=('GPL3') +options=() + +build() { + cd "${srcdir}/../../.." + mkdir -p build-archlinux && cd build-archlinux + cmake .. \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_INSTALL_PREFIX="/usr/local" \ + -DBUILD_EXAMPLES=ON \ + -DBUILD_NDPI=ON \ + -DENABLE_SANITIZER=ON + make VERBOSE=1 +} + +package() { + cd "${srcdir}/../../../build-archlinux" + make DESTDIR="${pkgdir}/" install +} diff --git a/packages/archlinux/README.md b/packages/archlinux/README.md new file mode 100644 index 000000000..62c30cfb6 --- /dev/null +++ b/packages/archlinux/README.md @@ -0,0 +1,4 @@ +HowTo use this +============== + +Change to this directory and simply run `makepkg`, that's it. @@ -161,7 +161,7 @@ int change_user_group(char const * const user, pwd = getpwnam(user); if (pwd == NULL) { - return 1; + return -errno; } if (group != NULL) @@ -170,7 +170,7 @@ int change_user_group(char const * const user, grp = getgrnam(group); if (grp == NULL) { - return 1; + return -errno; } gid = grp->gr_gid; } @@ -181,17 +181,29 @@ int change_user_group(char const * const user, if (uds_collector_path != NULL) { - chmod(uds_collector_path, S_IRUSR | S_IWUSR); - chown(uds_collector_path, pwd->pw_uid, gid); + errno = 0; + if (chmod(uds_collector_path, S_IRUSR | S_IWUSR) != 0 || + chown(uds_collector_path, pwd->pw_uid, gid) != 0) + { + return -errno; + } } if (uds_distributor_path != NULL) { - chmod(uds_distributor_path, S_IRUSR | S_IWUSR | S_IRGRP); - chown(uds_distributor_path, pwd->pw_uid, gid); + errno = 0; + if (chmod(uds_distributor_path, S_IRUSR | S_IWUSR | S_IRGRP) != 0 || + chown(uds_distributor_path, pwd->pw_uid, gid) != 0) + { + return -errno; + } } if (pidfile != NULL) { - chown(pidfile, pwd->pw_uid, gid); + errno = 0; + if (chown(pidfile, pwd->pw_uid, gid) != 0) + { + return -errno; + } } return setregid(gid, gid) != 0 || setreuid(pwd->pw_uid, pwd->pw_uid); } |