mirror of
https://github.com/optim-enterprises-bv/nDPId.git
synced 2025-10-30 17:57:48 +00:00
Merge branch 'main' of github.com:utoni/nDPId
This commit is contained in:
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);
|
pwd = getpwnam(user);
|
||||||
if (pwd == NULL)
|
if (pwd == NULL)
|
||||||
{
|
{
|
||||||
return 1;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (group != NULL)
|
if (group != NULL)
|
||||||
@@ -170,7 +170,7 @@ int change_user_group(char const * const user,
|
|||||||
grp = getgrnam(group);
|
grp = getgrnam(group);
|
||||||
if (grp == NULL)
|
if (grp == NULL)
|
||||||
{
|
{
|
||||||
return 1;
|
return -errno;
|
||||||
}
|
}
|
||||||
gid = grp->gr_gid;
|
gid = grp->gr_gid;
|
||||||
}
|
}
|
||||||
@@ -181,17 +181,29 @@ int change_user_group(char const * const user,
|
|||||||
|
|
||||||
if (uds_collector_path != NULL)
|
if (uds_collector_path != NULL)
|
||||||
{
|
{
|
||||||
chmod(uds_collector_path, S_IRUSR | S_IWUSR);
|
errno = 0;
|
||||||
chown(uds_collector_path, pwd->pw_uid, gid);
|
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)
|
if (uds_distributor_path != NULL)
|
||||||
{
|
{
|
||||||
chmod(uds_distributor_path, S_IRUSR | S_IWUSR | S_IRGRP);
|
errno = 0;
|
||||||
chown(uds_distributor_path, pwd->pw_uid, gid);
|
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)
|
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);
|
return setregid(gid, gid) != 0 || setreuid(pwd->pw_uid, pwd->pw_uid);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user