Checks the specified effective rights of one object over another for a specific attribute.
#include <ascauth.h>
int ASC_RIGHTS(ASCENV *asce, char *obj1, char *obj2,
char *attribute, char *rights);
Returns one of the following integer values defined in ascauth.h:
#include <stdio.h>
#include <stdlib.h>
#include <ascauth.h>
main(int argc, char *argv[])
{
ASCENV *asce;
char *obj1, *obj2, *attr, *rights;
int rc;
if (argc != 5) {
fprintf(stderr, "usage: %s <obj1> <obj2> \
<attribute> <rights>\n", argv[0]);
exit(EXIT_FAILURE);
}
obj1 = argv[1];
obj2 = argv[2];
attr = argv[3];
rights = argv[4];
/* initialize the authentication environment */
asce = ASC_INIT(NULL);
if (asce == NULL) {
fprintf(stderr, "Error: cannot initialize authentication environment\n");
exit(EXIT_FAILURE);
}
/* check for rights */
rc = ASC_RIGHTS(asce, obj1, obj2, attr, rights);
if (rc == AS_OK)
printf(“User has rights\n”);
else
printf("RC=%d, %s", rc, ASC_STRERROR(rc));
/* now terminate the authentication environment */
ASC_TERM(asce);
return 0;
}