diff --git a/.gitignore b/.gitignore index 773f963..c37d387 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ netlabel_tools-0.19.tar.gz /netlabel_tools-0.20.tar.gz /netlabel_tools-0.21.tar.gz -/netlabel_tools-0.30.0.tar.gz diff --git a/0001-Port-to-libnl3.patch b/0001-Port-to-libnl3.patch new file mode 100644 index 0000000..e9e7f6d --- /dev/null +++ b/0001-Port-to-libnl3.patch @@ -0,0 +1,222 @@ +From d82ed2081cf58fb2504ba037d7a1e6444ec5019a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= +Date: Wed, 28 May 2014 00:11:37 -0400 +Subject: [PATCH] Port to libnl3 + +--- + libnetlabel/netlabel_comm.c | 35 ----------------------------- + libnetlabel/netlabel_internal.h | 49 +++++++---------------------------------- + libnetlabel/netlabel_msg.c | 4 ---- + macros.mk | 2 +- + netlabelctl/Makefile | 2 +- + 5 files changed, 10 insertions(+), 82 deletions(-) + +diff --git a/libnetlabel/netlabel_comm.c b/libnetlabel/netlabel_comm.c +index 289629b..02869e8 100644 +--- a/libnetlabel/netlabel_comm.c ++++ b/libnetlabel/netlabel_comm.c +@@ -102,13 +102,8 @@ struct nlbl_handle *nlbl_comm_open(void) + goto open_failure; + + /* set the netlink handle properties */ +-#if LIBNL_VERSION >= 1008 + nl_socket_set_peer_port(hndl->nl_hndl, 0); + nl_set_passcred(hndl->nl_hndl, 1); +-#elif LIBNL_VERSION == 1006 +- nl_handle_set_peer_pid(hndl->nl_hndl, 0); +- nl_set_passcred(hndl->nl_hndl, 1); +-#endif + nl_disable_sequence_check(hndl->nl_hndl); + + /* connect to the generic netlink subsystem in the kernel */ +@@ -177,11 +172,7 @@ int nlbl_comm_recv_raw(struct nlbl_handle *hndl, unsigned char **data) + * no data is waiting to be read from the handle */ + timeout.tv_sec = nlcomm_read_timeout; + timeout.tv_usec = 0; +-#if LIBNL_VERSION >= 1008 + nl_fd = nl_socket_get_fd(hndl->nl_hndl); +-#else +- nl_fd = nl_handle_get_fd(hndl->nl_hndl); +-#endif + FD_ZERO(&read_fds); + FD_SET(nl_fd, &read_fds); + ret_val = select(nl_fd + 1, &read_fds, NULL, NULL, &timeout); +@@ -192,15 +183,9 @@ int nlbl_comm_recv_raw(struct nlbl_handle *hndl, unsigned char **data) + + /* perform the read operation */ + *data = NULL; +-#if LIBNL_VERSION >= 1006 + ret_val = nl_recv(hndl->nl_hndl, &peer_nladdr, data, &creds); + if (ret_val < 0) + return ret_val; +-#else +- ret_val = nl_recv(hndl->nl_hndl, &peer_nladdr, data); +- if (ret_val < 0) +- return ret_val; +-#endif + + /* if we are setup to receive credentials, only accept messages from + * the kernel (ignore all others and send an -EAGAIN) */ +@@ -251,11 +236,7 @@ int nlbl_comm_recv(struct nlbl_handle *hndl, nlbl_msg **msg) + * no data is waiting to be read from the handle */ + timeout.tv_sec = nlcomm_read_timeout; + timeout.tv_usec = 0; +-#if LIBNL_VERSION >= 1008 + nl_fd = nl_socket_get_fd(hndl->nl_hndl); +-#else +- nl_fd = nl_handle_get_fd(hndl->nl_hndl); +-#endif + FD_ZERO(&read_fds); + FD_SET(nl_fd, &read_fds); + ret_val = select(nl_fd + 1, &read_fds, NULL, NULL, &timeout); +@@ -265,19 +246,9 @@ int nlbl_comm_recv(struct nlbl_handle *hndl, nlbl_msg **msg) + return -EAGAIN; + + /* perform the read operation */ +-#if LIBNL_VERSION >= 1100 + ret_val = nl_recv(hndl->nl_hndl, &peer_nladdr, &data, &creds); + if (ret_val < 0) + return ret_val; +-#elif LIBNL_VERSION >= 1006 +- ret_val = nl_recv(hndl->nl_hndl, &peer_nladdr, data, &creds); +- if (ret_val < 0) +- return ret_val; +-#else +- ret_val = nl_recv(hndl->nl_hndl, &peer_nladdr, data); +- if (ret_val < 0) +- return ret_val; +-#endif + + /* if we are setup to receive credentials, only accept messages from + * the kernel (ignore all others and send an -EAGAIN) */ +@@ -344,9 +315,7 @@ int nlbl_comm_send(struct nlbl_handle *hndl, nlbl_msg *msg) + creds.gid = getegid(); + + /* set the message properties */ +-#if LIBNL_VERSION >= 1006 + nlmsg_set_creds(msg, &creds); +-#endif + + /* request a netlink ack message */ + nl_hdr = nlbl_msg_nlhdr(msg); +@@ -355,9 +324,5 @@ int nlbl_comm_send(struct nlbl_handle *hndl, nlbl_msg *msg) + nl_hdr->nlmsg_flags |= NLM_F_ACK; + + /* send the message */ +-#if LIBNL_VERSION == 1005 +- return nl_send_auto_complete(hndl->nl_hndl, nlbl_msg_nlhdr(msg)); +-#elif LIBNL_VERSION >= 1006 + return nl_send_auto_complete(hndl->nl_hndl, msg); +-#endif + } +diff --git a/libnetlabel/netlabel_internal.h b/libnetlabel/netlabel_internal.h +index acc2f03..54200af 100644 +--- a/libnetlabel/netlabel_internal.h ++++ b/libnetlabel/netlabel_internal.h +@@ -27,6 +27,14 @@ + + #include + ++#define nl_handle_alloc nl_socket_alloc ++#define nl_handle_destroy nl_socket_free ++#define nl_handle nl_sock ++#define nlmsg_build(ptr) nlmsg_inherit(ptr) ++#define nl_set_passcred nl_socket_set_passcred ++#define nl_disable_sequence_check nl_socket_disable_seq_check ++#define nlmsg_len nlmsg_datalen ++ + /* NetLabel communication handle */ + struct nlbl_handle { + struct nl_handle *nl_hndl; +@@ -37,46 +45,5 @@ struct nlbl_handle { + (((hdr)->nlmsg_flags & NLM_F_MULTI) && \ + ((hdr)->nlmsg_type != NLMSG_DONE))) + +-/* Specify which version of libnl we are using */ +-/* 1.0-pre5 => 1005 */ +-/* 1.0-pre6 => 1006 */ +-/* 1.0-pre8 => 1008 */ +-/* 1.1 => 1100 */ +-#define LIBNL_VERSION 1100 +- +-/* XXX - this whole block will most likely go away once libnl supports Generic +- * Netlink */ +-#if LIBNL_VERSION <= 1006 /* Generic Netlink types */ +- +-/* Generic Netlink message header */ +-struct genlmsghdr { +- uint8_t cmd; +- uint8_t version; +- uint16_t reserved; +-}; +- +-#define GENL_ID_CTRL 0x10 +- +-enum { +- CTRL_CMD_UNSPEC, +- CTRL_CMD_NEWFAMILY, +- CTRL_CMD_DELFAMILY, +- CTRL_CMD_GETFAMILY, +- CTRL_CMD_NEWOPS, +- CTRL_CMD_DELOPS, +- CTRL_CMD_GETOPS, +- __CTRL_CMD_MAX, +-}; +-#define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1) +- +-enum { +- CTRL_ATTR_UNSPEC, +- CTRL_ATTR_FAMILY_ID, +- CTRL_ATTR_FAMILY_NAME, +- __CTRL_ATTR_MAX, +-}; +-#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1) +- +-#endif /* Generic Netlink types */ + + #endif +diff --git a/libnetlabel/netlabel_msg.c b/libnetlabel/netlabel_msg.c +index fb2fc58..af00fbe 100644 +--- a/libnetlabel/netlabel_msg.c ++++ b/libnetlabel/netlabel_msg.c +@@ -63,11 +63,7 @@ nlbl_msg *nlbl_msg_new(void) + struct genlmsghdr genl_hdr; + + /* create the message with a simple netlink header */ +-#if LIBNL_VERSION >= 1008 + msg = nlmsg_alloc(); +-#else +- msg = nlmsg_build_no_hdr(); +-#endif + if (msg == NULL) + goto msg_new_failure; + +diff --git a/macros.mk b/macros.mk +index a9466f0..b9f8813 100644 +--- a/macros.mk ++++ b/macros.mk +@@ -53,7 +53,7 @@ CPPFLAGS += -I$(TOPDIR) -I$(TOPDIR)/include + LIBFLAGS = + + CFLAGS ?= -Wl,-z,relro -Wall -O0 -g +-CFLAGS += -fPIC ++CFLAGS += `pkg-config --cflags libnl-3.0` -fPIC + LDFLAGS ?= -z relro -g + + # +diff --git a/netlabelctl/Makefile b/netlabelctl/Makefile +index 06af6a5..07cebbb 100644 +--- a/netlabelctl/Makefile ++++ b/netlabelctl/Makefile +@@ -49,7 +49,7 @@ CONF_FILE = netlabel.rules + + OBJS = main.o mgmt.o map.o unlabeled.o cipsov4.o + +-LDFLAGS := ../libnetlabel/libnetlabel.a -lnl -lm ++LDFLAGS := ../libnetlabel/libnetlabel.a `pkg-config --libs libnl-3.0` -lm + + DEPS = $(OBJS:%.o=%.d) + +-- +1.8.4.5 + diff --git a/netlabel_tools-0.17-new-hdrs.patch b/netlabel_tools-0.17-new-hdrs.patch new file mode 100644 index 0000000..27221c5 --- /dev/null +++ b/netlabel_tools-0.17-new-hdrs.patch @@ -0,0 +1,34 @@ +diff -up netlabel_tools-0.19/Makefile.new-hdrs netlabel_tools-0.19/Makefile +--- netlabel_tools-0.19/Makefile.new-hdrs 2009-01-05 22:24:24.000000000 +0100 ++++ netlabel_tools-0.19/Makefile 2010-06-16 13:36:55.170646610 +0200 +@@ -41,8 +41,9 @@ INSTALL_SBIN_DIR = $(INSTALL_PREFIX)/sbi + INSTALL_BIN_DIR = $(INSTALL_PREFIX)/bin + INSTALL_MAN_DIR = $(INSTALL_PREFIX)/share/man + +-OWNER = root +-GROUP = root ++# Mock doesn't allow this. ++# OWNER = root ++# GROUP = root + + # + # targets +@@ -70,15 +71,15 @@ install: $(SUBDIRS) + @echo "INFO: installing files in $(INSTALL_PREFIX)" + @mkdir -p $(INSTALL_SBIN_DIR) + @mkdir -p $(INSTALL_MAN_DIR)/man8 +- @install -o $(OWNER) -g $(GROUP) -m 755 netlabelctl/netlabelctl \ ++ @install -m 755 netlabelctl/netlabelctl \ + $(INSTALL_SBIN_DIR)/netlabelctl +- @install -o $(OWNER) -g $(GROUP) -m 644 docs/man/netlabelctl.8 \ ++ @install -m 644 docs/man/netlabelctl.8 \ + $(INSTALL_MAN_DIR)/man8 + + $(VERSION_HDR): version_info + @echo "INFO: creating the version header file" + @hdr="$(VERSION_HDR)"; \ +- . version_info; \ ++ . ./version_info; \ + echo "/* automatically generated - do not edit */" > $$hdr; \ + echo "#ifndef _VERSION_H" >> $$hdr; \ + echo "#define _VERSION_H" >> $$hdr; \ diff --git a/netlabel_tools-0.19-return_codes.patch b/netlabel_tools-0.19-return_codes.patch new file mode 100644 index 0000000..95baa3f --- /dev/null +++ b/netlabel_tools-0.19-return_codes.patch @@ -0,0 +1,10 @@ +--- netlabel_tools-0.19/netlabelctl/main.c 2009-01-05 16:24:16.000000000 -0500 ++++ netlabel_tools-0.19.new/netlabelctl/main.c 2010-06-17 02:54:06.864494476 -0400 +@@ -352,6 +352,7 @@ + fprintf(stderr, + MSG_ERR("unknown or missing module '%s'\n"), + module_name); ++ ret_val = 1; + goto exit; + } + ret_val = module_main(argc - optind - 1, argv + optind + 1); diff --git a/netlabel_tools.spec b/netlabel_tools.spec index f29e3e9..7ac59ab 100644 --- a/netlabel_tools.spec +++ b/netlabel_tools.spec @@ -1,18 +1,16 @@ Summary: Tools to manage the Linux NetLabel subsystem Name: netlabel_tools -Version: 0.30.0 -Release: 21%{?dist} -License: GPL-2.0-only -URL: https://github.com/netlabel/netlabel_tools +Version: 0.21 +Release: 0%{?dist} +License: GPLv2 +Group: System Environment/Daemons Source: https://github.com/netlabel/netlabel_tools/releases/download/v%{version}/%{name}-%{version}.tar.gz -Patch0: rhbz1683434.patch +URL: https://github.com/netlabel/netlabel_tools -Requires: libnl3 +Requires: kernel libnl3 Requires(post): systemd Requires(preun): systemd Requires(postun): systemd -BuildRequires: make -BuildRequires: gcc BuildRequires: kernel-headers BuildRequires: libnl3-devel BuildRequires: doxygen @@ -26,7 +24,7 @@ package provides the necessary user space tools to query and configure the kernel subsystem. %prep -%autosetup -p 1 +%setup -q %build %configure @@ -66,76 +64,6 @@ make V=1 DESTDIR="%{buildroot}" install %attr(0644,root,root) %config(noreplace) /etc/netlabel.rules %changelog -* Thu Jul 24 2025 Fedora Release Engineering - 0.30.0-21 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild - -* Fri Jan 17 2025 Fedora Release Engineering - 0.30.0-20 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild - -* Thu Jul 18 2024 Fedora Release Engineering - 0.30.0-19 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild - -* Thu Jan 25 2024 Fedora Release Engineering - 0.30.0-18 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Sun Jan 21 2024 Fedora Release Engineering - 0.30.0-17 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Thu Jul 20 2023 Fedora Release Engineering - 0.30.0-16 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - -* Thu Jan 19 2023 Fedora Release Engineering - 0.30.0-15 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - -* Fri Jul 22 2022 Fedora Release Engineering - 0.30.0-14 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - -* Thu Jan 20 2022 Fedora Release Engineering - 0.30.0-13 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - -* Thu Jul 22 2021 Fedora Release Engineering - 0.30.0-12 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Tue Jan 26 2021 Fedora Release Engineering - 0.30.0-11 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Tue Jul 28 2020 Fedora Release Engineering - 0.30.0-10 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Wed Jan 29 2020 Fedora Release Engineering - 0.30.0-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Fri Aug 02 2019 Paul Moore - 0.30.0-8 -- Applied upstream patch to improve netlabel-config error reporting (rhbz #1683434) -- Removed the kernel dependency (rhbz #1733605) - -* Thu Jul 25 2019 Fedora Release Engineering - 0.30.0-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Fri Feb 01 2019 Fedora Release Engineering - 0.30.0-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Fri Jul 13 2018 Fedora Release Engineering - 0.30.0-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Thu Feb 08 2018 Fedora Release Engineering - 0.30.0-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Thu Aug 03 2017 Fedora Release Engineering - 0.30.0-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild - -* Wed Jul 26 2017 Fedora Release Engineering - 0.30.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild - -* Fri Feb 10 2017 Fedora Release Engineering - 0.30.0-1 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - -* Thu Dec 08 2016 Paul Moore - 0.30.0-0 --New upstream version - -* Thu Feb 04 2016 Fedora Release Engineering - 0.21-1 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild - * Fri Jul 10 2015 Paul Moore - 0.21-0 - New upstream version diff --git a/rhbz1683434.patch b/rhbz1683434.patch deleted file mode 100644 index d8aeae1..0000000 --- a/rhbz1683434.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 578a65904ff6426c01d81826873d27d0af35f355 Mon Sep 17 00:00:00 2001 -From: Paul Moore -Date: Sun, 17 Mar 2019 17:13:55 -0400 -Subject: [PATCH] netlabel_config: better error reporting on load - -Signed-off-by: Paul Moore ---- - netlabelctl/netlabel-config | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/netlabelctl/netlabel-config b/netlabelctl/netlabel-config -index 717d795..15c74f7 100755 ---- a/netlabelctl/netlabel-config -+++ b/netlabelctl/netlabel-config -@@ -114,15 +114,21 @@ function nlbl_reset() { - # load the NetLabel configuration from the configuration file - function nlbl_load() { - local ret_rc=0 -+ local line_num=0 - local line - while read line; do -+ line_num=$(($line_num + 1)) - # skip comments and blank lines - echo "$line" | egrep '^#|^$' >& /dev/null && continue - - # perform the configuration -- netlabelctl $line >& /dev/null -+ output=$(netlabelctl $line 2>&1) - rc=$? -- [[ $rc -ne 0 ]] && ret_rc=1 -+ if [[ $rc -ne 0 ]]; then -+ ret_rc=1 -+ echo "error: line $line_num \"$line\"" -+ echo "$output" -+ fi - done < "$CFG_FILE" - - return $ret_rc diff --git a/sources b/sources index 3b7bc4b..231dfb5 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -fc6b07bf01bc3f68f5f05071072e521e netlabel_tools-0.30.0.tar.gz +54ae1eb11a1b5201bea8a43a6fb08fc2 netlabel_tools-0.21.tar.gz