Compare commits

...

99 Commits

Author SHA1 Message Date
Tom Stellard 0da7b6ae1b Use make macros
https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
2020-07-28 18:02:38 +02:00
Fedora Release Engineering 4d592329d4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-28 07:09:44 +00:00
Petr Lautrbach 1a253cdbb5 mcstrans-3.1-1
- SELinux userspace 3.1 release
2020-07-16 10:18:40 +02:00
Fedora Release Engineering bf76b0d7df - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-29 12:27:12 +00:00
Petr Lautrbach 1fd4fb2b1e SELinux userspace 3.0 release 2019-12-06 10:31:38 +01:00
Petr Lautrbach bd1e6b9762 SELinux userspace 3.0-rc1 release candidate 2019-11-11 15:33:29 +01:00
Fedora Release Engineering 7d7ce0fa68 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-25 16:15:51 +00:00
Petr Lautrbach 22da83cd59 SELinux userspace 2.9 release 2019-03-19 11:10:30 +01:00
Petr Lautrbach 694ff6c399 SELinux userspace 2.9-rc2 release 2019-03-11 17:56:01 +01:00
Fedora Release Engineering 37305cf394 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-02-01 10:04:02 +00:00
Petr Lautrbach 6478fce8b4 SELinux userspace 2.9-rc1 release candidate 2019-01-30 10:51:21 +01:00
Petr Lautrbach 1134fab731 Update to mctrans-2.8
- systemctl commands are replaced by systemd rpm macros
- mcstransd.service is an alias for mcstrans.service now
- use global ld and c flags
2018-10-02 21:58:18 +02:00
Fedora Release Engineering a511ade05c - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-07-13 10:04:05 +00:00
Jason Tibbitts 3fd943391b Remove needless use of %defattr 2018-07-10 01:57:19 -05:00
Petr Lautrbach 7c05cac00f List gcc in BuildRequires
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/IJFYI5Q2BYZKIGDFS2WLOBDUSEGWHIKV/
https://fedoraproject.org/wiki/Packaging:C_and_C%2B%2B#BuildRequires_and_Requires
2018-02-19 13:37:46 +01:00
Igor Gnatenko a734577217
Remove %clean section
None of currently supported distributions need that.
Last one was EL5 which is EOL for a while.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-14 07:20:57 +01:00
Igor Gnatenko 2ce345832d Remove BuildRoot definition
None of currently supported distributions need that.
It was needed last for EL5 which is EOL now

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-13 23:48:29 +01:00
Fedora Release Engineering 8b81574ce0 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-02-08 01:30:55 +00:00
Fedora Release Engineering 26f22e0381 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild 2017-08-03 03:11:02 +00:00
Fedora Release Engineering 0601a63599 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild 2017-07-26 21:12:21 +00:00
Fedora Release Engineering 7e04373055 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild 2017-02-10 20:46:41 +00:00
Dennis Gilmore 0722ad3005 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild 2016-02-04 05:11:51 +00:00
Dennis Gilmore a70fc8bcef - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild 2015-06-17 19:53:46 +00:00
Peter Robinson 187c193445 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild 2014-08-17 09:02:32 +00:00
Dennis Gilmore dad65dd008 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild 2014-06-07 03:48:37 -05:00
Karsten Hopp 66ac09e0f6 fix changelog order so that it builds with a recent rpm 2014-03-19 15:59:06 +01:00
Dan Walsh 0765f6c30c Make mcstrans PIE and fully relro
Resolves: #983268
2013-10-16 14:50:34 -04:00
Dan Walsh c4a27c8221 Update to latest version/applying patches
- Move binary to /usr/sbin rather then /sbin
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
2013-10-15 14:20:34 -04:00
Dan Walsh 7d761d4e01 Update to latest version/applying patches
- Move binary to /usr/sbin rather then /sbin
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
2013-10-15 13:31:52 -04:00
Dennis Gilmore d654f5486c - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild 2013-08-03 04:53:04 -05:00
Dan Walsh c986c18381 Add secolor.conf.5 man page
- Make mcstransd watch for content being written to /run/setrans for files names containing translations.
-- This will allow apps like libvirt to write content nameing randomly selected MCS labels
- Fix memory leak in mcstransd
2013-03-26 13:01:53 -04:00
Dennis Gilmore 2d8019e8f6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild 2013-02-14 00:41:02 -06:00
Dennis Gilmore 600b68fa02 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild 2012-07-19 18:52:51 -05:00
Petr Písař 4888449885 Rebuild against PCRE 8.30 2012-02-10 15:27:15 +01:00
Dan Walsh 7c6e6abc59 fix systemd.service file 2012-02-02 13:23:58 -05:00
Dan Walsh a5dce68d9f fix systemd.service file 2012-02-02 13:23:31 -05:00
Dan Walsh 4d068c251b Update to upstream
- Write pid file
2012-02-01 17:21:12 -05:00
Dan Walsh 6e65bceee9 Update to upstream
- Write pid file
2012-02-01 17:09:03 -05:00
Dan Walsh 5c58719d6f Update to upstream
- Write pid file
2012-02-01 17:05:02 -05:00
Dan Walsh efa2ace197 Update to upstream
- Write pid file
2012-02-01 16:59:52 -05:00
Dan Walsh f66181c363 Update to upstream
- Write pid file
2012-02-01 16:58:17 -05:00
Dan Walsh a59173415b Update to upstream
- Write pid file
2012-02-01 16:33:43 -05:00
Dan Walsh 92e33b0c5b Write pid file 2012-02-01 16:04:02 -05:00
Dennis Gilmore a88be20832 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild 2012-01-13 03:36:12 -06:00
Dennis Gilmore ce157ae359 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild 2011-02-08 10:23:09 -06:00
Ted X Toth 6446187368 Merge branch 'master' of ssh://pkgs.fedoraproject.org/mcstrans 2011-01-17 13:10:03 -08:00
Ted X Toth 050ddd614d Update to 0.3.2 2011-01-17 13:02:35 -08:00
Ted X Toth 07ded81ec8 Update to 0.3.2 2011-01-17 13:01:06 -08:00
Fedora Release Engineering 75eac85f3a dist-git conversion 2010-07-29 03:04:20 +00:00
Bill Nottingham 64eed255c7 Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-25 23:18:43 +00:00
Daniel J Walsh 79dad5d65c - Add mcstransd man page 2009-10-16 13:52:08 +00:00
Miroslav Grepl 3c4870785a - Fix init script 2009-09-17 09:44:36 +00:00
Jesse Keating 343458c40c - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild 2009-07-25 11:55:35 +00:00
Daniel J Walsh df0a4cd7de - Rewrite translations to allow individual word/category mapping
- Eamon Walsh's color mapping changes
2009-02-24 15:07:31 +00:00
Daniel J Walsh ea85c5f227 Update to new version of mcstrans from Joe Nall 2009-02-16 20:33:30 +00:00
Tom Callaway e68be7e9d1 fix license tag 2008-05-28 21:45:15 +00:00
Daniel J Walsh 79746a5b9b - More fixes from Jim Meyering 2008-05-08 17:17:14 +00:00
Daniel J Walsh d2a600fcab - More error checking on failed strdup 2008-05-07 12:44:52 +00:00
Daniel J Walsh 8e970a53fb - Start mcstrans before netlabel 2008-05-06 19:41:09 +00:00
Daniel J Walsh 1db50cc50d - Fix error handling 2008-04-14 21:14:18 +00:00
Daniel J Walsh 5422249240 - Rebuild for gcc 4.3 2008-02-12 13:51:48 +00:00
Steve Conklin 5c3c2bf71f Folded both current patches into tarball 2007-10-29 20:56:07 +00:00
Steve Conklin 306162e869 Bumped version 2007-10-26 21:03:20 +00:00
Steve Conklin 105c5977fa Fixed a problem that was preventing compilation 2007-10-26 20:58:38 +00:00
Steve Conklin 0568402099 Fixed the init script 2007-10-25 21:12:22 +00:00
Bill Nottingham 30ea4b15e2 makefile update to properly grab makefile.common 2007-10-15 19:08:22 +00:00
Daniel J Walsh 3d510cd21b - Check for max_categories and error out 2007-09-13 15:44:18 +00:00
Daniel J Walsh 172dd7a7ec - Fix case where s0="" 2007-03-01 21:09:58 +00:00
Daniel J Walsh 9bb18fc35f - Translate range if fully specified correctly 2007-02-26 15:50:01 +00:00
Daniel J Walsh 1d92a48be2 - Additional fix to handle ssh root/sysadm_r/s0:c1,c2 Resolves: #224637 2007-02-26 15:49:17 +00:00
Daniel J Walsh 0eb2e6204b - Additional fix to handle ssh root/sysadm_r/s0:c1,c2 Resolves: #224637 2007-02-13 18:37:25 +00:00
Daniel J Walsh 2abe1a3d1d - Additional fix to handle ssh root/sysadm_r/s0:c1,c2 Resolves: #224637 2007-02-12 18:59:45 +00:00
Daniel J Walsh b2c5749643 - Rewrite to handle MLS properly 2007-02-05 20:07:54 +00:00
Daniel J Walsh 39e8c2452d - Cleanup memory when complete 2007-01-29 23:46:47 +00:00
Daniel J Walsh ff014e5fee - Fix Memory Leak Resolves: #218173 2006-12-04 14:32:17 +00:00
Daniel J Walsh 1cf475ec71 - Fix Memory Leak Resolves: #218173 2006-12-04 14:31:25 +00:00
Daniel J Walsh ac0a1c48b4 - Fix Memory Leak Resolves: #218173 2006-12-04 14:28:27 +00:00
Daniel J Walsh 707508d01e - Add -pie
- Fix compiler warnings
2006-09-21 21:10:36 +00:00
Daniel J Walsh 6af62216e9 - Add -pie
- Fix compiler warnings
2006-09-21 21:07:23 +00:00
Daniel J Walsh f552ccd886 - Add -pie
- Fix compiler warnings
2006-09-21 20:51:34 +00:00
Peter Jones 806c655d75 - also fix the prior lockfile, so we get e.g. condrestart right 2006-09-13 17:28:44 +00:00
Peter Jones 418e775528 - fix borked release number 2006-09-13 15:41:39 +00:00
Peter Jones a98aa583db - Fix subsytem locking in init script 2006-09-13 15:32:33 +00:00
Daniel J Walsh 53bf04eacf - Only allow one version to run 2006-08-23 17:51:54 +00:00
Jesse Keating 86ae20f933 bumped for rebuild 2006-07-12 07:19:44 +00:00
Daniel J Walsh 6169b4c55e - Apply sgrubb patch to only call getpeercon on translations 2006-06-19 20:25:05 +00:00
Daniel J Walsh cb2430f406 - Exit gracefully when selinux is not enabled 2006-06-06 20:00:39 +00:00
Daniel J Walsh 06ee9402f2 - Fix sighup handling 2006-05-17 01:54:00 +00:00
Daniel J Walsh fd4999e6cc - Add patch from sgrubb
- Fix 64 bit size problems
- Increase the open file limit
- Make sure maximum size is not exceeded
2006-05-15 16:19:44 +00:00
Daniel J Walsh 2ac5fe4159 - Add patch from sgrubb
- Fix 64 bit size problems
- Increase the open file limit
- Make sure maximum size is not exceeded
2006-05-15 16:11:49 +00:00
Daniel J Walsh caeeb715da - Add patch from sgrubb
- Fix 64 bit size problems
- Increase the open file limit
- Make sure maximum size is not exceeded
2006-05-15 13:39:07 +00:00
Daniel J Walsh 003664613f - Move initscripts to /etc/rc.d/init.d 2006-05-12 14:51:19 +00:00
Daniel J Walsh 2d1d3512b1 - Move initscripts to /etc/rc.d/init.d 2006-05-12 14:21:38 +00:00
Daniel J Walsh 495b1187ba - Remove capabilities 2006-05-12 03:18:10 +00:00
Daniel J Walsh 8f1a0305ab - Initial Version
- This daemon reuses the code from libsetrans
2006-05-10 23:25:14 +00:00
Daniel J Walsh 6374afb0cd Cleanup spec and tar ball for acceptance into core 2006-05-10 20:08:34 +00:00
Daniel J Walsh f205944970 Fixes to get accepted into core 2006-05-09 23:28:11 +00:00
Daniel J Walsh 9015b2cbb8 - Initial Version
- This daemon reuses the code from libsetrans
2006-05-09 21:46:11 +00:00
Daniel J Walsh 1c823ee2dd auto-import mcstrans-0.1.1-1 on branch devel from mcstrans-0.1.1-1.src.rpm 2006-05-03 16:14:31 +00:00
10 changed files with 753 additions and 6 deletions

View File

32
.gitignore vendored Normal file
View File

@ -0,0 +1,32 @@
mcstrans-0.1.1.tgz
mcstrans-0.1.1-1.src.rpm
mcstrans-0.1.2.tgz
mcstrans-0.1.3.tgz
mcstrans-0.1.4.tgz
mcstrans-0.1.5.tgz
mcstrans-0.1.6.tgz
mcstrans-0.1.7.tgz
mcstrans-0.1.8.tgz
mcstrans-0.1.9.tgz
mcstrans-0.2.1.tgz
mcstrans-0.2.2.tgz
mcstrans-0.2.3.tgz
mcstrans-0.2.4.tgz
mcstrans-0.2.5.tgz
mcstrans-0.2.6.tgz
mcstrans-0.2.7.tgz
mcstrans-0.2.8.tgz
mcstrans-0.2.9.tgz
mcstrans-0.2.10.tgz
mcstrans-0.2.11.tgz
mcstrans-0.3.0.6.tgz
mcstrans-0.3.1.tgz
/mcstrans-0.3.2.tgz
/mcstrans-0.3.4.tgz
/mcstrans-2.8.tar.gz
/mcstrans-2.9-rc1.tar.gz
/mcstrans-2.9-rc2.tar.gz
/mcstrans-2.9.tar.gz
/mcstrans-3.0-rc1.tar.gz
/mcstrans-3.0.tar.gz
/mcstrans-3.1.tar.gz

View File

@ -0,0 +1,129 @@
From a9eae01e435c2d6f13f3672a50f545bab03e9992 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
defects
---
mcstrans/src/mcstrans.c | 21 +++++++++++++++++++--
mcstrans/src/mcstransd.c | 4 +++-
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/mcstrans/src/mcstrans.c b/mcstrans/src/mcstrans.c
index 96bdbdff7d8b..0d9d0f3e25b7 100644
--- a/mcstrans/src/mcstrans.c
+++ b/mcstrans/src/mcstrans.c
@@ -633,16 +633,23 @@ add_cache(domain_t *domain, char *raw, char *trans) {
map->raw = strdup(raw);
if (!map->raw) {
+ free(map);
goto err;
}
map->trans = strdup(trans);
if (!map->trans) {
+ free(map->raw);
+ free(map);
goto err;
}
log_debug(" add_cache (%s,%s)\n", raw, trans);
- if (add_to_hashtable(domain->raw_to_trans, map->raw, map) < 0)
+ if (add_to_hashtable(domain->raw_to_trans, map->raw, map) < 0) {
+ free(map->trans);
+ free(map->raw);
+ free(map);
goto err;
+ }
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) {
trans = compute_trans_from_raw(range, domain);
if (trans)
if (add_cache(domain, range, trans) < 0) {
+ free(trans);
free(range);
return -1;
}
@@ -1530,6 +1538,7 @@ trans_context(const security_context_t incon, security_context_t *rcon) {
ltrans = compute_trans_from_raw(lrange, domain);
if (ltrans) {
if (add_cache(domain, lrange, ltrans) < 0) {
+ free(ltrans);
free(range);
return -1;
}
@@ -1548,6 +1557,7 @@ trans_context(const security_context_t incon, security_context_t *rcon) {
utrans = compute_trans_from_raw(urange, domain);
if (utrans) {
if (add_cache(domain, urange, utrans) < 0) {
+ free(utrans);
free(ltrans);
free(range);
return -1;
@@ -1647,14 +1657,19 @@ untrans_context(const security_context_t incon, security_context_t *rcon) {
canonical = compute_trans_from_raw(raw, domain);
if (canonical && strcmp(canonical, range))
if (add_cache(domain, raw, canonical) < 0) {
+ free(canonical);
free(range);
+ free(raw);
return -1;
}
}
- if (canonical)
+ if (canonical) {
free(canonical);
+ free(raw);
+ }
if (add_cache(domain, raw, range) < 0) {
free(range);
+ free(raw);
return -1;
}
} else {
@@ -1672,6 +1687,7 @@ untrans_context(const security_context_t incon, security_context_t *rcon) {
canonical = compute_trans_from_raw(lraw, domain);
if (canonical)
if (add_cache(domain, lraw, canonical) < 0) {
+ free(canonical);
free(lraw);
free(range);
return -1;
@@ -1703,6 +1719,7 @@ untrans_context(const security_context_t incon, security_context_t *rcon) {
canonical = compute_trans_from_raw(uraw, domain);
if (canonical)
if (add_cache(domain, uraw, canonical) < 0) {
+ free(canonical);
free(uraw);
free(lraw);
free(range);
diff --git a/mcstrans/src/mcstransd.c b/mcstrans/src/mcstransd.c
index 858994932e4f..a1ec81acb3c8 100644
--- a/mcstrans/src/mcstransd.c
+++ b/mcstrans/src/mcstransd.c
@@ -335,6 +335,7 @@ process_events(struct pollfd **ufds, int *nfds)
/* Setup pollfd for deletion later. */
(*ufds)[ii].fd = -1;
close(connfd);
+ connfd = -1;
/* So we don't get bothered later */
revents = revents & ~(POLLHUP);
}
@@ -348,10 +349,11 @@ process_events(struct pollfd **ufds, int *nfds)
/* Set the pollfd up for deletion later. */
(*ufds)[ii].fd = -1;
close(connfd);
+ connfd = -1;
revents = revents & ~(POLLHUP);
}
- if (revents) {
+ if (revents && connfd != -1) {
syslog(LOG_ERR, "Unknown/error events (%x) encountered"
" for fd (%d)\n", revents, connfd);
--
2.23.0

View File

@ -0,0 +1,28 @@
From d09b54cfffaa3923c22bb3ff7818cb4a19325905 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
---
mcstrans/src/mcstrans.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mcstrans/src/mcstrans.c b/mcstrans/src/mcstrans.c
index 0d9d0f3e25b7..29cadb78b62c 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) {
return -1;
}
}
- if (canonical) {
+ if (canonical)
free(canonical);
- free(raw);
- }
if (add_cache(domain, raw, range) < 0) {
free(range);
free(raw);
--
2.23.0

View File

@ -0,0 +1,59 @@
From 0173a950563b23080fd40433f55efcb1d6b77923 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
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fixes:
$ python3
> import selinux
> selinux.selinux_raw_context_to_color("xyz_u:xyz_r:xyz_t:")
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
OSError: [Errno 0] Error
:: [ 10:25:45 ] :: [ BEGIN ] :: Running 'service mcstransd status'
Redirecting to /bin/systemctl status mcstransd.service
● mcstrans.service - Translates SELinux MCS/MLS labels to human readable form
Loaded: loaded (/usr/lib/systemd/system/mcstrans.service; disabled; vendor preset: disabled)
Active: failed (Result: core-dump) since Fri 2019-04-12 10:25:44 EDT; 1s ago
Process: 16681 ExecStart=/sbin/mcstransd -f (code=dumped, signal=SEGV)
Main PID: 16681 (code=dumped, signal=SEGV)
systemd[1]: mcstrans.service: Main process exited, code=dumped, status=11/SEGV
systemd[1]: mcstrans.service: Failed with result 'core-dump'.
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
---
mcstrans/src/mcscolor.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/mcstrans/src/mcscolor.c b/mcstrans/src/mcscolor.c
index 4ee0db507ef2..3a3a6de9a02b 100644
--- a/mcstrans/src/mcscolor.c
+++ b/mcstrans/src/mcscolor.c
@@ -272,10 +272,14 @@ static const unsigned precedence[N_COLOR][N_COLOR - 1] = {
static const secolor_t default_color = { 0x000000, 0xffffff };
static int parse_components(context_t con, char **components) {
- components[COLOR_USER] = (char *)context_user_get(con);
- components[COLOR_ROLE] = (char *)context_role_get(con);
- components[COLOR_TYPE] = (char *)context_type_get(con);
- components[COLOR_RANGE] = (char *)context_range_get(con);
+ if ((components[COLOR_USER] = (char *)context_user_get(con)) == NULL)
+ return -1;
+ if ((components[COLOR_ROLE] = (char *)context_role_get(con)) == NULL)
+ return -1;
+ if ((components[COLOR_TYPE] = (char *)context_type_get(con)) == NULL)
+ return -1;
+ if ((components[COLOR_RANGE] = (char *)context_range_get(con)) == NULL)
+ return -1;
return 0;
}
--
2.23.0

View File

@ -1,6 +0,0 @@
# Makefile for source rpm: mcstrans
# $Id$
NAME := mcstrans
SPECFILE = $(firstword $(wildcard *.spec))
include ../common/Makefile.common

312
mcstrans.spec Normal file
View File

@ -0,0 +1,312 @@
Summary: SELinux Translation Daemon
Name: mcstrans
Version: 3.1
Release: 3%{?dist}
License: GPL+
Url: https://github.com/SELinuxProject/selinux/wiki
Source: https://github.com/SELinuxProject/selinux/releases/download/20200710/mcstrans-3.1.tar.gz
Source2: secolor.conf.8
# fedora-selinux/selinux: git format-patch -N mcstrans-3.1 -- 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
# Patch list end
BuildRequires: gcc
BuildRequires: libselinux-devel >= %{version}
BuildRequires: libcap-devel pcre-devel libsepol-devel libsepol-static
BuildRequires: systemd
Requires: pcre
%{?systemd_requires}
Provides: setransd
Provides: libsetrans
%description
Security-enhanced Linux is a feature of the Linux® kernel and a number
of utilities with enhanced security functionality designed to add
mandatory access controls to Linux. The Security-enhanced Linux
kernel contains new architectural components originally developed to
improve the security of the Flask operating system. These
architectural components provide general support for the enforcement
of many kinds of mandatory access control policies, including those
based on the concepts of Type Enforcement®, Role-based Access
Control, and Multi-level Security.
mcstrans provides an translation daemon to translate SELinux categories
from internal representations to user defined representation.
%prep
%autosetup -p 2 -n mcstrans-%{version}
%build
%set_build_flags
%make_build LIBDIR="%{_libdir}"
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/%{_lib}
mkdir -p %{buildroot}/%{_libdir}
mkdir -p %{buildroot}%{_usr}/share/mcstrans
mkdir -p %{buildroot}%{_sysconfdir}/selinux/mls/setrans.d
%make_install LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" SBINDIR="%{_sbindir}"
rm -f %{buildroot}%{_libdir}/*.a
cp -r share/* %{buildroot}%{_usr}/share/mcstrans/
# Systemd
mkdir -p %{buildroot}%{_unitdir}
ln -s %{_unitdir}/mcstrans.service %{buildroot}/%{_unitdir}/mcstransd.service
rm -rf %{buildroot}/%{_sysconfdir}/rc.d/init.d/mcstrans
install -m644 %{SOURCE2} %{buildroot}%{_mandir}/man8/
%post
%systemd_post mcstransd.service
%preun
%systemd_preun mcstransd.service
%postun
%systemd_postun mcstransd.service
%files
%{_mandir}/man8/mcs.8.gz
%{_mandir}/man8/mcstransd.8.gz
%{_mandir}/man5/setrans.conf.5.gz
%{_mandir}/ru/man8/mcs.8.gz
%{_mandir}/ru/man8/mcstransd.8.gz
%{_mandir}/ru/man5/setrans.conf.5.gz
%{_mandir}/man8/secolor.conf.8.gz
/usr/sbin/mcstransd
%{_unitdir}/mcstrans.service
%{_unitdir}/mcstransd.service
%dir %{_sysconfdir}/selinux/mls/setrans.d
%dir %{_usr}/share/mcstrans
%defattr(0644,root,root,0755)
%dir %{_usr}/share/mcstrans/util
%dir %{_usr}/share/mcstrans/examples
%{_usr}/share/mcstrans/examples/*
%defattr(0755,root,root,0755)
%{_usr}/share/mcstrans/util/*
%changelog
* Tue Jul 28 2020 Tom Stellard <tstellar@redhat.com> - 3.1-3
- Use make macros
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Thu Jul 16 2020 Petr Lautrbach <plautrba@redhat.com> - 3.1-1
- SELinux userspace 3.1 release
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Fri Dec 6 2019 Petr Lautrbach <plautrba@redhat.com> - 3.0-1
- SELinux userspace 3.0 release
* Mon Nov 11 2019 Petr Lautrbach <plautrba@redhat.com> - 3.0-0.rc1.1
- SELinux userspace 3.0-rc1 release candidate
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Tue Mar 19 2019 Petr Lautrbach <plautrba@redhat.com> - 2.9-1
- SELinux userspace 2.9 release
* Mon Mar 11 2019 Petr Lautrbach <plautrba@redhat.com> - 2.9-0.rc2.1
- SELinux userspace 2.9-rc2 release
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.9-0.rc1.1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Wed Jan 30 2019 Petr Lautrbach <plautrba@redhat.com> - 2.9-0.rc1.1
- Update to mcstrans-2.9-rc1
* Tue Oct 2 2018 Petr Lautrbach <plautrba@redhat.com> - 2.8-1
- Update to mcstrans-2.8
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.4-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.4-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed Mar 19 2014 Karsten Hopp |karsten@redhat.com> - 0.3.4-4
- fix changelog order so that it builds with a recent rpm
* Wed Oct 16 2013 Dan Walsh <dwalsh@redhat.com> - 0.3.4-3
- Make mcstrans PIE and fully relro
- Resolves: #983268
* Tue Oct 15 2013 Dan Walsh <dwalsh@redhat.com> - 0.3.4-2
- Add RELRO support for long running services
* Thu Sep 12 2013 Dan Walsh <dwalsh@redhat.com> - 0.3.4-1
- Update to latest version/applying patches
- Move binary to /usr/sbin rather then /sbin
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.3-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Tue Mar 26 2013 Dan Walsh <dwalsh@redhat.com> - 0.3.3-7
- Add secolor.conf.5 man page
- Make mcstransd watch for content being written to /run/setrans for files names containing translations.
-- This will allow apps like libvirt to write content nameing randomly selected MCS labels
- Fix memory leak in mcstransd
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Fri Feb 10 2012 Petr Pisar <ppisar@redhat.com> - 0.3.3-4
- Rebuild against PCRE 8.30
* Thu Feb 2 2012 Dan Walsh <dwalsh@redhat.com> - 0.3.3-3
- Fix the systemd service file
* Wed Feb 1 2012 Dan Walsh <dwalsh@redhat.com> - 0.3.3-2
- Update to upstream
- Write pid file
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.2-1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Wed Jan 5 2011 Ted X Toth <txtoth@gmail.com> - 0.3.2-0
- Add constraints
- Add setrans.conf man page
- Fix mixed raw and translated range bug
- Moved todo comments to TODO file
* Fri Oct 16 2009 Dan Walsh <dwalsh@redhat.com> 0.3.1-4
- Add mcstransd man page
* Thu Sep 17 2009 Miroslav Grepl <mgrepl@redhat.com> 0.3.1-3
- Fix init script
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Thu Feb 5 2009 Joe Nall <joe@nall.com> 0.3.1-1
- Rewrite translations to allow individual word/category mapping
- Eamon Walsh's color mapping changes
* Wed May 28 2008 Tom "spot" Callaway <tcallawa@redhat.com> 0.2.11-2
- fix license tag
* Wed May 7 2008 Dan Walsh <dwalsh@redhat.com> 0.2.11-1
- More fixes from Jim Meyering
* Tue May 6 2008 Dan Walsh <dwalsh@redhat.com> 0.2.10-1
- More error checking on failed strdup
* Tue May 6 2008 Dan Walsh <dwalsh@redhat.com> 0.2.9-1
- Start mcstrans before netlabel
* Mon Apr 14 2008 Dan Walsh <dwalsh@redhat.com> 0.2.8-1
- Fix error handling
* Tue Feb 12 2008 Dan Walsh <dwalsh@redhat.com> 0.2.7-2
- Rebuild for gcc 4.3
* Tue Oct 30 2007 Steve Conklin <sconklin@redhat.com> - 0.2.7-1
- Folded current patches into tarball
* Thu Oct 25 2007 Steve Conklin <sconklin@redhat.com> - 0.2.6-3
- Fixed a compile problem with max_categories
* Thu Oct 25 2007 Steve Conklin <sconklin@redhat.com> - 0.2.6-2
- Fixed some init script errors
* Thu Sep 13 2007 Dan Walsh <dwalsh@redhat.com> 0.2.6-1
- Check for max_categories and error out
* Thu Mar 1 2007 Dan Walsh <dwalsh@redhat.com> 0.2.5-1
- Fix case where s0=""
* Mon Feb 26 2007 Dan Walsh <dwalsh@redhat.com> 0.2.4-1
- Translate range if fully specified correctly
* Mon Feb 12 2007 Dan Walsh <dwalsh@redhat.com> 0.2.3-1
- Additional fix to handle ssh root/sysadm_r/s0:c1,c2
Resolves: #224637
* Mon Feb 5 2007 Dan Walsh <dwalsh@redhat.com> 0.2.1-1
- Rewrite to handle MLS properly
Resolves: #225355
* Mon Jan 29 2007 Dan Walsh <dwalsh@redhat.com> 0.1.10-2
- Cleanup memory when complete
* Mon Dec 4 2006 Dan Walsh <dwalsh@redhat.com> 0.1.10-1
- Fix Memory Leak
Resolves: #218173
* Thu Sep 21 2006 Dan Walsh <dwalsh@redhat.com> 0.1.9-1
- Add -pie
- Fix compiler warnings
- Fix Memory Leak
Resolves: #218173
* Wed Sep 13 2006 Peter Jones <pjones@redhat.com> - 0.1.8-3
- Fix subsys locking in init script
* Wed Aug 23 2006 Dan Walsh <dwalsh@redhat.com> 0.1.8-1
- Only allow one version to run
* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - sh: line 0: fg: no job control
- rebuild
* Mon Jun 19 2006 Dan Walsh <dwalsh@redhat.com> 0.1.7-1
- Apply sgrubb patch to only call getpeercon on translations
* Tue Jun 6 2006 Dan Walsh <dwalsh@redhat.com> 0.1.6-1
- Exit gracefully when selinux is not enabled
* Mon May 15 2006 Dan Walsh <dwalsh@redhat.com> 0.1.5-1
- Fix sighup handling
* Mon May 15 2006 Dan Walsh <dwalsh@redhat.com> 0.1.4-1
- Add patch from sgrubb
- Fix 64 bit size problems
- Increase the open file limit
- Make sure maximum size is not exceeded
* Fri May 12 2006 Dan Walsh <dwalsh@redhat.com> 0.1.3-1
- Move initscripts to /etc/rc.d/init.d
* Thu May 11 2006 Dan Walsh <dwalsh@redhat.com> 0.1.2-1
- Drop Privs
* Mon May 8 2006 Dan Walsh <dwalsh@redhat.com> 0.1.1-1
- Initial Version
- This daemon reuses the code from libsetrans

12
mcstransd.service Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description= Daemon used to translate SELinux MCS/MLS labels to human readable form
After=syslog.target
ConditionPathExists=/etc/selinux/mls/setrans.d
[Service]
Type=forking
PIDFile=/run/mcstransd.pid
ExecStart=/usr/sbin/mcstransd
[Install]
WantedBy=multi-user.target

180
secolor.conf.8 Normal file
View File

@ -0,0 +1,180 @@
.TH "secolor.conf" "8" "08 April 2011" "SELinux API documentation"
.SH "NAME"
secolor.conf \- The SELinux color configuration file
.
.SH "DESCRIPTION"
The
.I /etc/selinux/{SELINUXTYPE}/secolor.conf
configuation file controls the color to be associated to the context components associated to the
.I raw
context passed by
.BR selinux_raw_context_to_color "(3),"
when context related information is to be displayed in color by an SELinux-aware application.
.sp
.BR selinux_raw_context_to_color "(3)"
obtains this color information from the active policy
.B secolor.conf
file as returned by
.BR selinux_colors_path "(3)."
.
.SH "FILE FORMAT"
The file format is as follows:
.RS
.B color
.I color_name
.BI "= #"color_mask
.br
[...]
.sp
.I context_component string
.B =
.I fg_color_name bg_color_name
.br
[...]
.sp
.RE
Where:
.br
.B color
.RS
The color keyword. Each color entry is on a new line.
.RE
.I color_name
.RS
A single word name for the color (e.g. red).
.RE
.I color_mask
.RS
A color mask starting with a hash (#) that describes the hexadecimal RGB colors with black being #000000 and white being #ffffff.
.RE
.I context_component
.RS
The context component name that must be one of the following:
.br
.RS
user, role, type or range
.RE
Each
.IR context_component " " string " ..."
entry is on a new line.
.RE
.I string
.RS
This is the
.I context_component
string that will be matched with the
.I raw
context component passed by
.BR selinux_raw_context_to_color "(3)."
.br
A wildcard '*' may be used to match any undefined string for the user, role and type
.I context_component
entries only.
.RE
.I fg_color_name
.RS
The color_name string that will be used as the foreground color.
A
.I color_mask
may also be used.
.RE
.I bg_color_name
.RS
The color_name string that will be used as the background color.
A
.I color_mask
may also be used.
.RE
.
.SH "EXAMPLES"
Example 1 entries are:
.RS
color black = #000000
.br
color green = #008000
.br
color yellow = #ffff00
.br
color blue = #0000ff
.br
color white = #ffffff
.br
color red = #ff0000
.br
color orange = #ffa500
.br
color tan = #D2B48C
.sp
user * = black white
.br
role * = white black
.br
type * = tan orange
.br
range s0\-s0:c0.c1023 = black green
.br
range s1\-s1:c0.c1023 = white green
.br
range s3\-s3:c0.c1023 = black tan
.br
range s5\-s5:c0.c1023 = white blue
.br
range s7\-s7:c0.c1023 = black red
.br
range s9\-s9:c0.c1023 = black orange
.br
range s15:c0.c1023 = black yellow
.RE
.sp
Example 2 entries are:
.RS
color black = #000000
.br
color green = #008000
.br
color yellow = #ffff00
.br
color blue = #0000ff
.br
color white = #ffffff
.br
color red = #ff0000
.br
color orange = #ffa500
.br
color tan = #d2b48c
.sp
user unconfined_u = #ff0000 green
.br
role unconfined_r = red #ffffff
.br
type unconfined_t = red orange
.br
user user_u = black green
.br
role user_r = white black
.br
type user_t = tan red
.br
user xguest_u = black yellow
.br
role xguest_r = black red
.br
type xguest_t = black green
.br
user sysadm_u = white black
.br
range s0:c0.c1023 = black white
.br
user * = black white
.br
role * = black white
.br
type * = black white
.RE
.
.SH "SEE ALSO"
.BR mcstransd "(8), " selinux_raw_context_to_color "(3), " selinux_colors_path "(3)"

View File

@ -0,0 +1 @@
SHA512 (mcstrans-3.1.tar.gz) = 21e9b7a8c9d98cbee61f2eb1c440a51d19ac111a5955c24d365a8784e1aa34fb47a22a108e550c8a4cde4f25ec5afc466126a68e9faedfc796bef83eada93b60