Skip to content

Instantly share code, notes, and snippets.

@brianwells
Created March 6, 2017 04:46
Show Gist options
  • Save brianwells/ac3a4f9d41cde9cf38a4dc5deb7a80ee to your computer and use it in GitHub Desktop.
Save brianwells/ac3a4f9d41cde9cf38a4dc5deb7a80ee to your computer and use it in GitHub Desktop.
Dump Mac File ACLs
#include <stdio.h>
#include <sys/types.h>
#include <sys/acl.h>
int main(int argc, const char * argv[])
{
int i = 1;
while (i < argc) {
printf("%s\n",argv[i]);
acl_t acl = acl_get_file(argv[i], ACL_TYPE_EXTENDED);
if (acl) {
char *text = acl_to_text(acl, NULL);
if (text) {
printf("%s",text);
acl_free(text);
}
acl_free(acl);
}
i++;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment