Skip to contentSkip to conversation

Improve error message for label file validation

PATCH In review Kelvin Zhang 2 participants 3 messages Aug 16, 2021 – Aug 23, 2021 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Improve error message for label file validation

From: Kelvin Zhang <[email protected]>

---
 libselinux/src/label_file.c | 3 +++
 1 file changed, 3 insertions(+)
libselinux/src/label_file.c +3 -0
index 56f499fa..2e28d047 100644
@@ -188,6 +188,9 @@ static int load_mmap(FILE *fp, size_t len, struct selabel_handle *rec,
 
 		str_buf[entry_len] = '\0';
 		if ((strcmp(str_buf, reg_version) != 0)) {
+			COMPAT_LOG(SELINUX_ERROR,
+				"Regex version mismatch, expected: %s actual: %s\n",
+				reg_version, str_buf);
 			free(str_buf);
 			return -1;
 		}
Signature · 1 line
2.33.0.rc1.237.g0d66db33f3-goog
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Kelvin Zhang

From: Kelvin Zhang <[email protected]>

This is not what I normally work on, but it looks fine to me.

Quoted 21 lines
---
 libselinux/src/label_file.c | 3 +++
 1 file changed, 3 insertions(+)
libselinux/src/label_file.c +3 -1
index 56f499fa..2e28d047 100644
@@ -188,6 +188,9 @@ static int load_mmap(FILE *fp, size_t len, struct selabel_handle *rec,
 
                str_buf[entry_len] = '\0';
                if ((strcmp(str_buf, reg_version) != 0)) {
+                       COMPAT_LOG(SELINUX_ERROR,
+                               "Regex version mismatch, expected: %s actual: %s\n",
+                               reg_version, str_buf);
                        free(str_buf);
                        return -1;
                }
--

2.33.0.rc1.237.g0d66db33f3-goog

#2 lore raw
Quoted 11 lines · James Carter
Quoted 4 lines · Kelvin Zhang

From: Kelvin Zhang <[email protected]>

This is not what I normally work on, but it looks fine to me.

Merged.
Thanks,
Jim

Quoted 21 lines
Quoted 21 lines
---
 libselinux/src/label_file.c | 3 +++
 1 file changed, 3 insertions(+)
libselinux/src/label_file.c +3 -1
index 56f499fa..2e28d047 100644
@@ -188,6 +188,9 @@ static int load_mmap(FILE *fp, size_t len, struct selabel_handle *rec,
 
                str_buf[entry_len] = '\0';
                if ((strcmp(str_buf, reg_version) != 0)) {
+                       COMPAT_LOG(SELINUX_ERROR,
+                               "Regex version mismatch, expected: %s actual: %s\n",
+                               reg_version, str_buf);
                        free(str_buf);
                        return -1;
                }
--

2.33.0.rc1.237.g0d66db33f3-goog