* Use IRIX semantics or Linux semantics if pertinent.
*/
-#include "global.h"
-
#include <errno.h>
-#include <acl.h>
+#include <stdio.h>
+#include <string.h>
+#include <getopt.h>
+#include <sys/acl.h>
char *prog;
int irixsemantics = 0;
return acl;
}
+void
+test_acl_get_qualifier(void)
+{
+ struct acl_entry ace;
+ uid_t *uidp;
+
+ printf("*** test out acl_get_qualifier ***\n");
+
+ /* simple ace */
+ ace.ae_tag = ACL_USER;
+ ace.ae_id = 1;
+ ace.ae_perm = 1;
+
+ /* make sure we can get uid and free it */
+ uidp = acl_get_qualifier(&ace);
+ printf("uid = %d\n", *uidp);
+ acl_free(uidp);
+
+ /* change to another valid tag with a qualifier */
+ ace.ae_tag = ACL_GROUP;
+ uidp = acl_get_qualifier(&ace);
+ printf("uid = %d\n", *uidp);
+ acl_free(uidp);
+
+ /* let's get some errors */
+
+ ace.ae_tag = ACL_USER_OBJ;
+ uidp = acl_get_qualifier(&ace);
+ if (uidp == NULL)
+ printf("uidp is NULL: %s\n", strerror(errno));
+ else
+ printf("Error: uidp is NOT NULL\n");
+
+ uidp = acl_get_qualifier(NULL);
+ if (uidp == NULL)
+ printf("uidp is NULL: %s\n", strerror(errno));
+ else
+ printf("Error: uidp is NOT NULL\n");
+}
+
int
main(int argc, char **argv)
{
dump_acl_by_entry(acl3);
/* ---------------------------------------------- */
+ printf("*** test out ACL to text for empty ACL***\n");
+ {
+ char *text;
+ ssize_t len;
+ acl_t empty_acl = acl_init(0);
+ text = acl_to_text(empty_acl, NULL);
+ printf("acl_to_text(empty_acl,NULL) -> \"%s\"\n", text);
+ text = acl_to_text(empty_acl, &len);
+ printf("acl_to_text(empty_acl,NULL) -> \"%s\", len = %u\n", text, len);
+ text = acl_to_text(NULL, NULL);
+ printf("acl_to_text(NULL,NULL) -> \"%s\"\n", text==NULL?"NULL":text);
+ }
+ /* NOTE: Other tests will test out the text for ACLs with ACEs.
+ * So don't have to test it here.
+ * It is simplest to choose ids not in /etc/passwd /etc/group
+ * which is done already in a script.
+ */
+
+ test_acl_get_qualifier();
return 0;
}