Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
fixture: Add missing trailing NUL in security.selinux xattr
Browse files Browse the repository at this point in the history
Because we were only doing bare-user checkouts in the test
suite (and not trying to physically materialize the xattrs)
and because ostree today doesn't validate xattrs, this
problem was silently ignored.  But I was looking at
changing the tests to do a checkout, and this caused confusing
failures.

Add the missing trailing `NUL`.  Also while we're here,
split the xattr function in two; one which returns the
Rust-native value and a wrapper which converts to GVariant.

This will be useful later.
  • Loading branch information
cgwalters committed Jun 1, 2024
1 parent 1ac39fc commit a9b88e4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/src/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,12 @@ impl SeLabel {
}
}

pub fn xattrs(&self) -> Vec<(&[u8], &[u8])> {
vec![(b"security.selinux\0", self.to_str().as_bytes())]
}

pub fn new_xattrs(&self) -> glib::Variant {
vec![("security.selinux".as_bytes(), self.to_str().as_bytes())].to_variant()
self.xattrs().to_variant()
}
}

Expand Down

0 comments on commit a9b88e4

Please sign in to comment.