mirror of
https://github.com/optim-enterprises-bv/nDPId.git
synced 2025-10-29 17:32:23 +00:00
27
packages/archlinux/PKGBUILD
Normal file
27
packages/archlinux/PKGBUILD
Normal file
@@ -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
|
||||
}
|
||||
4
packages/archlinux/README.md
Normal file
4
packages/archlinux/README.md
Normal file
@@ -0,0 +1,4 @@
|
||||
HowTo use this
|
||||
==============
|
||||
|
||||
Change to this directory and simply run `makepkg`, that's it.
|
||||
26
utils.c
26
utils.c
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user