libarchive/libarchive — pull request #42 by priitj (2013-06-17 20:49:35+00:00)
Title: FreeBSD MAC label support (initial version)

Basic support for MAC labels. Label data is stored in archive in text form as xattrs. Behaviour is exactly like xattrs, archive silently by default, extract when explicitly requested.

There are a few obvious ways of making the code more efficient/robust 1. call mac_is_present() once per program invocation and remember the result 2. do text processing of labels to handle each policy separately (each label can contain grade data for multiple policies). Those ideas are not implemented as I decided not to make things more complex without feedback/pointers from people closely involved with MAC development.