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 GETUSERATTR 3SECDB "Mar 31, 2005"
   7 .SH NAME
   8 getuserattr, getusernam, getuseruid, free_userattr, setuserattr, enduserattr,
   9 fgetuserattr \- get user_attr entry
  10 .SH SYNOPSIS
  11 .LP
  12 .nf
  13 cc [ \fIflag\fR... ] \fIfile\fR... -lsecdb  -lsocket  -lnsl [ \fIlibrary\fR... ]
  14 #include <user_attr.h>
  15 
  16 \fBuserattr_t *\fR\fBgetuserattr\fR(\fBvoid\fR);
  17 .fi
  18 
  19 .LP
  20 .nf
  21 \fBuserattr_t *\fR\fBgetusernam\fR(\fBconst char *\fR\fI\fR\fIname\fR);
  22 .fi
  23 
  24 .LP
  25 .nf
  26 \fBuserattr_t *\fR\fBgetuseruid\fR(\fBuid_t\fR \fIuid\fR);
  27 .fi
  28 
  29 .LP
  30 .nf
  31 \fBvoid\fR \fBfree_userattr\fR(\fBuserattr_t *\fR\fIuserattr\fR);
  32 .fi
  33 
  34 .LP
  35 .nf
  36 \fBvoid\fR \fBsetuserattr\fR(\fBvoid\fR);
  37 .fi
  38 
  39 .LP
  40 .nf
  41 \fBvoid\fR \fBenduserattr\fR(\fBvoid\fR);
  42 .fi
  43 
  44 .LP
  45 .nf
  46 \fBuserattr_t *\fR\fBfgetuserattr\fR(\fBFILE *\fR\fIf\fR);
  47 .fi
  48 
  49 .SH DESCRIPTION
  50 .sp
  51 .LP
  52 The \fBgetuserattr()\fR, \fBgetusernam()\fR, and \fBgetuseruid()\fR functions
  53 each return a \fBuser_attr\fR(4) entry. Entries can come from any of the
  54 sources specified in the \fBnsswitch.conf\fR(4) file. The \fBgetuserattr()\fR
  55 function enumerates \fBuser_attr\fR entries. The \fBgetusernam()\fR function
  56 searches for a \fBuser_attr\fR entry with a given user name \fIname\fR. The
  57 \fBgetuseruid()\fR function searches for a \fBuser_attr\fR entry with a given
  58 user ID \fIuid\fR. Successive calls to these functions return either successive
  59 \fBuser_attr\fR entries or \fINULL\fR.
  60 .sp
  61 .LP
  62 The \fBfgetuserattr()\fR function does not use \fBnsswitch.conf\fR but reads
  63 and parses the next line from the stream \fIf\fR. This stream is assumed to
  64 have the format of the \fBuser_attr\fR files.
  65 .sp
  66 .LP
  67 The \fBfree_userattr()\fR function releases memory allocated by the
  68 \fBgetusernam()\fR, \fBgetuserattr()\fR, and \fBfgetuserattr()\fR functions.
  69 .sp
  70 .LP
  71 The internal representation of a \fBuser_attr\fR entry is a \fBuserattr_t\fR
  72 structure defined in <\fBuser_attr.h\fR> with the following members:
  73 .sp
  74 .in +2
  75 .nf
  76 char  *name;       /* name of the user */
  77 char  *qualifier;  /* reserved for future use */
  78 char  *res1;       /* reserved for future use */
  79 char  *res2;       /* reserved for future use */
  80 kva_t *attr;       /* list of attributes */
  81 .fi
  82 .in -2
  83 
  84 .sp
  85 .LP
  86 The \fBsetuserattr()\fR function "rewinds" to the beginning of the enumeration
  87 of \fBuser_attr\fR entries.  Calls to \fBgetusernam()\fR may leave the
  88 enumeration in an indeterminate state, so \fBsetuserattr()\fR should be called
  89 before the first call to \fBgetuserattr()\fR.
  90 .sp
  91 .LP
  92 The \fBenduserattr()\fR function may be called to indicate that \fBuser_attr\fR
  93 processing is complete; the library may then close any open \fBuser_attr\fR
  94 file, deallocate any internal storage, and so forth.
  95 .SH RETURN VALUES
  96 .sp
  97 .LP
  98 The \fBgetuserattr()\fR function returns a pointer to a \fBuserattr_t\fR if it
  99 successfully enumerates an entry; otherwise it returns \fINULL\fR, indicating
 100 the end of the enumeration.
 101 .sp
 102 .LP
 103 The \fBgetusernam()\fR function returns a pointer to a \fBuserattr_t\fR if it
 104 successfully locates the requested entry; otherwise it returns \fINULL\fR.
 105 .SH USAGE
 106 .sp
 107 .LP
 108 The \fBgetuserattr()\fR and \fBgetusernam()\fR functions both allocate memory
 109 for the pointers they return. This memory should be deallocated with the
 110 \fBfree_userattr()\fR function.
 111 .sp
 112 .LP
 113 Individual attributes can be referenced in the \fBattr\fR structure by calling
 114 the \fBkva_match\fR(3SECDB) function.
 115 .SH WARININGS
 116 .sp
 117 .LP
 118 Because the list of legal keys is likely to expand, code  must be written to
 119 ignore unknown key-value pairs without error.
 120 .SH FILES
 121 .sp
 122 .ne 2
 123 .na
 124 \fB\fB/etc/user_attr\fR\fR
 125 .ad
 126 .RS 22n
 127 extended user attributes
 128 .RE
 129 
 130 .sp
 131 .ne 2
 132 .na
 133 \fB\fB/etc/nsswitch.conf\fR\fR
 134 .ad
 135 .RS 22n
 136 configuration file lookup information for the name server switch
 137 .RE
 138 
 139 .SH ATTRIBUTES
 140 .sp
 141 .LP
 142 See \fBattributes\fR(5) for descriptions of the following attributes:
 143 .sp
 144 
 145 .sp
 146 .TS
 147 box;
 148 c | c
 149 l | l .
 150 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 151 _
 152 MT-Level        MT-Safe
 153 .TE
 154 
 155 .SH SEE ALSO
 156 .sp
 157 .LP
 158 \fBgetauthattr\fR(3SECDB), \fBgetexecattr\fR(3SECDB),
 159 \fBgetprofattr\fR(3SECDB), \fBuser_attr\fR(4), \fBattributes\fR(5)