1 /* sasldb.h - SASLdb library header
4 * $Id: sasldb.h,v 1.6 2006/04/03 10:58:20 mel Exp $
7 * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in
18 * the documentation and/or other materials provided with the
21 * 3. The name "Carnegie Mellon University" must not be used to
22 * endorse or promote products derived from this software without
23 * prior written permission. For permission or any other legal
24 * details, please contact
25 * Office of Technology Transfer
26 * Carnegie Mellon University
28 * Pittsburgh, PA 15213-3890
29 * (412) 268-4387, fax: (412) 268-7395
30 * tech-transfer@andrew.cmu.edu
32 * 4. Redistributions of any form whatsoever must retain the following
34 * "This product includes software developed by Computing Services
35 * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
37 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
38 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
39 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
40 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
41 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
42 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
43 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
53 * Note that some of these require a sasl_conn_t in order for
54 * the getcallback stuff to work correctly. This is great for
55 * when they are called from a plugin or the library but makes
56 * for much wierdness when an otherwise non-sasl application needs
57 * to make use of this functionality.
60 int _sasldb_getdata(const sasl_utils_t *utils,
65 char *out, const size_t max_out, size_t *out_len);
67 /* pass NULL for data to delete it */
68 int _sasldb_putdata(const sasl_utils_t *utils,
73 const char *data, size_t data_len);
75 /* Should be run before any db access is attempted */
76 LIBSASL_API int _sasl_check_db(const sasl_utils_t *utils,
79 /* These allow iterating through the keys of the database */
80 typedef void* sasldb_handle;
82 typedef int (* sasldb_list_callback_t) (const char *authid,
87 LIBSASL_API sasldb_handle _sasldb_getkeyhandle(const sasl_utils_t *utils,
89 LIBSASL_API int _sasldb_getnextkey(const sasl_utils_t *utils,
90 sasldb_handle handle, char *out,
91 const size_t max_out, size_t *out_len);
92 LIBSASL_API int _sasldb_releasekeyhandle(const sasl_utils_t *utils,
93 sasldb_handle handle);
95 LIBSASL_API int _sasldb_listusers(const sasl_utils_t *utils,
97 sasldb_list_callback_t callback,
100 #if defined(KEEP_DB_OPEN)
101 void sasldb_auxprop_free (void *glob_context, const sasl_utils_t *utils);
103 #define sasldb_auxprop_free NULL
106 /* The rest are implemented in allockey.c and individual drivers need not
108 /* These two are aliases for getdata/putdata */
109 int _sasldb_getsecret(const sasl_utils_t *utils,
110 sasl_conn_t *context,
111 const char *auth_identity,
113 sasl_secret_t ** secret);
115 int _sasldb_putsecret(const sasl_utils_t *utils,
116 sasl_conn_t *context,
117 const char *auth_identity,
119 const sasl_secret_t * secret);
121 LIBSASL_API int _sasldb_parse_key(const char *key, const size_t key_len,
122 char *authid, const size_t max_authid,
123 char *realm, const size_t max_realm,
124 char *propName, const size_t max_propname);
126 /* This function is internal, but might be useful to have around */
127 int _sasldb_alloc_key(const sasl_utils_t *utils,
128 const char *auth_identity,
130 const char *propName,
134 #endif /* SASLDB_H */