1 | /* sasldb.h - SASLdb library header |
---|
2 | * Rob Siemborski |
---|
3 | * Tim Martin |
---|
4 | * $Id: sasldb.h,v 1.1.1.1 2002-10-13 18:00:23 ghudson Exp $ |
---|
5 | */ |
---|
6 | /* |
---|
7 | * Copyright (c) 2001 Carnegie Mellon University. All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions |
---|
11 | * are met: |
---|
12 | * |
---|
13 | * 1. Redistributions of source code must retain the above copyright |
---|
14 | * notice, this list of conditions and the following disclaimer. |
---|
15 | * |
---|
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 |
---|
19 | * distribution. |
---|
20 | * |
---|
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 |
---|
27 | * 5000 Forbes Avenue |
---|
28 | * Pittsburgh, PA 15213-3890 |
---|
29 | * (412) 268-4387, fax: (412) 268-7395 |
---|
30 | * tech-transfer@andrew.cmu.edu |
---|
31 | * |
---|
32 | * 4. Redistributions of any form whatsoever must retain the following |
---|
33 | * acknowledgment: |
---|
34 | * "This product includes software developed by Computing Services |
---|
35 | * at Carnegie Mellon University (http://www.cmu.edu/computing/)." |
---|
36 | * |
---|
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. |
---|
44 | */ |
---|
45 | |
---|
46 | #ifndef SASLDB_H |
---|
47 | #define SASLDB_H |
---|
48 | |
---|
49 | #include "sasl.h" |
---|
50 | #include "saslplug.h" |
---|
51 | |
---|
52 | /* |
---|
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. |
---|
58 | */ |
---|
59 | |
---|
60 | int _sasldb_getdata(const sasl_utils_t *utils, |
---|
61 | sasl_conn_t *conn, |
---|
62 | const char *authid, |
---|
63 | const char *realm, |
---|
64 | const char *propName, |
---|
65 | char *out, const size_t max_out, size_t *out_len); |
---|
66 | |
---|
67 | /* pass NULL for data to delete it */ |
---|
68 | int _sasldb_putdata(const sasl_utils_t *utils, |
---|
69 | sasl_conn_t *conn, |
---|
70 | const char *authid, |
---|
71 | const char *realm, |
---|
72 | const char *propName, |
---|
73 | const char *data, size_t data_len); |
---|
74 | |
---|
75 | /* Should be run before any db access is attempted */ |
---|
76 | int _sasl_check_db(const sasl_utils_t *utils, |
---|
77 | sasl_conn_t *conn); |
---|
78 | |
---|
79 | /* These allow iterating through the keys of the database */ |
---|
80 | typedef void* sasldb_handle; |
---|
81 | |
---|
82 | sasldb_handle _sasldb_getkeyhandle(const sasl_utils_t *utils, |
---|
83 | sasl_conn_t *conn); |
---|
84 | int _sasldb_getnextkey(const sasl_utils_t *utils, |
---|
85 | sasldb_handle handle, char *out, |
---|
86 | const size_t max_out, size_t *out_len); |
---|
87 | int _sasldb_releasekeyhandle(const sasl_utils_t *utils, |
---|
88 | sasldb_handle handle); |
---|
89 | |
---|
90 | /* The rest are implemented in allockey.c and individal drivers need not |
---|
91 | * do so */ |
---|
92 | /* These two are aliases for getdata/putdata */ |
---|
93 | int _sasldb_getsecret(const sasl_utils_t *utils, |
---|
94 | sasl_conn_t *context, |
---|
95 | const char *auth_identity, |
---|
96 | const char *realm, |
---|
97 | sasl_secret_t ** secret); |
---|
98 | |
---|
99 | int _sasldb_putsecret(const sasl_utils_t *utils, |
---|
100 | sasl_conn_t *context, |
---|
101 | const char *auth_identity, |
---|
102 | const char *realm, |
---|
103 | const sasl_secret_t * secret); |
---|
104 | |
---|
105 | int _sasldb_parse_key(const char *key, const size_t key_len, |
---|
106 | char *authid, const size_t max_authid, |
---|
107 | char *realm, const size_t max_realm, |
---|
108 | char *propName, const size_t max_propname); |
---|
109 | |
---|
110 | /* This function is internal, but might be useful to have around */ |
---|
111 | int _sasldb_alloc_key(const sasl_utils_t *utils, |
---|
112 | const char *auth_identity, |
---|
113 | const char *realm, |
---|
114 | const char *propName, |
---|
115 | char **key, |
---|
116 | size_t *key_len); |
---|
117 | |
---|
118 | #endif /* SASLDB_H */ |
---|