fhs.c: Correct permissions for /var/mail and /tmp

Message ID 20230915151910.1140-1-adolf.belka@ipfire.org
State Accepted
Headers
Series fhs.c: Correct permissions for /var/mail and /tmp |

Commit Message

Adolf Belka Sept. 15, 2023, 3:19 p.m. UTC
  - /var/mail is looking for 0755 but dma is setting 02775
   checking FHS it looks like the settings should be 02775
- /tmp is being checked for 1755 instead of 01755 so the number is
   not being recognised as octal but as decimal
- The /var/mail change confirmed to allow dma to be built in ipfire3.x
   without failing for FHS errors

Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 src/libpakfire/fhs.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
  

Patch

diff --git a/src/libpakfire/fhs.c b/src/libpakfire/fhs.c
index 94fe6667..a7a62267 100644
--- a/src/libpakfire/fhs.c
+++ b/src/libpakfire/fhs.c
@@ -97,17 +97,19 @@  static const struct pakfire_fhs_check {
 	{ "/usr/lib/firmware/**", S_IFDIR, 0755, "root", "root", 0 },
 
 	// /var
-	{ "/var",                 S_IFDIR, 0755, "root", "root", 0 },
-	{ "/var/cache",           S_IFDIR, 0755, "root", "root", 0 },
-	{ "/var/db",              S_IFDIR, 0755, "root", "root", 0 },
-	{ "/var/empty",           S_IFDIR, 0755, "root", "root", 0 },
-	{ "/var/lib",             S_IFDIR, 0755, "root", "root", 0 },
-	{ "/var/log",             S_IFDIR, 0755, "root", "root", 0 },
-	{ "/var/mail",            S_IFDIR, 0755, "root", "mail", 0 },
-	{ "/var/opt",             S_IFDIR, 0755, "root", "root", 0 },
-	{ "/var/run",             S_IFLNK, 0755, "root", "root", 0 },
-	{ "/var/spool",           S_IFDIR, 0755, "root", "root", 0 },
-	{ "/var/tmp",             S_IFDIR, 0755, "root", "root", 0 },
+	// The first 0 in the permissions defines that the number is octal whether
+	// three or four digits are used
+	{ "/var",                 S_IFDIR, 0755,  "root", "root", 0 },
+	{ "/var/cache",           S_IFDIR, 0755,  "root", "root", 0 },
+	{ "/var/db",              S_IFDIR, 0755,  "root", "root", 0 },
+	{ "/var/empty",           S_IFDIR, 0755,  "root", "root", 0 },
+	{ "/var/lib",             S_IFDIR, 0755,  "root", "root", 0 },
+	{ "/var/log",             S_IFDIR, 0755,  "root", "root", 0 },
+	{ "/var/mail",            S_IFDIR, 02775, "root", "mail", 0 },
+	{ "/var/opt",             S_IFDIR, 0755,  "root", "root", 0 },
+	{ "/var/run",             S_IFLNK, 0755,  "root", "root", 0 },
+	{ "/var/spool",           S_IFDIR, 0755,  "root", "root", 0 },
+	{ "/var/tmp",             S_IFDIR, 0755,  "root", "root", 0 },
 
 	// Do not allow any subdirectories in /var
 	{ "/var/*",                     0,    0,   NULL,   NULL, PAKFIRE_FHS_MUSTNOTEXIST },
@@ -165,7 +167,7 @@  static const struct pakfire_fhs_check {
 	{ "/sys/**",                    0,    0,   NULL,   NULL, PAKFIRE_FHS_MUSTNOTEXIST },
 
 	// /tmp
-	{ "/tmp",                 S_IFDIR, 1755, "root", "root", 0 },
+	{ "/tmp",                 S_IFDIR, 01755, "root", "root", 0 },
 	{ "/tmp/**",                    0,    0,   NULL,   NULL, PAKFIRE_FHS_MUSTNOTEXIST },
 
 	// FHS Directories