From: Michael Tremer Date: Fri, 16 Sep 2022 12:19:56 +0000 (+0000) Subject: Drop unused capabilities stuff X-Git-Tag: 0.9.28~306 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3bca677b6aed4f39268a3428fc140b88df82128;p=pakfire.git Drop unused capabilities stuff Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 49e0df806..0f26c83fa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -219,7 +219,6 @@ libpakfire_la_SOURCES = \ src/libpakfire/arch.c \ src/libpakfire/archive.c \ src/libpakfire/build.c \ - src/libpakfire/capabilities.c \ src/libpakfire/cgroup.c \ src/libpakfire/compress.c \ src/libpakfire/config.c \ @@ -258,7 +257,6 @@ pkginclude_HEADERS += \ src/libpakfire/include/pakfire/arch.h \ src/libpakfire/include/pakfire/archive.h \ src/libpakfire/include/pakfire/build.h \ - src/libpakfire/include/pakfire/capabilities.h \ src/libpakfire/include/pakfire/cgroup.h \ src/libpakfire/include/pakfire/compress.h \ src/libpakfire/include/pakfire/config.h \ diff --git a/src/libpakfire/capabilities.c b/src/libpakfire/capabilities.c deleted file mode 100644 index d63381450..000000000 --- a/src/libpakfire/capabilities.c +++ /dev/null @@ -1,73 +0,0 @@ -/*############################################################################# -# # -# Pakfire - The IPFire package management system # -# Copyright (C) 2022 Pakfire development team # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see . # -# # -#############################################################################*/ - -#include -#include - -#include -#include -#include - -int pakfire_has_cap(struct pakfire* pakfire, cap_value_t cap) { - cap_flag_value_t value = CAP_CLEAR; - int r; - - // Fetch all capabilities - cap_t caps = cap_get_proc(); - if (!caps) { - ERROR(pakfire, "Could not fetch capabilities: %m\n"); - r = -1; - goto ERROR; - } - - // Fetch the flag we are interested in - r = cap_get_flag(caps, cap, CAP_EFFECTIVE, &value); - if (r < 0) { - ERROR(pakfire, "cap_get_flag() failed: %m\n"); - goto ERROR; - } - - // Set r - switch (value) { - case CAP_CLEAR: - r = 0; - break; - - case CAP_SET: - r = 1; - break; - } - -ERROR: - if (caps) - cap_free(caps); - - return r; -} - -int pakfire_keep_caps(struct pakfire* pakfire) { - int r; - - r = prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0); - if (r < 0) - ERROR(pakfire, "prctl(PR_SET_KEEPCAPS, ...) failed: %m\n"); - - return r; -} diff --git a/src/libpakfire/include/pakfire/capabilities.h b/src/libpakfire/include/pakfire/capabilities.h deleted file mode 100644 index 443031f78..000000000 --- a/src/libpakfire/include/pakfire/capabilities.h +++ /dev/null @@ -1,35 +0,0 @@ -/*############################################################################# -# # -# Pakfire - The IPFire package management system # -# Copyright (C) 2022 Pakfire development team # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see . # -# # -#############################################################################*/ - -#ifndef PAKFIRE_CAPABILITIES_H -#define PAKFIRE_CAPABILITIES_H - -#ifdef PAKFIRE_PRIVATE - -#include - -#include - -int pakfire_has_cap(struct pakfire* pakfire, cap_value_t cap); -int pakfire_keep_caps(struct pakfire* pakfire); - -#endif - -#endif /* PAKFIRE_CAPABILITIES_H */