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 "Aug 13, 2018"
   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 .LP
  51 The \fBgetprofattr()\fR and \fBgetprofnam()\fR functions each return a
  52 \fBprof_attr\fR entry. Entries can come from any of the sources specified in
  53 the \fBnsswitch.conf\fR(4) file.
  54 .sp
  55 .LP
  56 The \fBgetprofattr()\fR function enumerates \fBprof_attr\fR entries. The
  57 \fBgetprofnam()\fR function searches for a \fBprof_attr\fR entry with a given
  58 \fIname\fR. Successive calls to these functions return either successive
  59 \fBprof_attr\fR entries or \fINULL\fR.
  60 .sp
  61 .LP
  62 The internal representation of a \fBprof_attr\fR entry is a \fBprofattr_t\fR
  63 structure defined in <\fBprof_attr.h\fR> with the following members:
  64 .sp
  65 .in +2
  66 .nf
  67 char     *name;   /* Name of the profile */
  68 char     *res1;   /* Reserved for future use */
  69 char     *res2;   /* Reserved for future use */
  70 char     *desc;   /* Description/Purpose of the profile */
  71 kva_t *attr;   /* Profile attributes */
  72 .fi
  73 .in -2
  74 
  75 .sp
  76 .LP
  77 The \fBfree_profattr()\fR function releases memory allocated by the
  78 \fBgetprofattr()\fR and \fBgetprofnam()\fR functions.
  79 .sp
  80 .LP
  81 The \fBsetprofattr()\fR function "rewinds" to the beginning of the enumeration
  82 of \fBprof_attr\fR entries. Calls to \fBgetprofnam()\fR can leave the
  83 enumeration in an indeterminate state. Therefore, \fBsetprofattr()\fR should
  84 be called before the first call to \fBgetprofattr()\fR.
  85 .sp
  86 .LP
  87 The \fBendprofattr()\fR function may be called to indicate that \fBprof_attr\fR
  88 processing is complete; the system may then close any open \fBprof_attr\fR
  89 file, deallocate storage, and so forth.
  90 .sp
  91 .LP
  92 The \fBgetproflist()\fR function searches for the list of sub-profiles found in
  93 the given \fIprofname\fR and allocates memory to store this list in
  94 \fIproflist\fR. The given \fIprofname\fR will be included in the list of
  95 sub-profiles. The \fIprofcnt\fR argument indicates the number of items
  96 currently valid in \fIproflist\fR. Memory allocated by \fBgetproflist()\fR
  97 should be freed using the \fBfree_proflist()\fR function.
  98 .sp
  99 .LP
 100 The \fBfree_proflist()\fR function frees memory allocated by the
 101 \fBgetproflist()\fR function.  The \fIprofcnt\fR argument specifies the number
 102 of items to free from the \fIproflist\fR argument.
 103 .SH RETURN VALUES
 104 .LP
 105 The \fBgetprofattr()\fR function returns a pointer to a \fBprofattr_t\fR if it
 106 successfully enumerates an entry; otherwise it returns \fINULL\fR, indicating
 107 the end of the enumeration.
 108 .sp
 109 .LP
 110 The \fBgetprofnam()\fR function returns a pointer to a \fBprofattr_t\fR if it
 111 successfully locates the requested entry; otherwise it returns \fINULL\fR.
 112 .SH USAGE
 113 .LP
 114 Individual attributes in the \fBprofattr_t\fR structure can be referred to by
 115 calling the \fBkva_match\fR(3SECDB) function.
 116 .sp
 117 .LP
 118 Because the list of legal keys is likely to expand, any code must be written
 119 to ignore unknown key-value pairs without error.
 120 .sp
 121 .LP
 122 The \fBgetprofattr()\fR and \fBgetprofnam()\fR functions both allocate memory
 123 for the pointers they return. This memory should be deallocated with the
 124 \fBfree_profattr()\fR function.
 125 .SH FILES
 126 .ne 2
 127 .na
 128 \fB\fB/etc/security/prof_attr\fR\fR
 129 .ad
 130 .RS 27n
 131 profiles and their descriptions
 132 .RE
 133 
 134 .SH ATTRIBUTES
 135 .LP
 136 See \fBattributes\fR(5) for descriptions of the following attributes:
 137 .sp
 138 
 139 .sp
 140 .TS
 141 box;
 142 c | c
 143 l | l .
 144 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 145 _
 146 MT-Level        MT-Safe
 147 .TE
 148 
 149 .SH SEE ALSO
 150 .LP
 151 \fBauths\fR(1), \fBprofiles\fR(1), \fBgetexecattr\fR(3SECDB),
 152 \fBgetauthattr\fR(3SECDB), \fBkva_match\fR(3SECDB), \fBprof_attr\fR(4),
 153 \fBattributes\fR(5)