1 '\" te 2 .\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved. 3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. 4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. 5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] 6 .TH GETPROFATTR 3SECDB "Mar 31, 2005" 7 .SH NAME 8 getprofattr, getprofnam, free_profattr, setprofattr, endprofattr, getproflist, 9 free_proflist \- get profile description and attributes 10 .SH SYNOPSIS 11 .LP 12 .nf 13 cc [ \fIflag\fR... ] \fIfile\fR... -lsecdb -lsocket -lnsl [ \fIlibrary\fR... ] 14 #include <prof_attr.h> 15 16 \fBprofattr_t *\fR\fBgetprofattr\fR(\fBvoid\fR); 17 .fi 18 19 .LP 20 .nf 21 \fBprofattr_t *\fR\fBgetprofnam\fR(\fBconst char *\fR\fI\fR\fIname\fR); 22 .fi 23 24 .LP 25 .nf 26 \fBvoid\fR \fBfree_profattr\fR(\fBprofattr_t *\fR\fIpd\fR); 27 .fi 28 29 .LP 30 .nf 31 \fBvoid\fR \fBsetprofattr\fR(\fBvoid\fR); 32 .fi 33 34 .LP 35 .nf 36 \fBvoid\fR \fBendprofattr\fR(\fBvoid\fR); 37 .fi 38 39 .LP 40 .nf 41 \fBvoid\fR \fBgetproflist\fR(\fBconst char *\fR\fIprofname\fR, \fBchar **\fR\fIproflist\fR, \fBint *\fR\fIprofcnt\fR); 42 .fi 43 44 .LP 45 .nf 46 \fBvoid\fR \fBfree_proflist\fR(\fBchar **\fR\fIproflist\fR, \fBint\fR \fIprofcnt\fR); 47 .fi 48 49 .SH DESCRIPTION 50 .sp 51 .LP 52 The \fBgetprofattr()\fR and \fBgetprofnam()\fR functions each return a 53 \fBprof_attr\fR entry. Entries can come from any of the sources specified in 54 the \fBnsswitch.conf\fR(4) file. 55 .sp 56 .LP 57 The \fBgetprofattr()\fR function enumerates \fBprof_attr\fR entries. The 58 \fBgetprofnam()\fR function searches for a \fBprof_attr\fR entry with a given 59 \fIname\fR. Successive calls to these functions return either successive 60 \fBprof_attr\fR entries or \fINULL\fR. 61 .sp 62 .LP 63 The internal representation of a \fBprof_attr\fR entry is a \fBprofattr_t\fR 64 structure defined in <\fBprof_attr.h\fR> with the following members: 65 .sp 66 .in +2 67 .nf 68 char *name; /* Name of the profile */ 69 char *res1; /* Reserved for future use */ 70 char *res2; /* Reserved for future use */ 71 char *desc; /* Description/Purpose of the profile */ 72 kva_t *attr; /* Profile attributes */ 73 .fi 74 .in -2 75 76 .sp 77 .LP 78 The \fBfree_profattr()\fR function releases memory allocated by the 79 \fBgetprofattr()\fR and \fBgetprofnam()\fR functions. 80 .sp 81 .LP 82 The \fBsetprofattr()\fR function "rewinds" to the beginning of the enumeration 83 of \fBprof_attr\fR entries. Calls to \fBgetprofnam()\fR can leave the 84 enumeration in an indeterminate state. Therefore, \fBsetprofattr()\fR should 85 be called before the first call to \fBgetprofattr()\fR. 86 .sp 87 .LP 88 The \fBendprofattr()\fR function may be called to indicate that \fBprof_attr\fR 89 processing is complete; the system may then close any open \fBprof_attr\fR 90 file, deallocate storage, and so forth. 91 .sp 92 .LP 93 The \fBgetproflist()\fR function searches for the list of sub-profiles found in 94 the given \fIprofname\fR and allocates memory to store this list in 95 \fIproflist\fR. The given \fIprofname\fR will be included in the list of 96 sub-profiles. The \fIprofcnt\fR argument indicates the number of items 97 currently valid in \fIproflist\fR. Memory allocated by \fBgetproflist()\fR 98 should be freed using the \fBfree_proflist()\fR function. 99 .sp 100 .LP 101 The \fBfree_proflist()\fR function frees memory allocated by the 102 \fBgetproflist()\fR function. The \fIprofcnt\fR argument specifies the number 103 of items to free from the \fIproflist\fR argument. 104 .SH RETURN VALUES 105 .sp 106 .LP 107 The \fBgetprofattr()\fR function returns a pointer to a \fBprofattr_t\fR if it 108 successfully enumerates an entry; otherwise it returns \fINULL\fR, indicating 109 the end of the enumeration. 110 .sp 111 .LP 112 The \fBgetprofnam()\fR function returns a pointer to a \fBprofattr_t\fR if it 113 successfully locates the requested entry; otherwise it returns \fINULL\fR. 114 .SH USAGE 115 .sp 116 .LP 117 Individual attributes in the \fBprof_attr_t\fR structure can be referred to by 118 calling the \fBkva_match\fR(3SECDB) function. 119 .sp 120 .LP 121 Because the list of legal keys is likely to expand, any code must be written 122 to ignore unknown key-value pairs without error. 123 .sp 124 .LP 125 The \fBgetprofattr()\fR and \fBgetprofnam()\fR functions both allocate memory 126 for the pointers they return. This memory should be deallocated with the 127 \fBfree_profattr()\fR function. 128 .SH FILES 129 .sp 130 .ne 2 131 .na 132 \fB\fB/etc/security/prof_attr\fR\fR 133 .ad 134 .RS 27n 135 profiles and their descriptions 136 .RE 137 138 .SH ATTRIBUTES 139 .sp 140 .LP 141 See \fBattributes\fR(5) for descriptions of the following attributes: 142 .sp 143 144 .sp 145 .TS 146 box; 147 c | c 148 l | l . 149 ATTRIBUTE TYPE ATTRIBUTE VALUE 150 _ 151 MT-Level MT-Safe 152 .TE 153 154 .SH SEE ALSO 155 .sp 156 .LP 157 \fBauths\fR(1), \fBprofiles\fR(1), \fBgetexecattr\fR(3SECDB), 158 \fBgetauthattr\fR(3SECDB), \fBprof_attr\fR(4)