Print this page
first pass
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libsasl/include/plugin_common.h
+++ new/usr/src/lib/libsasl/include/plugin_common.h
1 1 /*
2 2 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
3 3 * Use is subject to license terms.
4 4 */
5 5 #pragma ident "%Z%%M% %I% %E% SMI"
6 6
7 7 /* Generic SASL plugin utility functions
8 8 * Rob Siemborski
9 9 * $Id: plugin_common.h,v 1.16 2003/04/07 16:03:43 rjs3 Exp $
10 10 */
11 11
12 12 /*
13 13 * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
14 14 *
15 15 * Redistribution and use in source and binary forms, with or without
16 16 * modification, are permitted provided that the following conditions
17 17 * are met:
18 18 *
19 19 * 1. Redistributions of source code must retain the above copyright
20 20 * notice, this list of conditions and the following disclaimer.
21 21 *
22 22 * 2. Redistributions in binary form must reproduce the above copyright
23 23 * notice, this list of conditions and the following disclaimer in
24 24 * the documentation and/or other materials provided with the
25 25 * distribution.
26 26 *
27 27 * 3. The name "Carnegie Mellon University" must not be used to
28 28 * endorse or promote products derived from this software without
29 29 * prior written permission. For permission or any other legal
30 30 * details, please contact
31 31 * Office of Technology Transfer
32 32 * Carnegie Mellon University
33 33 * 5000 Forbes Avenue
34 34 * Pittsburgh, PA 15213-3890
35 35 * (412) 268-4387, fax: (412) 268-7395
36 36 * tech-transfer@andrew.cmu.edu
37 37 *
38 38 * 4. Redistributions of any form whatsoever must retain the following
39 39 * acknowledgment:
40 40 * "This product includes software developed by Computing Services
41 41 * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
42 42 *
43 43 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
44 44 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
45 45 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
46 46 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
47 47 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
48 48 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
49 49 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
50 50 */
51 51
52 52 #ifndef _PLUGIN_COMMON_H_
53 53 #define _PLUGIN_COMMON_H_
54 54
55 55 #include <config.h>
56 56
57 57 #ifndef macintosh
58 58 #ifdef WIN32
59 59 # include <winsock.h>
60 60 #else
61 61 # include <sys/socket.h>
62 62 # include <netinet/in.h>
63 63 # include <arpa/inet.h>
64 64 # include <netdb.h>
65 65 #endif /* WIN32 */
66 66 #endif /* macintosh */
67 67
68 68 #include <sasl.h>
69 69 #include <saslutil.h>
70 70 #include <saslplug.h>
71 71
72 72 #ifdef WIN32
73 73 #define PLUG_API __declspec(dllexport)
74 74 #else
75 75 #define PLUG_API extern
76 76 #endif
77 77
78 78 #define SASL_CLIENT_PLUG_INIT( x ) \
79 79 extern sasl_client_plug_init_t x##_client_plug_init; \
80 80 PLUG_API int sasl_client_plug_init(const sasl_utils_t *utils, \
81 81 int maxversion, int *out_version, \
82 82 sasl_client_plug_t **pluglist, \
83 83 int *plugcount) { \
84 84 return x##_client_plug_init(utils, maxversion, out_version, \
85 85 pluglist, plugcount); \
86 86 }
87 87
88 88 #define SASL_SERVER_PLUG_INIT( x ) \
89 89 extern sasl_server_plug_init_t x##_server_plug_init; \
90 90 PLUG_API int sasl_server_plug_init(const sasl_utils_t *utils, \
91 91 int maxversion, int *out_version, \
92 92 sasl_server_plug_t **pluglist, \
93 93 int *plugcount) { \
94 94 return x##_server_plug_init(utils, maxversion, out_version, \
95 95 pluglist, plugcount); \
96 96 }
97 97
98 98 #define SASL_AUXPROP_PLUG_INIT( x ) \
99 99 extern sasl_auxprop_init_t x##_auxprop_plug_init; \
100 100 PLUG_API int sasl_auxprop_plug_init(const sasl_utils_t *utils, \
101 101 int maxversion, int *out_version, \
102 102 sasl_auxprop_plug_t **plug, \
103 103 const char *plugname) {\
104 104 return x##_auxprop_plug_init(utils, maxversion, out_version, \
105 105 plug, plugname); \
106 106 }
107 107
108 108 #define SASL_CANONUSER_PLUG_INIT( x ) \
109 109 extern sasl_canonuser_init_t x##_canonuser_plug_init; \
110 110 PLUG_API int sasl_canonuser_init(const sasl_utils_t *utils, \
111 111 int maxversion, int *out_version, \
112 112 sasl_canonuser_plug_t **plug, \
113 113 const char *plugname) {\
114 114 return x##_canonuser_plug_init(utils, maxversion, out_version, \
115 115 plug, plugname); \
116 116 }
117 117
118 118 /* note: msg cannot include additional variables, so if you want to
119 119 * do a printf-format string, then you need to call seterror yourself */
120 120 #define SETERROR( utils, msg ) (utils)->seterror( (utils)->conn, 0, (msg) )
121 121
122 122 #ifndef MEMERROR
123 123 #ifdef _SUN_SDK_
124 124 #define MEMERROR( utils ) \
125 125 (utils)->seterror( (utils)->conn, 0, "Out of Memory")
126 126 #else
127 127 #define MEMERROR( utils ) \
128 128 (utils)->seterror( (utils)->conn, 0, \
129 129 "Out of Memory in " __FILE__ " near line %d", __LINE__ )
130 130 #endif /* _SUN_SDK_ */
131 131 #endif
132 132
133 133 #ifndef PARAMERROR
134 134 #ifdef _SUN_SDK_
135 135 #define PARAMERROR( utils ) \
136 136 (utils)->seterror( (utils)->conn, 0, "Parameter Error")
137 137 #else
138 138 #define PARAMERROR( utils ) \
139 139 (utils)->seterror( (utils)->conn, 0, \
140 140 "Parameter Error in " __FILE__ " near line %d", __LINE__ )
141 141 #endif /* _SUN_SDK_ */
142 142 #endif
143 143
144 144 #ifndef SASLINT_H
145 145 typedef struct buffer_info
146 146 {
147 147 char *data;
148 148 unsigned curlen; /* Current length of data in buffer */
149 149 unsigned reallen; /* total length of buffer (>= curlen) */
150 150 } buffer_info_t;
151 151 #endif
152 152
153 153 int _plug_ipfromstring(const sasl_utils_t *utils, const char *addr,
154 154 struct sockaddr *out, socklen_t outlen);
155 155 int _plug_iovec_to_buf(const sasl_utils_t *utils, const struct iovec *vec,
156 156 unsigned numiov, buffer_info_t **output);
157 157 int _plug_buf_alloc(const sasl_utils_t *utils, char **rwbuf,
158 158 unsigned *curlen, unsigned newlen);
159 159 int _plug_strdup(const sasl_utils_t * utils, const char *in,
160 160 char **out, int *outlen);
161 161 void _plug_free_string(const sasl_utils_t *utils, char **str);
162 162 void _plug_free_secret(const sasl_utils_t *utils, sasl_secret_t **secret);
163 163
164 164 #define _plug_get_userid(utils, result, prompt_need) \
165 165 _plug_get_simple(utils, SASL_CB_USER, 0, result, prompt_need)
166 166 #define _plug_get_authid(utils, result, prompt_need) \
167 167 _plug_get_simple(utils, SASL_CB_AUTHNAME, 1, result, prompt_need)
168 168 int _plug_get_simple(const sasl_utils_t *utils, unsigned int id, int required,
169 169 const char **result, sasl_interact_t **prompt_need);
170 170
171 171 int _plug_get_password(const sasl_utils_t *utils, sasl_secret_t **secret,
172 172 unsigned int *iscopy, sasl_interact_t **prompt_need);
173 173
174 174 int _plug_challenge_prompt(const sasl_utils_t *utils, unsigned int id,
175 175 const char *challenge, const char *promptstr,
176 176 const char **result, sasl_interact_t **prompt_need);
177 177
178 178 int _plug_get_realm(const sasl_utils_t *utils, const char **availrealms,
179 179 const char **realm, sasl_interact_t **prompt_need);
180 180
181 181 int _plug_make_prompts(const sasl_utils_t *utils,
182 182 #ifdef _INTEGRATED_SOLARIS_
183 183 void **h,
184 184 #endif /* _INTEGRATED_SOLARIS_ */
185 185 sasl_interact_t **prompts_res,
186 186 const char *user_prompt, const char *user_def,
187 187 const char *auth_prompt, const char *auth_def,
188 188 const char *pass_prompt, const char *pass_def,
189 189 const char *echo_chal,
190 190 const char *echo_prompt, const char *echo_def,
191 191 const char *realm_chal,
192 192 const char *realm_prompt, const char *realm_def);
193 193
194 194 int _plug_decode(const sasl_utils_t *utils,
195 195 void *context,
196 196 const char *input, unsigned inputlen,
↓ open down ↓ |
196 lines elided |
↑ open up ↑ |
197 197 char **output, unsigned *outputsize, unsigned *outputlen,
198 198 int (*decode_pkt)(void *context,
199 199 const char **input, unsigned *inputlen,
200 200 char **output, unsigned *outputlen));
201 201
202 202 int _plug_parseuser(const sasl_utils_t *utils,
203 203 char **user, char **realm, const char *user_realm,
204 204 const char *serverFQDN, const char *input);
205 205
206 206 #ifdef _INTEGRATED_SOLARIS_
207 -/* EXPORT DELETE START */
208 -/* CRYPT DELETE START */
209 207 typedef void reg_sun_t(void *);
210 208
211 209 #define REG_PLUG( X, Y ) { \
212 210 reg_sun_t *func = NULL; \
213 211 unsigned int l; \
214 212 utils->getopt(utils->getopt_context, X, "reg_sun_plug", \
215 213 (const char **)&func, &l); \
216 214 if (func != NULL && l == 0) \
217 215 (*func)(Y); \
218 216 }
219 -/* CRYPT DELETE END */
220 -/* EXPORT DELETE END */
221 217
222 218 int use_locale(const char *lang_list, int is_client);
223 219 const char *convert_prompt(const sasl_utils_t *utils, void **h, const char *s);
224 220 char *local_to_utf(const sasl_utils_t *utils, const char *s);
225 221 #endif /* _INTEGRATED_SOLARIS_ */
226 222 #endif /* _PLUGIN_COMMON_H_ */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX