Created
March 6, 2017 04:46
-
-
Save brianwells/ac3a4f9d41cde9cf38a4dc5deb7a80ee to your computer and use it in GitHub Desktop.
Dump Mac File ACLs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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