mcstrans-3.2-3

Rebase on upstream commit 32611aea6543

See
    $ cd SELinuxProject/selinux
    $ git log --pretty=oneline mcstrans-3.2..32611aea6543 -- mcstrans
This commit is contained in:
Petr Lautrbach 2021-07-28 21:31:24 +02:00
parent 88cf29637c
commit 129e25b354
5 changed files with 77 additions and 21 deletions

View File

@ -0,0 +1,52 @@
From e293718f0edf553593b2f0687ea9c1294199f764 Mon Sep 17 00:00:00 2001
From: Nicolas Iooss <nicolas.iooss@m4x.org>
Date: Sat, 3 Jul 2021 16:31:22 +0200
Subject: [PATCH] mcstrans: silence -Wextra-semi-stmt warning
On Ubuntu 20.04, when building with clang -Werror -Wextra-semi-stmt
(which is not the default build configuration), the compiler reports:
mcstransd.c:72:35: error: empty expression statement has no effect;
remove unnecessary ';' to silence this warning
[-Werror,-Wextra-semi-stmt]
log_debug("%s\n", "cleanup_exit");
^
Replace the empty log_debug substitution with a do { ... } while (0)
construction to silence this warning.
Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
---
mcstrans/src/mcstrans.c | 2 +-
mcstrans/src/mcstransd.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/mcstrans/src/mcstrans.c b/mcstrans/src/mcstrans.c
index c0fc14e40d2f..e92dfddb0d20 100644
--- a/mcstrans/src/mcstrans.c
+++ b/mcstrans/src/mcstrans.c
@@ -43,7 +43,7 @@
#ifdef DEBUG
#define log_debug(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__)
#else
-#define log_debug(fmt, ...) ;
+#define log_debug(fmt, ...) do {} while (0)
#endif
static unsigned int maxbit=0;
diff --git a/mcstrans/src/mcstransd.c b/mcstrans/src/mcstransd.c
index 07c052fd4998..59c152e73be1 100644
--- a/mcstrans/src/mcstransd.c
+++ b/mcstrans/src/mcstransd.c
@@ -40,7 +40,7 @@
//#define log_debug(fmt, ...) syslog(LOG_DEBUG, fmt, __VA_ARGS__)
#define log_debug(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__)
#else
-#define log_debug(fmt, ...) ;
+#define log_debug(fmt, ...) do {} while (0)
#endif
extern int init_translations(void);
--
2.32.0

View File

