The rights profile data is spread between two databases: prof_attr(4) and exec_attr(4). There are two corresponding interface families for accessing rights profiles data: getprofattr(3SECDB) and getexecattr(3SECDB).
The getprofattr function enumerates the prof_attr entries. The getprofnam function searches for a prof_attr entry with a given name. The getproflist function searches for supplementary profiles.
An example program using the getprofattr function follows.
#include <stdio.h> #include <prof_attr.h> main(int argc, char *argv[]) { profattr_t *profp = NULL; int i; char *kv_str = NULL; char *attr[] = { PROFATTR_AUTHS_KW, PROFATTR_PROFS_KW, "help", NULL }; if (argc != 2) { printf("\tUsage: %s \"profile name\"\n", argv[0]); printf("\t\tPut multi-word profile names in quotes\n"); exit(1); } if ((profp = getprofnam(argv[1])) == NULL) { printf("\tNo prof_attr entry found for %s\n", argv[1]); exit(0); } if (profp->name) printf("\t%s: %s\n", PROFATTR_COL0_KW, profp->name); if (profp->res1) printf("\t%s: %s\n", PROFATTR_COL1_KW, profp->res1); if (profp->res2) printf("\t%s: %s\n", PROFATTR_COL2_KW, profp->res2); if (profp->desc) printf("\t%s: %s\n", PROFATTR_COL3_KW, profp->desc); if (profp->attr) { for (i = 0; attr[i] != NULL; i++) { if (kv_str = kva_match(profp->attr, attr[i])) printf("\t%s: %s\n", attr[i], kv_str); } } free_profattr(profp); }
This program gets the six fields in the argument's prof_attr record and dumps them to a display as follows:
% getprof ``Media Backup'' name: Media Backup res1: res2: desc: Backup files and file systems auths: solaris.device.allocate help: RtMediaBkup.html |