Message ID | 20210816165459.1741490-1-zhangkelvin@google.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | Improve error message for label file validation | expand |
On Mon, Aug 16, 2021 at 12:55 PM Kelvin Zhang <zhangkelvin@google.com> wrote: > > From: Kelvin Zhang <zhangxp1998@gmail.com> > > Signed-off-by: Kelvin Zhang <zhangxp1998@gmail.com> This is not what I normally work on, but it looks fine to me. Acked-by: James Carter <jwcart2@gmail.com> > --- > libselinux/src/label_file.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/libselinux/src/label_file.c b/libselinux/src/label_file.c > index 56f499fa..2e28d047 100644 > --- a/libselinux/src/label_file.c > +++ b/libselinux/src/label_file.c > @@ -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 >
On Thu, Aug 19, 2021 at 3:22 PM James Carter <jwcart2@gmail.com> wrote: > > On Mon, Aug 16, 2021 at 12:55 PM Kelvin Zhang <zhangkelvin@google.com> wrote: > > > > From: Kelvin Zhang <zhangxp1998@gmail.com> > > > > Signed-off-by: Kelvin Zhang <zhangxp1998@gmail.com> > > This is not what I normally work on, but it looks fine to me. > > Acked-by: James Carter <jwcart2@gmail.com> > Merged. Thanks, Jim > > --- > > libselinux/src/label_file.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/libselinux/src/label_file.c b/libselinux/src/label_file.c > > index 56f499fa..2e28d047 100644 > > --- a/libselinux/src/label_file.c > > +++ b/libselinux/src/label_file.c > > @@ -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 > >
diff --git a/libselinux/src/label_file.c b/libselinux/src/label_file.c index 56f499fa..2e28d047 100644 --- a/libselinux/src/label_file.c +++ b/libselinux/src/label_file.c @@ -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; }