@ -1,4 +1,4 @@
From a9eae01e435c2d6f13f3672a50f545bab03e9992 Mon Sep 17 00:00:00 2001
From e2287da319948bb985f7b776d7bdb1d9b8c8e353 Mon Sep 17 00:00:00 2001
From: Petr Lautrbach <plautrba@redhat.com>
Date: Wed, 28 Nov 2018 18:28:05 +0100
Subject: [PATCH] mcstrans: Fir RESOURCE_LEAK and USE_AFTER_FREE coverity scan
@ -10,7 +10,7 @@ Subject: [PATCH] mcstrans: Fir RESOURCE_LEAK and USE_AFTER_FREE coverity scan
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/mcstrans/src/mcstrans.c b/mcstrans/src/mcstrans.c
index 96bdbdff7d8b..0d9d0f3e25b7 100644
index e92dfddb0d20..d0690e6b0dca 100644
--- a/mcstrans/src/mcstrans.c
+++ b/mcstrans/src/mcstrans.c
@@ -633,16 +633,23 @@ add_cache(domain_t *domain, char *raw, char *trans) {
@ -38,7 +38,7 @@ index 96bdbdff7d8b..0d9d0f3e25b7 100644
if (add_to_hashtable(domain->trans_to_raw, map->trans, map) < 0)
goto err;
@@ -1519,6 +1526,7 @@ trans_context(const security_context_t incon, security_context_t *rcon) {
@@ -1520,6 +1527,7 @@ trans_context(const char *incon, char **rcon) {
trans = compute_trans_from_raw(range, domain);
if (trans)
if (add_cache(domain, range, trans) < 0) {
@ -46,7 +46,7 @@ index 96bdbdff7d8b..0d9d0f3e25b7 100644
free(range);
return -1;
}
@@ -1530,6 +1538,7 @@ trans_context(const security_context_t incon, security_context_t *rcon) {
@@ -1531,6 +1539,7 @@ trans_context(const char *incon, char **rcon) {
ltrans = compute_trans_from_raw(lrange, domain);
if (ltrans) {
if (add_cache(domain, lrange, ltrans) < 0) {
@ -54,7 +54,7 @@ index 96bdbdff7d8b..0d9d0f3e25b7 100644
free(range);
return -1;
}
@@ -1548,6 +1557,7 @@ trans_context(const security_context_t incon, security_context_t *rcon) {
@@ -1549,6 +1558,7 @@ trans_context(const char *incon, char **rcon) {
utrans = compute_trans_from_raw(urange, domain);
if (utrans) {
if (add_cache(domain, urange, utrans) < 0) {
@ -62,7 +62,7 @@ index 96bdbdff7d8b..0d9d0f3e25b7 100644
free(ltrans);
free(range);
return -1;
@@ -1647,14 +1657,19 @@ untrans_context(const security_context_t incon, security_context_t *rcon) {
@@ -1648,14 +1658,19 @@ untrans_context(const char *incon, char **rcon) {
canonical = compute_trans_from_raw(raw, domain);
if (canonical && strcmp(canonical, range))
if (add_cache(domain, raw, canonical) < 0) {
@ -83,7 +83,7 @@ index 96bdbdff7d8b..0d9d0f3e25b7 100644
return -1;
}
} else {
@@ -1672,6 +1687,7 @@ untrans_context(const security_context_t incon, security_context_t *rcon) {
@@ -1673,6 +1688,7 @@ untrans_context(const char *incon, char **rcon) {
canonical = compute_trans_from_raw(lraw, domain);
if (canonical)
if (add_cache(domain, lraw, canonical) < 0) {
@ -91,7 +91,7 @@ index 96bdbdff7d8b..0d9d0f3e25b7 100644
free(lraw);
free(range);
return -1;
@@ -1703,6 +1719,7 @@ untrans_context(const security_context_t incon, security_context_t *rcon) {
@@ -1704,6 +1720,7 @@ untrans_context(const char *incon, char **rcon) {
canonical = compute_trans_from_raw(uraw, domain);
if (canonical)
if (add_cache(domain, uraw, canonical) < 0) {
@ -100,7 +100,7 @@ index 96bdbdff7d8b..0d9d0f3e25b7 100644
free(lraw);
free(range);
diff --git a/mcstrans/src/mcstransd.c b/mcstrans/src/mcstransd.c
index 858994932e4f..a1ec81acb3c8 100644
index 59c152e73be1..5191fc98ef06 100644
--- a/mcstrans/src/mcstransd.c
+++ b/mcstrans/src/mcstransd.c
@@ -335,6 +335,7 @@ process_events(struct pollfd **ufds, int *nfds)
@ -125,5 +125,5 @@ index 858994932e4f..a1ec81acb3c8 100644
" for fd (%d)\n", revents, connfd);
--
2.23.0
2.32.0

View File

@ -1,4 +1,4 @@
From d09b54cfffaa3923c22bb3ff7818cb4a19325905 Mon Sep 17 00:00:00 2001
From 34a28d3bd6a491bffc91957b3f75c8dbf04b5e89 Mon Sep 17 00:00:00 2001
From: Petr Lautrbach <plautrba@redhat.com>
Date: Thu, 9 May 2019 16:44:43 +0200
Subject: [PATCH] mcstrans: Fix USER_AFTER_FREE problem
@ -8,10 +8,10 @@ Subject: [PATCH] mcstrans: Fix USER_AFTER_FREE problem
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mcstrans/src/mcstrans.c b/mcstrans/src/mcstrans.c
index 0d9d0f3e25b7..29cadb78b62c 100644
index d0690e6b0dca..8678418a1570 100644
--- a/mcstrans/src/mcstrans.c
+++ b/mcstrans/src/mcstrans.c
@@ -1663,10 +1663,8 @@ untrans_context(const security_context_t incon, security_context_t *rcon) {
@@ -1664,10 +1664,8 @@ untrans_context(const char *incon, char **rcon) {
return -1;
}
}
@ -24,5 +24,5 @@ index 0d9d0f3e25b7..29cadb78b62c 100644
free(range);
free(raw);
--
2.23.0
2.32.0

View File

@ -1,4 +1,4 @@
From 0173a950563b23080fd40433f55efcb1d6b77923 Mon Sep 17 00:00:00 2001
From ca921fdca835cf24969c656a18180112ff81bf18 Mon Sep 17 00:00:00 2001
From: Petr Lautrbach <plautrba@redhat.com>
Date: Mon, 15 Apr 2019 15:22:51 +0200
Subject: [PATCH] mcstrans: Do not accept incomplete contexts
@ -32,7 +32,7 @@ Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/mcstrans/src/mcscolor.c b/mcstrans/src/mcscolor.c
index 4ee0db507ef2..3a3a6de9a02b 100644
index a38388501db5..94421a58dee4 100644
--- a/mcstrans/src/mcscolor.c
+++ b/mcstrans/src/mcscolor.c
@@ -272,10 +272,14 @@ static const unsigned precedence[N_COLOR][N_COLOR - 1] = {
@ -55,5 +55,5 @@ index 4ee0db507ef2..3a3a6de9a02b 100644
return 0;
}
--
2.23.0
2.32.0

View File

@ -1,7 +1,7 @@
Summary: SELinux Translation Daemon
Name: mcstrans
Version: 3.2
Release: 2%{?dist}
Release: 3%{?dist}
License: GPL+
Url: https://github.com/SELinuxProject/selinux/wiki
Source: https://github.com/SELinuxProject/selinux/releases/download/3.2/mcstrans-3.2.tar.gz
@ -9,9 +9,10 @@ Source2: secolor.conf.8
# fedora-selinux/selinux: git format-patch -N 3.2 -- mcstrans
# i=1; for j in 00*patch; do printf "Patch%04d: %s\n" $i $j; i=$((i+1));done
# Patch list start
Patch0001: 0001-mcstrans-Fir-RESOURCE_LEAK-and-USE_AFTER_FREE-coveri.patch
Patch0002: 0002-mcstrans-Fix-USER_AFTER_FREE-problem.patch
Patch0003: 0003-mcstrans-Do-not-accept-incomplete-contexts.patch
Patch0001: 0001-mcstrans-silence-Wextra-semi-stmt-warning.patch
Patch0002: 0002-mcstrans-Fir-RESOURCE_LEAK-and-USE_AFTER_FREE-coveri.patch
Patch0003: 0003-mcstrans-Fix-USER_AFTER_FREE-problem.patch
Patch0004: 0004-mcstrans-Do-not-accept-incomplete-contexts.patch
# Patch list end
BuildRequires: gcc
BuildRequires: make
@ -94,6 +95,9 @@ install -m644 %{SOURCE2} %{buildroot}%{_mandir}/man8/
%{_usr}/share/mcstrans/util/*
%changelog
* Wed Jul 28 2021 Petr Lautrbach <plautrba@redhat.com> - 3.2-3
- Rebase on upstream commit 32611aea6543
* Tue Jul 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.2-2
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild