From e09bcff3d2248d588cf79069a996441c41389f04 Mon Sep 17 00:00:00 2001 From: Nicolas Iooss Date: Sun, 1 Sep 2019 16:07:41 +0200 Subject: [PATCH 1/2] cups: add a slash to match /opt/brother/Printers/ The pattern /opt/brother/Printers(.*/)?inf(/.*)? matches the content of directories such as /opt/brother/Printersinf/, which seems buggy. On several systems, /opt/brother/Printers/ is a directory that contains directories named as printer models. Add a "/" before "(.*/)?" in order to make sure subdirectories of /opt/brother/Printers named "inf" are matched by the pattern. Signed-off-by: Nicolas Iooss --- policy/modules/services/cups.fc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/policy/modules/services/cups.fc b/policy/modules/services/cups.fc index 43c4616a8..f0b0e1a08 100644 --- a/policy/modules/services/cups.fc +++ b/policy/modules/services/cups.fc @@ -18,7 +18,7 @@ /etc/printcap.* -- gen_context(system_u:object_r:cupsd_rw_etc_t,s0) -/opt/brother/Printers(.*/)?inf(/.*)? gen_context(system_u:object_r:cupsd_rw_etc_t,s0) +/opt/brother/Printers/(.*/)?inf(/.*)? gen_context(system_u:object_r:cupsd_rw_etc_t,s0) /opt/gutenprint/ppds(/.*)? gen_context(system_u:object_r:cupsd_rw_etc_t,s0) /usr/bin/hp-[^/]+ -- gen_context(system_u:object_r:hplip_exec_t,s0) From b8f2c55109ba3651bce47f2ace1ba165b5f22b1b Mon Sep 17 00:00:00 2001 From: Nicolas Iooss Date: Wed, 4 Sep 2019 20:57:07 +0200 Subject: [PATCH 2/2] cups: use ([^/]+/)? to match a subdirectory of CUPS configuration It seems that /opt/brother/Printers/ only has one level of directories before a directory named "inf", according to several websites. For example: * https://www.linuxquestions.org/questions/slackware-14/trying-to-add-driver-for-brother-hl-l2300d-4175535636/ * https://forums.opensuse.org/showthread.php/531271-Brother-printer-driver-installs-but-can-t-print/page2 Modify the pattern for /opt/brother/Printers/${MODEL_NAME}/inf in order to only allow at most one level, with "([^/]+/)?". Signed-off-by: Nicolas Iooss --- policy/modules/services/cups.fc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/policy/modules/services/cups.fc b/policy/modules/services/cups.fc index f0b0e1a08..950c288d5 100644 --- a/policy/modules/services/cups.fc +++ b/policy/modules/services/cups.fc @@ -18,7 +18,7 @@ /etc/printcap.* -- gen_context(system_u:object_r:cupsd_rw_etc_t,s0) -/opt/brother/Printers/(.*/)?inf(/.*)? gen_context(system_u:object_r:cupsd_rw_etc_t,s0) +/opt/brother/Printers/([^/]+/)?inf(/.*)? gen_context(system_u:object_r:cupsd_rw_etc_t,s0) /opt/gutenprint/ppds(/.*)? gen_context(system_u:object_r:cupsd_rw_etc_t,s0) /usr/bin/hp-[^/]+ -- gen_context(system_u:object_r:hplip_exec_t,s0)