1/* gsasl-compat.h --- Header file for obsoleted features in GNU SASL Library.
2 * Copyright (C) 2002-2012 Simon Josefsson
3 *
4 * This file is part of GNU SASL Library.
5 *
6 * GNU SASL Library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
10 *
11 * GNU SASL Library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License License along with GNU SASL Library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 *
21 */
22
23#ifndef GSASL_COMPAT_H
24#define GSASL_COMPAT_H
25
26#ifndef __attribute__
27/* This feature is available in gcc versions 2.5 and later. */
28#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
29#define __attribute__(Spec) /* empty */
30#endif
31#endif
32
33/* Old error codes */
34enum
35{
36 GSASL_TOO_SMALL_BUFFER = 4,
37 GSASL_FOPEN_ERROR = 5,
38 GSASL_FCLOSE_ERROR = 6,
39 GSASL_GCRYPT_ERROR = GSASL_CRYPTO_ERROR,
40 GSASL_CANNOT_GET_CTX = 32,
41 GSASL_NEED_CLIENT_ANONYMOUS_CALLBACK = 11,
42 GSASL_NEED_CLIENT_PASSWORD_CALLBACK = 12,
43 GSASL_NEED_CLIENT_PASSCODE_CALLBACK = 13,
44 GSASL_NEED_CLIENT_PIN_CALLBACK = 14,
45 GSASL_NEED_CLIENT_AUTHORIZATION_ID_CALLBACK = 15,
46 GSASL_NEED_CLIENT_AUTHENTICATION_ID_CALLBACK = 16,
47 GSASL_NEED_CLIENT_SERVICE_CALLBACK = 17,
48 GSASL_NEED_SERVER_VALIDATE_CALLBACK = 18,
49 GSASL_NEED_SERVER_CRAM_MD5_CALLBACK = 19,
50 GSASL_NEED_SERVER_DIGEST_MD5_CALLBACK = 20,
51 GSASL_NEED_SERVER_EXTERNAL_CALLBACK = 21,
52 GSASL_NEED_SERVER_ANONYMOUS_CALLBACK = 22,
53 GSASL_NEED_SERVER_REALM_CALLBACK = 23,
54 GSASL_NEED_SERVER_SECURID_CALLBACK = 24,
55 GSASL_NEED_SERVER_SERVICE_CALLBACK = 25,
56 GSASL_NEED_SERVER_GSSAPI_CALLBACK = 26,
57 GSASL_NEED_SERVER_RETRIEVE_CALLBACK = 27,
58 GSASL_UNICODE_NORMALIZATION_ERROR = 28,
59 GSASL_NO_MORE_REALMS = 34,
60 GSASL_INVALID_HANDLE = 50
61} __attribute__ ((deprecated));
62
63typedef Gsasl Gsasl_ctx __attribute__ ((deprecated));
64typedef Gsasl_session Gsasl_session_ctx __attribute__ ((deprecated));
65extern GSASL_API int gsasl_client_listmech (Gsasl * ctx, char *out,
66 size_t * outlen)
67 __attribute__ ((deprecated));
68extern GSASL_API int gsasl_server_listmech (Gsasl * ctx, char *out,
69 size_t * outlen)
70 __attribute__ ((deprecated));
71extern GSASL_API int gsasl_client_step (Gsasl_session * sctx,
72 const char *input, size_t input_len,
73 char *output, size_t * output_len)
74 __attribute__ ((deprecated));
75extern GSASL_API int gsasl_client_step_base64 (Gsasl_session * sctx,
76 const char *b64input,
77 char *b64output,
78 size_t b64output_len)
79 __attribute__ ((deprecated));
80extern GSASL_API int gsasl_server_step (Gsasl_session * sctx,
81 const char *input, size_t input_len,
82 char *output, size_t * output_len)
83 __attribute__ ((deprecated));
84extern GSASL_API int gsasl_server_step_base64 (Gsasl_session * sctx,
85 const char *b64input,
86 char *b64output,
87 size_t b64output_len)
88 __attribute__ ((deprecated));
89extern GSASL_API void gsasl_client_finish (Gsasl_session * sctx)
90 __attribute__ ((deprecated));
91extern GSASL_API void gsasl_server_finish (Gsasl_session * sctx)
92 __attribute__ ((deprecated));
93extern GSASL_API Gsasl *gsasl_client_ctx_get (Gsasl_session * sctx)
94 __attribute__ ((deprecated));
95extern GSASL_API Gsasl *gsasl_server_ctx_get (Gsasl_session * sctx)
96 __attribute__ ((deprecated));
97extern GSASL_API void gsasl_client_application_data_set (Gsasl_session * sctx,
98 void
99 *application_data)
100 __attribute__ ((deprecated));
101extern GSASL_API void *gsasl_client_application_data_get (Gsasl_session *
102 sctx)
103 __attribute__ ((deprecated));
104extern GSASL_API void gsasl_server_application_data_set (Gsasl_session * sctx,
105 void
106 *application_data)
107 __attribute__ ((deprecated));
108extern GSASL_API void *gsasl_server_application_data_get (Gsasl_session *
109 sctx)
110 __attribute__ ((deprecated));
111extern GSASL_API int gsasl_randomize (int strong, char *data, size_t datalen)
112 __attribute__ ((deprecated));
113extern GSASL_API Gsasl *gsasl_ctx_get (Gsasl_session * sctx)
114 __attribute__ ((deprecated));
115extern GSASL_API int gsasl_encode_inline (Gsasl_session * sctx,
116 const char *input, size_t input_len,
117 char *output, size_t * output_len)
118 __attribute__ ((deprecated));
119extern GSASL_API int gsasl_decode_inline (Gsasl_session * sctx,
120 const char *input, size_t input_len,
121 char *output, size_t * output_len)
122 __attribute__ ((deprecated));
123extern GSASL_API void gsasl_application_data_set (Gsasl * ctx, void *appdata)
124 __attribute__ ((deprecated));
125extern GSASL_API void *gsasl_application_data_get (Gsasl * ctx)
126 __attribute__ ((deprecated));
127extern GSASL_API void gsasl_appinfo_set (Gsasl_session * sctx, void *appdata)
128 __attribute__ ((deprecated));
129extern GSASL_API void *gsasl_appinfo_get (Gsasl_session * sctx)
130 __attribute__ ((deprecated));
131extern GSASL_API const char *gsasl_server_suggest_mechanism (Gsasl * ctx,
132 const char
133 *mechlist)
134 __attribute__ ((deprecated));
135
136extern GSASL_API int gsasl_base64_encode (char const *src, size_t srclength,
137 char *target, size_t targsize)
138 __attribute__ ((deprecated));
139extern GSASL_API int gsasl_base64_decode (char const *src,
140 char *target, size_t targsize)
141 __attribute__ ((deprecated));
142
143extern GSASL_API char *gsasl_stringprep_nfkc (const char *in, ssize_t len)
144 __attribute__ ((deprecated));
145extern GSASL_API char *gsasl_stringprep_saslprep (const char *in,
146 int *stringprep_rc)
147 __attribute__ ((deprecated));
148extern GSASL_API char *gsasl_stringprep_trace (const char *in,
149 int *stringprep_rc)
150 __attribute__ ((deprecated));
151
152extern GSASL_API int gsasl_md5pwd_get_password (const char *filename,
153 const char *username,
154 char *key, size_t * keylen)
155 __attribute__ ((deprecated));
156
157/* Callback prototypes */
158typedef int (*Gsasl_client_callback_anonymous) (Gsasl_session * sctx,
159 char *out, size_t * outlen);
160typedef int (*Gsasl_client_callback_authentication_id) (Gsasl_session * sctx,
161 char *out,
162 size_t * outlen);
163typedef int (*Gsasl_client_callback_authorization_id) (Gsasl_session * sctx,
164 char *out,
165 size_t * outlen);
166typedef int (*Gsasl_client_callback_password) (Gsasl_session * sctx,
167 char *out, size_t * outlen);
168typedef int (*Gsasl_client_callback_passcode) (Gsasl_session * sctx,
169 char *out, size_t * outlen);
170typedef int (*Gsasl_client_callback_pin) (Gsasl_session * sctx,
171 char *suggestion, char *out,
172 size_t * outlen);
173typedef int (*Gsasl_client_callback_service) (Gsasl_session * sctx,
174 char *service,
175 size_t * servicelen,
176 char *hostname,
177 size_t * hostnamelen,
178 char *servicename,
179 size_t * servicenamelen);
180typedef Gsasl_qop (*Gsasl_client_callback_qop) (Gsasl_session * sctx,
181 Gsasl_qop serverqops);
182typedef size_t (*Gsasl_client_callback_maxbuf) (Gsasl_session * sctx,
183 size_t servermaxbuf);
184typedef int (*Gsasl_client_callback_realm) (Gsasl_session * sctx, char *out,
185 size_t * outlen);
186typedef int (*Gsasl_server_callback_retrieve) (Gsasl_session * sctx,
187 const char *authentication_id,
188 const char *authorization_id,
189 const char *realm, char *key,
190 size_t * keylen);
191typedef int (*Gsasl_server_callback_validate) (Gsasl_session * sctx,
192 const char *authorization_id,
193 const char *authentication_id,
194 const char *password);
195typedef int (*Gsasl_server_callback_gssapi) (Gsasl_session * sctx,
196 const char *clientname,
197 const char *authentication_id);
198typedef int (*Gsasl_server_callback_securid) (Gsasl_session * sctx,
199 const char *authentication_id,
200 const char *authorization_id,
201 const char *passcode, char *pin,
202 char *suggestpin,
203 size_t * suggestpinlen);
204typedef int (*Gsasl_server_callback_cram_md5) (Gsasl_session * sctx,
205 char *username,
206 char *challenge,
207 char *response);
208typedef int (*Gsasl_server_callback_digest_md5) (Gsasl_session * sctx,
209 char *username, char *realm,
210 char *secrethash);
211typedef int (*Gsasl_server_callback_service) (Gsasl_session * sctx,
212 char *service,
213 size_t * servicelen,
214 char *hostname,
215 size_t * hostnamelen);
216typedef int (*Gsasl_server_callback_external) (Gsasl_session * sctx);
217typedef int (*Gsasl_server_callback_anonymous) (Gsasl_session * sctx,
218 const char *token);
219typedef int (*Gsasl_server_callback_realm) (Gsasl_session * sctx, char *out,
220 size_t * outlen, size_t nth);
221typedef Gsasl_qop (*Gsasl_server_callback_qop) (Gsasl_session * sctx);
222typedef size_t (*Gsasl_server_callback_maxbuf) (Gsasl_session * sctx);
223typedef Gsasl_cipher (*Gsasl_server_callback_cipher) (Gsasl_session * sctx);
224
225/* Obsolete client callbacks: callback-c.c */
226extern GSASL_API void
227 gsasl_client_callback_authorization_id_set
228 (Gsasl * ctx, Gsasl_client_callback_authorization_id cb)
229 __attribute__ ((deprecated));
230extern GSASL_API Gsasl_client_callback_authorization_id
231gsasl_client_callback_authorization_id_get (Gsasl * ctx)
232__attribute__ ((deprecated));
233
234extern GSASL_API void
235 gsasl_client_callback_authentication_id_set
236 (Gsasl * ctx, Gsasl_client_callback_authentication_id cb)
237 __attribute__ ((deprecated));
238extern GSASL_API Gsasl_client_callback_authentication_id
239gsasl_client_callback_authentication_id_get (Gsasl * ctx)
240__attribute__ ((deprecated));
241
242extern GSASL_API void
243gsasl_client_callback_anonymous_set (Gsasl * ctx,
244 Gsasl_client_callback_anonymous cb)
245__attribute__ ((deprecated));
246extern GSASL_API Gsasl_client_callback_anonymous
247gsasl_client_callback_anonymous_get (Gsasl * ctx)
248__attribute__ ((deprecated));
249
250extern GSASL_API void
251gsasl_client_callback_password_set (Gsasl * ctx,
252 Gsasl_client_callback_password cb)
253__attribute__ ((deprecated));
254extern GSASL_API Gsasl_client_callback_password
255gsasl_client_callback_password_get (Gsasl * ctx) __attribute__ ((deprecated));
256
257extern GSASL_API void
258gsasl_client_callback_passcode_set (Gsasl * ctx,
259 Gsasl_client_callback_passcode cb)
260__attribute__ ((deprecated));
261extern GSASL_API Gsasl_client_callback_passcode
262gsasl_client_callback_passcode_get (Gsasl * ctx) __attribute__ ((deprecated));
263
264extern GSASL_API void
265gsasl_client_callback_pin_set (Gsasl * ctx, Gsasl_client_callback_pin cb)
266__attribute__ ((deprecated));
267extern GSASL_API Gsasl_client_callback_pin
268gsasl_client_callback_pin_get (Gsasl * ctx) __attribute__ ((deprecated));
269
270extern GSASL_API void
271gsasl_client_callback_service_set (Gsasl * ctx,
272 Gsasl_client_callback_service cb)
273__attribute__ ((deprecated));
274extern GSASL_API Gsasl_client_callback_service
275gsasl_client_callback_service_get (Gsasl * ctx) __attribute__ ((deprecated));
276
277extern GSASL_API void
278gsasl_client_callback_qop_set (Gsasl * ctx, Gsasl_client_callback_qop cb)
279__attribute__ ((deprecated));
280extern GSASL_API Gsasl_client_callback_qop
281gsasl_client_callback_qop_get (Gsasl * ctx) __attribute__ ((deprecated));
282
283extern GSASL_API void
284gsasl_client_callback_maxbuf_set (Gsasl * ctx,
285 Gsasl_client_callback_maxbuf cb)
286__attribute__ ((deprecated));
287extern GSASL_API Gsasl_client_callback_maxbuf
288gsasl_client_callback_maxbuf_get (Gsasl * ctx) __attribute__ ((deprecated));
289extern GSASL_API
290 void gsasl_client_callback_realm_set (Gsasl * ctx,
291 Gsasl_client_callback_realm cb)
292 __attribute__ ((deprecated));
293extern GSASL_API Gsasl_client_callback_realm
294gsasl_client_callback_realm_get (Gsasl * ctx) __attribute__ ((deprecated));
295
296/* Obsolete server callbacks: callback-s.c */
297extern GSASL_API void
298gsasl_server_callback_validate_set (Gsasl * ctx,
299 Gsasl_server_callback_validate cb)
300__attribute__ ((deprecated));
301extern GSASL_API Gsasl_server_callback_validate
302gsasl_server_callback_validate_get (Gsasl * ctx) __attribute__ ((deprecated));
303
304extern GSASL_API void
305gsasl_server_callback_retrieve_set (Gsasl * ctx,
306 Gsasl_server_callback_retrieve cb)
307__attribute__ ((deprecated));
308extern GSASL_API Gsasl_server_callback_retrieve
309gsasl_server_callback_retrieve_get (Gsasl * ctx) __attribute__ ((deprecated));
310
311extern GSASL_API void
312gsasl_server_callback_cram_md5_set (Gsasl * ctx,
313 Gsasl_server_callback_cram_md5 cb)
314__attribute__ ((deprecated));
315extern GSASL_API Gsasl_server_callback_cram_md5
316gsasl_server_callback_cram_md5_get (Gsasl * ctx) __attribute__ ((deprecated));
317
318extern GSASL_API void
319gsasl_server_callback_digest_md5_set (Gsasl * ctx,
320 Gsasl_server_callback_digest_md5 cb)
321__attribute__ ((deprecated));
322extern GSASL_API Gsasl_server_callback_digest_md5
323gsasl_server_callback_digest_md5_get (Gsasl * ctx)
324__attribute__ ((deprecated));
325
326extern GSASL_API void
327gsasl_server_callback_external_set (Gsasl * ctx,
328 Gsasl_server_callback_external cb)
329__attribute__ ((deprecated));
330extern GSASL_API Gsasl_server_callback_external
331gsasl_server_callback_external_get (Gsasl * ctx) __attribute__ ((deprecated));
332
333extern GSASL_API void
334gsasl_server_callback_anonymous_set (Gsasl * ctx,
335 Gsasl_server_callback_anonymous cb)
336__attribute__ ((deprecated));
337extern GSASL_API Gsasl_server_callback_anonymous
338gsasl_server_callback_anonymous_get (Gsasl * ctx)
339__attribute__ ((deprecated));
340
341extern GSASL_API void
342gsasl_server_callback_realm_set (Gsasl * ctx, Gsasl_server_callback_realm cb)
343__attribute__ ((deprecated));
344extern GSASL_API Gsasl_server_callback_realm
345gsasl_server_callback_realm_get (Gsasl * ctx) __attribute__ ((deprecated));
346
347extern GSASL_API void
348gsasl_server_callback_qop_set (Gsasl * ctx, Gsasl_server_callback_qop cb)
349__attribute__ ((deprecated));
350extern GSASL_API Gsasl_server_callback_qop
351gsasl_server_callback_qop_get (Gsasl * ctx) __attribute__ ((deprecated));
352
353extern GSASL_API void
354gsasl_server_callback_maxbuf_set (Gsasl * ctx,
355 Gsasl_server_callback_maxbuf cb)
356__attribute__ ((deprecated));
357extern GSASL_API Gsasl_server_callback_maxbuf
358gsasl_server_callback_maxbuf_get (Gsasl * ctx) __attribute__ ((deprecated));
359
360extern GSASL_API void
361gsasl_server_callback_cipher_set (Gsasl * ctx,
362 Gsasl_server_callback_cipher cb)
363__attribute__ ((deprecated));
364extern GSASL_API Gsasl_server_callback_cipher
365gsasl_server_callback_cipher_get (Gsasl * ctx) __attribute__ ((deprecated));
366
367extern GSASL_API void
368gsasl_server_callback_securid_set (Gsasl * ctx,
369 Gsasl_server_callback_securid cb)
370__attribute__ ((deprecated));
371extern GSASL_API Gsasl_server_callback_securid
372gsasl_server_callback_securid_get (Gsasl * ctx) __attribute__ ((deprecated));
373
374extern GSASL_API void
375gsasl_server_callback_gssapi_set (Gsasl * ctx,
376 Gsasl_server_callback_gssapi cb)
377__attribute__ ((deprecated));
378extern GSASL_API Gsasl_server_callback_gssapi
379gsasl_server_callback_gssapi_get (Gsasl * ctx) __attribute__ ((deprecated));
380
381extern GSASL_API void
382gsasl_server_callback_service_set (Gsasl * ctx,
383 Gsasl_server_callback_service cb)
384__attribute__ ((deprecated));
385extern GSASL_API Gsasl_server_callback_service
386gsasl_server_callback_service_get (Gsasl * ctx) __attribute__ ((deprecated));
387
388#endif /* GSASL_COMPAT_H */
389