3 .\" Copyright (c) 2001 Carnegie Mellon University. All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
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
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
28 .\" 4. Redistributions of any form whatsoever must retain the following
30 .\" "This product includes software developed by Computing Services
31 .\" at Carnegie Mellon University (http://www.cmu.edu/computing/)."
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.
41 .TH sasl_auxprop "10 July 2001" SASL "SASL man pages"
43 sasl_auxprop \- How to work with SASL auxiliary properties
47 .B #include <sasl/prop.h>
49 .BI "struct propctx *prop_new(unsigned " estimate ") "
51 .BI "int prop_dup(struct propctx " *src_ctx ", "
52 .BI " struct propctx " *dst_ctx ")"
54 .BI "int prop_request(struct propctx " *ctx ", "
55 .BI " const char " **names ")"
57 .BI "const struct propval *prop_get(struct propctx " *ctx ")"
59 .BI "int prop_getnames(struct propctx " *ctx ", const char " **names ","
60 .BI " struct porpval " *vals ")"
62 .BI "void prop_clear(struct propctx " *ctx ", int " requests ")"
64 .BI "void prop_erase(struct propctx " *ctx ", const char " *name ")"
66 .BI "void prop_dispose(struct propctx " **ctx ")"
68 .BI "int prop_format(struct propctx " *ctx ", const char " *sep ", int " seplen ", "
69 .BI " char " *outbuf ", unsigned " outmax ", unsigned " *outlen ")"
71 .BI "int prop_set(struct propctx " *ctx ", const char " *name ","
72 .BI " const char " *value ", int " vallen ")"
74 .BI "int prop_setvals(struct propctx " *ctx ", const char " *name ","
75 .BI " const char " **values ")"
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).
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).
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.
100 is the estimate of storage needed total for requests & responses.
101 A value of 0 will imply the library default.
104 int prop_dup(struct propctx *src_ctx, struct propctx *dst_ctx)
106 Duplicate a given property context.
109 int prop_request(struct propctx *ctx, const char **names)
111 Add properties to the request list of a given context.
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
119 const struct propval *prop_get(struct propctx *ctx)
121 Returns a NULL-terminated array of struct propval from the given context.
124 int prop_getnames(struct propctx *ctx, const char **names,
125 struct porpval *vals)
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.
134 Returns number of matching properties that were found, or a SASL error code.
137 void prop_clear(struct propctx *ctx, int requests)
139 Clear values and optionally requests from a property context.
142 is 1 if the requests should be cleared, 0 otherwise.
145 void prop_erase(struct propctx *ctx, const char *name)
147 Securely erase the value of a property.
150 is the name of the property to erase.
153 void prop_dispose(struct propctx **ctx)
155 Disposes of a property context and NULLifys the pointer.
158 int prop_format(struct propctx *ctx, const char *sep, int seplen,
159 char *outbuf, unsigned outmax, unsigned *outlen)
161 Format the requested property names into a string. This not intended
162 for use by the application (only by auxprop plugins).
165 Is the separator to use for the string
168 Is the caller-allocated buffer of length
170 that the resulting string will be placed in (including NUL terminator).
173 if non-NULL, will contain the length of the resulting string (excluding NUL terminator).
176 int prop_set(struct propctx *ctx, const char *name, const char *value,
179 Adds a property value to the context. This is intended for use by auxprop
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.
188 is a value for the property of length
192 int prop_setvals(struct propctx *ctx, const char *name, const char **values)
194 Adds multiple values to a single property. This is intended for use by
195 auxprop plugins only.
198 has the same meaning as in
202 are a NULL-terminated array of values to be added the property.
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.
213 sasl(3), sasl_errors(3), sasl_auxprop_request(3), sasl_auxprop_getctx(3)