1 GETPROFATTR(3SECDB) Security Attributes Database Library Functions 2 3 4 5 NAME 6 getprofattr, getprofnam, free_profattr, setprofattr, endprofattr, 7 getproflist, free_proflist - get profile description and attributes 8 9 SYNOPSIS 10 cc [ flag... ] file... -lsecdb -lsocket -lnsl [ library... ] 11 #include <prof_attr.h> 12 13 profattr_t *getprofattr(void); 14 15 16 profattr_t *getprofnam(const char *name); 17 18 19 void free_profattr(profattr_t *pd); 20 21 22 void setprofattr(void); 23 24 25 void endprofattr(void); 26 27 28 void getproflist(const char *profname, char **proflist, int *profcnt); 29 30 31 void free_proflist(char **proflist, int profcnt); 32 33 34 DESCRIPTION 35 The getprofattr() and getprofnam() functions each return a prof_attr 36 entry. Entries can come from any of the sources specified in the 37 nsswitch.conf(4) file. 38 39 40 The getprofattr() function enumerates prof_attr entries. The 41 getprofnam() function searches for a prof_attr entry with a given name. 42 Successive calls to these functions return either successive prof_attr 43 entries or NULL. 44 45 46 The internal representation of a prof_attr entry is a profattr_t 47 structure defined in <prof_attr.h> with the following members: 48 49 char *name; /* Name of the profile */ 50 char *res1; /* Reserved for future use */ 51 char *res2; /* Reserved for future use */ 52 char *desc; /* Description/Purpose of the profile */ 53 kva_t *attr; /* Profile attributes */ 54 55 56 57 The free_profattr() function releases memory allocated by the 58 getprofattr() and getprofnam() functions. 59 60 61 The setprofattr() function "rewinds" to the beginning of the 62 enumeration of prof_attr entries. Calls to getprofnam() can leave the 63 enumeration in an indeterminate state. Therefore, setprofattr() should 64 be called before the first call to getprofattr(). 65 66 67 The endprofattr() function may be called to indicate that prof_attr 68 processing is complete; the system may then close any open prof_attr 69 file, deallocate storage, and so forth. 70 71 72 The getproflist() function searches for the list of sub-profiles found 73 in the given profname and allocates memory to store this list in 74 proflist. The given profname will be included in the list of sub- 75 profiles. The profcnt argument indicates the number of items currently 76 valid in proflist. Memory allocated by getproflist() should be freed 77 using the free_proflist() function. 78 79 80 The free_proflist() function frees memory allocated by the 81 getproflist() function. The profcnt argument specifies the number of 82 items to free from the proflist argument. 83 84 RETURN VALUES 85 The getprofattr() function returns a pointer to a profattr_t if it 86 successfully enumerates an entry; otherwise it returns NULL, indicating 87 the end of the enumeration. 88 89 90 The getprofnam() function returns a pointer to a profattr_t if it 91 successfully locates the requested entry; otherwise it returns NULL. 92 93 USAGE 94 Individual attributes in the profattr_t structure can be referred to by 95 calling the kva_match(3SECDB) function. 96 97 98 Because the list of legal keys is likely to expand, any code must be 99 written to ignore unknown key-value pairs without error. 100 101 102 The getprofattr() and getprofnam() functions both allocate memory for 103 the pointers they return. This memory should be deallocated with the 104 free_profattr() function. 105 106 FILES 107 /etc/security/prof_attr 108 profiles and their descriptions 109 110 111 ATTRIBUTES 112 See attributes(5) for descriptions of the following attributes: 113 114 115 116 117 +---------------+-----------------+ 118 |ATTRIBUTE TYPE | ATTRIBUTE VALUE | 119 +---------------+-----------------+ 120 |MT-Level | MT-Safe | 121 +---------------+-----------------+ 122 123 SEE ALSO 124 auths(1), profiles(1), getexecattr(3SECDB), getauthattr(3SECDB), 125 kva_match(3SECDB), prof_attr(4), attributes(5) 126 127 128 129 August 13, 2018 GETPROFATTR(3SECDB)