GSS_S_PROMPTING_NEEDED is a bit
[cyrus-sasl.git] / man / sasl_auxprop.3
1 .\" -*- nroff -*-
2 .\" 
3 .\" Copyright (c) 2001 Carnegie Mellon University.  All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\"
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer. 
11 .\"
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in
14 .\"    the documentation and/or other materials provided with the
15 .\"    distribution.
16 .\"
17 .\" 3. The name "Carnegie Mellon University" must not be used to
18 .\"    endorse or promote products derived from this software without
19 .\"    prior written permission. For permission or any other legal
20 .\"    details, please contact  
21 .\"      Office of Technology Transfer
22 .\"      Carnegie Mellon University
23 .\"      5000 Forbes Avenue
24 .\"      Pittsburgh, PA  15213-3890
25 .\"      (412) 268-4387, fax: (412) 268-7395
26 .\"      tech-transfer@andrew.cmu.edu
27 .\"
28 .\" 4. Redistributions of any form whatsoever must retain the following
29 .\"    acknowledgment:
30 .\"    "This product includes software developed by Computing Services
31 .\"     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
32 .\"
33 .\" CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
34 .\" THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
35 .\" AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
36 .\" FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
37 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
38 .\" AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
39 .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
40 .\" 
41 .TH sasl_auxprop "10 July 2001" SASL "SASL man pages"
42 .SH NAME
43 sasl_auxprop \- How to work with SASL auxiliary properties
44
45 .SH SYNOPSIS
46 .nf
47 .B #include <sasl/prop.h>
48
49 .BI "struct propctx *prop_new(unsigned " estimate ") "
50
51 .BI "int prop_dup(struct propctx " *src_ctx ", "
52 .BI "             struct propctx " *dst_ctx ")"
53
54 .BI "int prop_request(struct propctx " *ctx ", "
55 .BI "                 const char " **names ")"
56
57 .BI "const struct propval *prop_get(struct propctx " *ctx ")"
58
59 .BI "int prop_getnames(struct propctx " *ctx ", const char " **names ","
60 .BI "                  struct porpval " *vals ")"
61
62 .BI "void prop_clear(struct propctx " *ctx ", int " requests ")"
63
64 .BI "void prop_erase(struct propctx " *ctx ", const char " *name ")"
65
66 .BI "void prop_dispose(struct propctx " **ctx ")"
67
68 .BI "int prop_format(struct propctx " *ctx ", const char " *sep ", int " seplen ", "
69 .BI "                char " *outbuf ", unsigned " outmax ", unsigned " *outlen ")"
70
71 .BI "int prop_set(struct propctx " *ctx ", const char " *name ","
72 .BI "             const char " *value ", int " vallen ")"
73
74 .BI "int prop_setvals(struct propctx " *ctx ", const char " *name ","
75 .BI "                 const char " **values ")"
76 .SH DESCRIPTION
77
78 .B SASL auxiliary properties
79 are used to obtain properties from external sources during the authentication
80 process.  For example, a mechanism might need to query an LDAP server to
81 obtain the authentication secret.  The application probably needs other
82 information from there as well, such as home directory or UID.  The
83 auxiliary property interface allows the two to cooperate, and only results
84 in a single query against the LDAP server (or other property sources).
85
86 Property lookups take place directly after user canonicalization occurs.
87 Therefore, all requests should be registered with he context before that
88 time.  Note that requests can also be registered using the
89 sasl_auxprop_request(3) function.  Most of the functions listed below, 
90 however, require a property context which can be obtained by calling
91 sasl_auxprop_getctx(3).
92
93 .SH API Description
94 .TP 0.8i
95 struct propctx *prop_new(unsigned estimate)
96 Create a new property context.  Probably unnecessary for application
97 developers to call this at any point.
98
99 .I estimate
100 is the estimate of storage needed total for requests & responses.
101 A value of 0 will imply the library default.
102
103 .TP 0.8i
104 int prop_dup(struct propctx *src_ctx, struct propctx *dst_ctx)
105
106 Duplicate a given property context.
107
108 .TP 0.8i
109 int prop_request(struct propctx *ctx, const char **names)
110
111 Add properties to the request list of a given context.
112
113 .I names
114 is the NULL-terminated array of property names, and must persist until
115 the requests are cleared or the context is disposed of with a call
116 to prop_dispose.
117
118 .TP 0.8i
119 const struct propval *prop_get(struct propctx *ctx)
120
121 Returns a NULL-terminated array of struct propval from the given context.
122
123 .TP 0.8i
124 int prop_getnames(struct propctx *ctx, const char **names,
125                   struct porpval *vals)
126
127 Fill in a (provided) array of struct propval based on a list of property
128 names.  This implies that the vals array is at least as long as the
129 names array. The values that are filled in by this call
130 persist until next call to prop_request, prop_clear,
131 or prop_dispose on context.  If a name specified here was never requested,
132 that its associated values entry will be set to NULL.
133
134 Returns number of matching properties that were found, or a SASL error code.
135
136 .TP 0.8i
137 void prop_clear(struct propctx *ctx, int requests)
138
139 Clear values and optionally requests from a property context.
140
141 .I requests
142 is 1 if the requests should be cleared, 0 otherwise.
143
144 .TP 0.8i
145 void prop_erase(struct propctx *ctx, const char *name)
146
147 Securely erase the value of a property.
148
149 .I name
150 is the name of the property to erase.
151
152 .TP 0.8i
153 void prop_dispose(struct propctx **ctx)
154
155 Disposes of a property context and NULLifys the pointer.
156
157 .TP 0.8i
158 int prop_format(struct propctx *ctx, const char *sep, int seplen,
159                 char *outbuf, unsigned outmax, unsigned *outlen)
160
161 Format the requested property names into a string.  This not intended
162 for use by the application (only by auxprop plugins).
163
164 .I sep
165 Is the separator to use for the string
166
167 .I outbuf
168 Is the caller-allocated buffer of length
169 .I outmax
170 that the resulting string will be placed in (including NUL terminator).
171
172 .I outlen
173 if non-NULL, will contain the length of the resulting string (excluding NUL terminator).
174
175 .TP 0.8i
176 int prop_set(struct propctx *ctx, const char *name, const char *value,
177              int vallen)
178
179 Adds a property value to the context.  This is intended for use by auxprop
180 plugins only.
181
182 .I name
183 is the name of the property to receive the new value, or NULL, which
184 implies that the value will be added to the same property as the last
185 call to either prop_set or prop_setvals.
186
187 .I value
188 is a value for the property of length
189 .I vallen
190
191 .TP 0.8i
192 int prop_setvals(struct propctx *ctx, const char *name, const char **values)
193
194 Adds multiple values to a single property.  This is intended for use by
195 auxprop plugins only.
196
197 .I name
198 has the same meaning as in 
199 .B prop_set
200
201 .I values
202 are a NULL-terminated array of values to be added the property.
203
204 .SH "RETURN VALUE"
205 The property functions that return an int return SASL error codes.
206 See sasl_errors(3).  Those that return pointers will return a valid pointer
207 on success, or NULL on any error.
208
209 .SH "CONFORMING TO"
210 RFC 2222
211
212 .SH "SEE ALSO"
213 sasl(3), sasl_errors(3), sasl_auxprop_request(3), sasl_auxprop_getctx(3)