gsasl  1.10.0
About: GNU SASL is an implementation of the Simple Authentication and Security Layer (SASL). Development version.
  Fossies Dox: gsasl-1.10.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

obsolete.c
Go to the documentation of this file.
1 /* obsolete.c --- Obsolete functions kept around for backwards compatibility.
2  * Copyright (C) 2002-2021 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 #include "internal.h"
24 
25 #if USE_DIGEST_MD5
26 #include "qop.h"
27 #endif
28 
29 /**
30  * gsasl_client_listmech:
31  * @ctx: libgsasl handle.
32  * @out: output character array.
33  * @outlen: input maximum size of output character array, on output
34  * contains actual length of output array.
35  *
36  * Write SASL names, separated by space, of mechanisms supported by
37  * the libgsasl client to the output array. To find out how large the
38  * output array must be, call this function with a NULL @out
39  * parameter.
40  *
41  * Return value: Returns %GSASL_OK if successful, or error code.
42  *
43  * Deprecated: Use gsasl_client_mechlist() instead.
44  **/
45 int
46 gsasl_client_listmech (Gsasl * ctx, char *out, size_t *outlen)
47 {
48  char *tmp;
49  int rc;
50 
51  rc = gsasl_client_mechlist (ctx, &tmp);
52 
53  if (rc == GSASL_OK)
54  {
55  size_t tmplen = strlen (tmp);
56 
57  if (tmplen >= *outlen)
58  {
59  free (tmp);
61  }
62 
63  if (out)
64  strcpy (out, tmp);
65  *outlen = tmplen + 1;
66  free (tmp);
67  }
68 
69  return rc;
70 }
71 
72 /**
73  * gsasl_server_listmech:
74  * @ctx: libgsasl handle.
75  * @out: output character array.
76  * @outlen: input maximum size of output character array, on output
77  * contains actual length of output array.
78  *
79  * Write SASL names, separated by space, of mechanisms supported by
80  * the libgsasl server to the output array. To find out how large the
81  * output array must be, call this function with a NULL @out
82  * parameter.
83  *
84  * Return value: Returns %GSASL_OK if successful, or error code.
85  *
86  * Deprecated: Use gsasl_server_mechlist() instead.
87  **/
88 int
89 gsasl_server_listmech (Gsasl * ctx, char *out, size_t *outlen)
90 {
91  char *tmp;
92  int rc;
93 
94  rc = gsasl_server_mechlist (ctx, &tmp);
95 
96  if (rc == GSASL_OK)
97  {
98  size_t tmplen = strlen (tmp);
99 
100  if (tmplen >= *outlen)
101  {
102  free (tmp);
103  return GSASL_TOO_SMALL_BUFFER;
104  }
105 
106  if (out)
107  strcpy (out, tmp);
108  *outlen = tmplen + 1;
109  free (tmp);
110  }
111 
112  return rc;
113 }
114 
115 static int
117  const char *input, size_t input_len,
118  char *output, size_t *output_len)
119 {
120  char *tmp;
121  size_t tmplen;
122  int rc;
123 
124  rc = gsasl_step (sctx, input, input_len, &tmp, &tmplen);
125 
126  if (rc == GSASL_OK || rc == GSASL_NEEDS_MORE)
127  {
128  if (tmplen >= *output_len)
129  {
130  free (tmp);
131  /* XXX We lose the step token here, don't we? */
132  return GSASL_TOO_SMALL_BUFFER;
133  }
134 
135  if (output)
136  memcpy (output, tmp, tmplen);
137  *output_len = tmplen;
138  free (tmp);
139  }
140 
141  return rc;
142 }
143 
144 /**
145  * gsasl_client_step:
146  * @sctx: libgsasl client handle.
147  * @input: input byte array.
148  * @input_len: size of input byte array.
149  * @output: output byte array.
150  * @output_len: size of output byte array.
151  *
152  * Perform one step of SASL authentication in client. This reads data
153  * from server (specified with input and input_len), processes it
154  * (potentially invoking callbacks to the application), and writes
155  * data to server (into variables output and output_len).
156  *
157  * The contents of the output buffer is unspecified if this functions
158  * returns anything other than %GSASL_NEEDS_MORE.
159  *
160  * Return value: Returns %GSASL_OK if authenticated terminated
161  * successfully, %GSASL_NEEDS_MORE if more data is needed, or error
162  * code.
163  *
164  * Deprecated: Use gsasl_step() instead.
165  **/
166 int
168  const char *input,
169  size_t input_len, char *output, size_t *output_len)
170 {
171  return _gsasl_step (sctx, input, input_len, output, output_len);
172 }
173 
174 /**
175  * gsasl_server_step:
176  * @sctx: libgsasl server handle.
177  * @input: input byte array.
178  * @input_len: size of input byte array.
179  * @output: output byte array.
180  * @output_len: size of output byte array.
181  *
182  * Perform one step of SASL authentication in server. This reads data
183  * from client (specified with input and input_len), processes it
184  * (potentially invoking callbacks to the application), and writes
185  * data to client (into variables output and output_len).
186  *
187  * The contents of the output buffer is unspecified if this functions
188  * returns anything other than %GSASL_NEEDS_MORE.
189  *
190  * Return value: Returns %GSASL_OK if authenticated terminated
191  * successfully, %GSASL_NEEDS_MORE if more data is needed, or error
192  * code.
193  *
194  * Deprecated: Use gsasl_step() instead.
195  **/
196 int
198  const char *input,
199  size_t input_len, char *output, size_t *output_len)
200 {
201  return _gsasl_step (sctx, input, input_len, output, output_len);
202 }
203 
204 static int
206  const char *b64input, char *b64output, size_t b64output_len)
207 {
208  char *tmp;
209  int rc;
210 
211  rc = gsasl_step64 (sctx, b64input, &tmp);
212 
213  if (rc == GSASL_OK || rc == GSASL_NEEDS_MORE)
214  {
215  if (b64output_len <= strlen (tmp))
216  {
217  free (tmp);
218  /* XXX We lose the step token here, don't we? */
219  return GSASL_TOO_SMALL_BUFFER;
220  }
221 
222  if (b64output)
223  strcpy (b64output, tmp);
224  free (tmp);
225  }
226 
227  return rc;
228 }
229 
230 /**
231  * gsasl_client_step_base64:
232  * @sctx: libgsasl client handle.
233  * @b64input: input base64 encoded byte array.
234  * @b64output: output base64 encoded byte array.
235  * @b64output_len: size of output base64 encoded byte array.
236  *
237  * This is a simple wrapper around gsasl_client_step() that base64
238  * decodes the input and base64 encodes the output.
239  *
240  * Return value: See gsasl_client_step().
241  *
242  * Deprecated: Use gsasl_step64() instead.
243  **/
244 int
246  const char *b64input,
247  char *b64output, size_t b64output_len)
248 {
249  return _gsasl_step64 (sctx, b64input, b64output, b64output_len);
250 }
251 
252 /**
253  * gsasl_server_step_base64:
254  * @sctx: libgsasl server handle.
255  * @b64input: input base64 encoded byte array.
256  * @b64output: output base64 encoded byte array.
257  * @b64output_len: size of output base64 encoded byte array.
258  *
259  * This is a simple wrapper around gsasl_server_step() that base64
260  * decodes the input and base64 encodes the output.
261  *
262  * Return value: See gsasl_server_step().
263  *
264  * Deprecated: Use gsasl_step64() instead.
265  **/
266 int
268  const char *b64input,
269  char *b64output, size_t b64output_len)
270 {
271  return _gsasl_step64 (sctx, b64input, b64output, b64output_len);
272 }
273 
274 /**
275  * gsasl_client_finish:
276  * @sctx: libgsasl client handle.
277  *
278  * Destroy a libgsasl client handle. The handle must not be used with
279  * other libgsasl functions after this call.
280  *
281  * Deprecated: Use gsasl_finish() instead.
282  **/
283 void
285 {
286  gsasl_finish (sctx);
287 }
288 
289 /**
290  * gsasl_server_finish:
291  * @sctx: libgsasl server handle.
292  *
293  * Destroy a libgsasl server handle. The handle must not be used with
294  * other libgsasl functions after this call.
295  *
296  * Deprecated: Use gsasl_finish() instead.
297  **/
298 void
300 {
301  gsasl_finish (sctx);
302 }
303 
304 /**
305  * gsasl_client_ctx_get:
306  * @sctx: libgsasl client handle
307  *
308  * Get the libgsasl handle given a libgsasl client handle.
309  *
310  * Return value: Returns the libgsasl handle given a libgsasl client handle.
311  *
312  * Deprecated: This function is not useful with the new 0.2.0 API.
313  **/
314 Gsasl *
316 {
317  return sctx->ctx;
318 }
319 
320 /**
321  * gsasl_client_application_data_set:
322  * @sctx: libgsasl client handle.
323  * @application_data: opaque pointer to application specific data.
324  *
325  * Store application specific data in the libgsasl client handle. The
326  * application data can be later (for instance, inside a callback) be
327  * retrieved by calling gsasl_client_application_data_get(). It is
328  * normally used by the application to maintain state between the main
329  * program and the callback.
330  *
331  * Deprecated: Use gsasl_callback_hook_set() or
332  * gsasl_session_hook_set() instead.
333  **/
334 void
336  void *application_data)
337 {
338  gsasl_appinfo_set (sctx, application_data);
339 }
340 
341 /**
342  * gsasl_client_application_data_get:
343  * @sctx: libgsasl client handle.
344  *
345  * Retrieve application specific data from libgsasl client handle. The
346  * application data is set using gsasl_client_application_data_set().
347  * It is normally used by the application to maintain state between
348  * the main program and the callback.
349  *
350  * Return value: Returns the application specific data, or NULL.
351  *
352  * Deprecated: Use gsasl_callback_hook_get() or
353  * gsasl_session_hook_get() instead.
354  **/
355 void *
357 {
358  return gsasl_appinfo_get (sctx);
359 }
360 
361 /**
362  * gsasl_server_ctx_get:
363  * @sctx: libgsasl server handle
364  *
365  * Get the libgsasl handle given a libgsasl server handle.
366  *
367  * Return value: Returns the libgsasl handle given a libgsasl server handle.
368  *
369  * Deprecated: This function is not useful with the new 0.2.0 API.
370  **/
371 Gsasl *
373 {
374  return sctx->ctx;
375 }
376 
377 /**
378  * gsasl_server_application_data_set:
379  * @sctx: libgsasl server handle.
380  * @application_data: opaque pointer to application specific data.
381  *
382  * Store application specific data in the libgsasl server handle. The
383  * application data can be later (for instance, inside a callback) be
384  * retrieved by calling gsasl_server_application_data_get(). It is
385  * normally used by the application to maintain state between the main
386  * program and the callback.
387  *
388  * Deprecated: Use gsasl_callback_hook_set() or
389  * gsasl_session_hook_set() instead.
390  **/
391 void
393  void *application_data)
394 {
395  gsasl_appinfo_set (sctx, application_data);
396 }
397 
398 /**
399  * gsasl_server_application_data_get:
400  * @sctx: libgsasl server handle.
401  *
402  * Retrieve application specific data from libgsasl server handle. The
403  * application data is set using gsasl_server_application_data_set().
404  * It is normally used by the application to maintain state between
405  * the main program and the callback.
406  *
407  * Return value: Returns the application specific data, or NULL.
408  *
409  * Deprecated: Use gsasl_callback_hook_get() or
410  * gsasl_session_hook_get() instead.
411  **/
412 void *
414 {
415  return gsasl_appinfo_get (sctx);
416 }
417 
418 /**
419  * gsasl_randomize:
420  * @strong: 0 iff operation should not block, non-0 for very strong randomness.
421  * @data: output array to be filled with random data.
422  * @datalen: size of output array.
423  *
424  * Store cryptographically random data of given size in the provided
425  * buffer.
426  *
427  * Return value: Returns %GSASL_OK iff successful.
428  *
429  * Deprecated: Use gsasl_random() or gsasl_nonce() instead.
430  **/
431 int
432 gsasl_randomize (int strong, char *data, size_t datalen)
433 {
434  if (strong)
435  return gsasl_random (data, datalen);
436  return gsasl_nonce (data, datalen);
437 }
438 
439 /**
440  * gsasl_ctx_get:
441  * @sctx: libgsasl session handle
442  *
443  * Get the libgsasl handle given a libgsasl session handle.
444  *
445  * Return value: Returns the libgsasl handle given a libgsasl session handle.
446  *
447  * Deprecated: This function is not useful with the new 0.2.0 API.
448  **/
449 Gsasl *
451 {
452  return sctx->ctx;
453 }
454 
455 /**
456  * gsasl_encode_inline:
457  * @sctx: libgsasl session handle.
458  * @input: input byte array.
459  * @input_len: size of input byte array.
460  * @output: output byte array.
461  * @output_len: size of output byte array.
462  *
463  * Encode data according to negotiated SASL mechanism. This might mean
464  * that data is integrity or privacy protected.
465  *
466  * Return value: Returns %GSASL_OK if encoding was successful,
467  * otherwise an error code.
468  *
469  * Deprecated: Use gsasl_encode() instead.
470  *
471  * Since: 0.2.0
472  **/
473 int
475  const char *input, size_t input_len,
476  char *output, size_t *output_len)
477 {
478  char *tmp;
479  size_t tmplen;
480  int res;
481 
482  res = gsasl_encode (sctx, input, input_len, &tmp, &tmplen);
483  if (res == GSASL_OK)
484  {
485  if (*output_len < tmplen)
486  return GSASL_TOO_SMALL_BUFFER;
487  *output_len = tmplen;
488  memcpy (output, tmp, tmplen);
489  free (output);
490  }
491 
492  return res;
493 }
494 
495 /**
496  * gsasl_decode_inline:
497  * @sctx: libgsasl session handle.
498  * @input: input byte array.
499  * @input_len: size of input byte array.
500  * @output: output byte array.
501  * @output_len: size of output byte array.
502  *
503  * Decode data according to negotiated SASL mechanism. This might mean
504  * that data is integrity or privacy protected.
505  *
506  * Return value: Returns %GSASL_OK if encoding was successful,
507  * otherwise an error code.
508  *
509  * Deprecated: Use gsasl_decode() instead.
510  *
511  * Since: 0.2.0
512  **/
513 int
515  const char *input, size_t input_len,
516  char *output, size_t *output_len)
517 {
518  char *tmp;
519  size_t tmplen;
520  int res;
521 
522  res = gsasl_decode (sctx, input, input_len, &tmp, &tmplen);
523  if (res == GSASL_OK)
524  {
525  if (*output_len < tmplen)
526  return GSASL_TOO_SMALL_BUFFER;
527  *output_len = tmplen;
528  memcpy (output, tmp, tmplen);
529  free (output);
530  }
531 
532  return res;
533 }
534 
535 /**
536  * gsasl_application_data_set:
537  * @ctx: libgsasl handle.
538  * @appdata: opaque pointer to application specific data.
539  *
540  * Store application specific data in the libgsasl handle. The
541  * application data can be later (for instance, inside a callback) be
542  * retrieved by calling gsasl_application_data_get(). It is normally
543  * used by the application to maintain state between the main program
544  * and the callback.
545  *
546  * Deprecated: Use gsasl_callback_hook_set() instead.
547  **/
548 void
549 gsasl_application_data_set (Gsasl * ctx, void *appdata)
550 {
551  ctx->application_hook = appdata;
552 }
553 
554 /**
555  * gsasl_application_data_get:
556  * @ctx: libgsasl handle.
557  *
558  * Retrieve application specific data from libgsasl handle. The
559  * application data is set using gsasl_application_data_set(). It is
560  * normally used by the application to maintain state between the main
561  * program and the callback.
562  *
563  * Return value: Returns the application specific data, or NULL.
564  *
565  * Deprecated: Use gsasl_callback_hook_get() instead.
566  **/
567 void *
569 {
570  return ctx->application_hook;
571 }
572 
573 /**
574  * gsasl_appinfo_set:
575  * @sctx: libgsasl session handle.
576  * @appdata: opaque pointer to application specific data.
577  *
578  * Store application specific data in the libgsasl session handle.
579  * The application data can be later (for instance, inside a callback)
580  * be retrieved by calling gsasl_appinfo_get(). It is normally used
581  * by the application to maintain state between the main program and
582  * the callback.
583  *
584  * Deprecated: Use gsasl_callback_hook_set() instead.
585  **/
586 void
587 gsasl_appinfo_set (Gsasl_session * sctx, void *appdata)
588 {
589  sctx->application_data = appdata;
590 }
591 
592 /**
593  * gsasl_appinfo_get:
594  * @sctx: libgsasl session handle.
595  *
596  * Retrieve application specific data from libgsasl session
597  * handle. The application data is set using gsasl_appinfo_set(). It
598  * is normally used by the application to maintain state between the
599  * main program and the callback.
600  *
601  * Return value: Returns the application specific data, or NULL.
602  *
603  * Deprecated: Use gsasl_callback_hook_get() instead.
604  **/
605 void *
607 {
608  return sctx->application_data;
609 }
610 
611 /**
612  * gsasl_server_suggest_mechanism:
613  * @ctx: libgsasl handle.
614  * @mechlist: input character array with SASL mechanism names,
615  * separated by invalid characters (e.g. SPC).
616  *
617  * Get name of "best" SASL mechanism supported by the libgsasl server
618  * which is present in the input string.
619  *
620  * Return value: Returns name of "best" SASL mechanism supported by
621  * the libgsasl server which is present in the input string.
622  *
623  * Deprecated: This function was never useful, since it is the client
624  * that chose which mechanism to use.
625  **/
626 const char *
628  const char *mechlist _GL_UNUSED)
629 {
630  return NULL; /* This function is just silly. */
631 }
632 
633 /**
634  * gsasl_client_callback_authentication_id_set:
635  * @ctx: libgsasl handle.
636  * @cb: callback function
637  *
638  * Specify the callback function to use in the client to set the
639  * authentication identity. The function can be later retrieved using
640  * gsasl_client_callback_authentication_id_get().
641  *
642  * Deprecated: This function is part of the old callback interface.
643  * The new interface uses gsasl_callback_set() to set the application
644  * callback, and uses gsasl_callback() or gsasl_property_get() to
645  * invoke the callback for certain properties.
646  **/
647 void
650  cb)
651 {
652  ctx->cbc_authentication_id = cb;
653 }
654 
655 /**
656  * gsasl_client_callback_authentication_id_get:
657  * @ctx: libgsasl handle.
658  *
659  * Get the callback earlier set by calling
660  * gsasl_client_callback_authentication_id_set().
661  *
662  * Return value: Returns the callback earlier set by calling
663  * gsasl_client_callback_authentication_id_set().
664  *
665  * Deprecated: This function is part of the old callback interface.
666  * The new interface uses gsasl_callback_set() to set the application
667  * callback, and uses gsasl_callback() or gsasl_property_get() to
668  * invoke the callback for certain properties.
669  **/
672 {
673  return ctx ? ctx->cbc_authentication_id : NULL;
674 }
675 
676 /**
677  * gsasl_client_callback_authorization_id_set:
678  * @ctx: libgsasl handle.
679  * @cb: callback function
680  *
681  * Specify the callback function to use in the client to set the
682  * authorization identity. The function can be later retrieved using
683  * gsasl_client_callback_authorization_id_get().
684  *
685  * Deprecated: This function is part of the old callback interface.
686  * The new interface uses gsasl_callback_set() to set the application
687  * callback, and uses gsasl_callback() or gsasl_property_get() to
688  * invoke the callback for certain properties.
689  **/
690 void
693  cb)
694 {
695  ctx->cbc_authorization_id = cb;
696 }
697 
698 /**
699  * gsasl_client_callback_authorization_id_get:
700  * @ctx: libgsasl handle.
701  *
702  * Get the callback earlier set by calling
703  * gsasl_client_callback_authorization_id_set().
704  *
705  * Return value: Returns the callback earlier set by calling
706  * gsasl_client_callback_authorization_id_set().
707  *
708  * Deprecated: This function is part of the old callback interface.
709  * The new interface uses gsasl_callback_set() to set the application
710  * callback, and uses gsasl_callback() or gsasl_property_get() to
711  * invoke the callback for certain properties.
712  **/
715 {
716  return ctx ? ctx->cbc_authorization_id : NULL;
717 }
718 
719 /**
720  * gsasl_client_callback_password_set:
721  * @ctx: libgsasl handle.
722  * @cb: callback function
723  *
724  * Specify the callback function to use in the client to set the
725  * password. The function can be later retrieved using
726  * gsasl_client_callback_password_get().
727  *
728  * Deprecated: This function is part of the old callback interface.
729  * The new interface uses gsasl_callback_set() to set the application
730  * callback, and uses gsasl_callback() or gsasl_property_get() to
731  * invoke the callback for certain properties.
732  **/
733 void
736 {
737  ctx->cbc_password = cb;
738 }
739 
740 
741 /**
742  * gsasl_client_callback_password_get:
743  * @ctx: libgsasl handle.
744  *
745  * Get the callback earlier set by calling
746  * gsasl_client_callback_password_set().
747  *
748  * Return value: Returns the callback earlier set by calling
749  * gsasl_client_callback_password_set().
750  *
751  * Deprecated: This function is part of the old callback interface.
752  * The new interface uses gsasl_callback_set() to set the application
753  * callback, and uses gsasl_callback() or gsasl_property_get() to
754  * invoke the callback for certain properties.
755  **/
758 {
759  return ctx ? ctx->cbc_password : NULL;
760 }
761 
762 /**
763  * gsasl_client_callback_passcode_set:
764  * @ctx: libgsasl handle.
765  * @cb: callback function
766  *
767  * Specify the callback function to use in the client to set the
768  * passcode. The function can be later retrieved using
769  * gsasl_client_callback_passcode_get().
770  *
771  * Deprecated: This function is part of the old callback interface.
772  * The new interface uses gsasl_callback_set() to set the application
773  * callback, and uses gsasl_callback() or gsasl_property_get() to
774  * invoke the callback for certain properties.
775  **/
776 void
779 {
780  ctx->cbc_passcode = cb;
781 }
782 
783 
784 /**
785  * gsasl_client_callback_passcode_get:
786  * @ctx: libgsasl handle.
787  *
788  * Get the callback earlier set by calling
789  * gsasl_client_callback_passcode_set().
790  *
791  * Return value: Returns the callback earlier set by calling
792  * gsasl_client_callback_passcode_set().
793  *
794  * Deprecated: This function is part of the old callback interface.
795  * The new interface uses gsasl_callback_set() to set the application
796  * callback, and uses gsasl_callback() or gsasl_property_get() to
797  * invoke the callback for certain properties.
798  **/
801 {
802  return ctx ? ctx->cbc_passcode : NULL;
803 }
804 
805 /**
806  * gsasl_client_callback_pin_set:
807  * @ctx: libgsasl handle.
808  * @cb: callback function
809  *
810  * Specify the callback function to use in the client to chose a new
811  * pin, possibly suggested by the server, for the SECURID mechanism.
812  * This is not normally invoked, but only when the server requests it.
813  * The function can be later retrieved using
814  * gsasl_client_callback_pin_get().
815  *
816  * Deprecated: This function is part of the old callback interface.
817  * The new interface uses gsasl_callback_set() to set the application
818  * callback, and uses gsasl_callback() or gsasl_property_get() to
819  * invoke the callback for certain properties.
820  **/
821 void
823 {
824  ctx->cbc_pin = cb;
825 }
826 
827 
828 /**
829  * gsasl_client_callback_pin_get:
830  * @ctx: libgsasl handle.
831  *
832  * Get the callback earlier set by calling
833  * gsasl_client_callback_pin_set().
834  *
835  * Return value: Returns the callback earlier set by calling
836  * gsasl_client_callback_pin_set().
837  *
838  * Deprecated: This function is part of the old callback interface.
839  * The new interface uses gsasl_callback_set() to set the application
840  * callback, and uses gsasl_callback() or gsasl_property_get() to
841  * invoke the callback for certain properties.
842  **/
845 {
846  return ctx ? ctx->cbc_pin : NULL;
847 }
848 
849 /**
850  * gsasl_client_callback_service_set:
851  * @ctx: libgsasl handle.
852  * @cb: callback function
853  *
854  * Specify the callback function to use in the client to set the name
855  * of the service. The service buffer should be a registered GSSAPI
856  * host-based service name, hostname the name of the server.
857  * Servicename is used by DIGEST-MD5 and should be the name of generic
858  * server in case of a replicated service. The function can be later
859  * retrieved using gsasl_client_callback_service_get().
860  *
861  * Deprecated: This function is part of the old callback interface.
862  * The new interface uses gsasl_callback_set() to set the application
863  * callback, and uses gsasl_callback() or gsasl_property_get() to
864  * invoke the callback for certain properties.
865  **/
866 void
869 {
870  ctx->cbc_service = cb;
871 }
872 
873 /**
874  * gsasl_client_callback_service_get:
875  * @ctx: libgsasl handle.
876  *
877  * Get the callback earlier set by calling
878  * gsasl_client_callback_service_set().
879  *
880  * Return value: Returns the callback earlier set by calling
881  * gsasl_client_callback_service_set().
882  *
883  * Deprecated: This function is part of the old callback interface.
884  * The new interface uses gsasl_callback_set() to set the application
885  * callback, and uses gsasl_callback() or gsasl_property_get() to
886  * invoke the callback for certain properties.
887  **/
890 {
891  return ctx ? ctx->cbc_service : NULL;
892 }
893 
894 /**
895  * gsasl_client_callback_anonymous_set:
896  * @ctx: libgsasl handle.
897  * @cb: callback function
898  *
899  * Specify the callback function to use in the client to set the
900  * anonymous token, which usually is the users email address. The
901  * function can be later retrieved using
902  * gsasl_client_callback_anonymous_get().
903  *
904  * Deprecated: This function is part of the old callback interface.
905  * The new interface uses gsasl_callback_set() to set the application
906  * callback, and uses gsasl_callback() or gsasl_property_get() to
907  * invoke the callback for certain properties.
908  **/
909 void
912 {
913  ctx->cbc_anonymous = cb;
914 }
915 
916 /**
917  * gsasl_client_callback_anonymous_get:
918  * @ctx: libgsasl handle.
919  *
920  * Get the callback earlier set by calling
921  * gsasl_client_callback_anonymous_set().
922  *
923  * Return value: Returns the callback earlier set by calling
924  * gsasl_client_callback_anonymous_set().
925  *
926  * Deprecated: This function is part of the old callback interface.
927  * The new interface uses gsasl_callback_set() to set the application
928  * callback, and uses gsasl_callback() or gsasl_property_get() to
929  * invoke the callback for certain properties.
930  **/
933 {
934  return ctx ? ctx->cbc_anonymous : NULL;
935 }
936 
937 /**
938  * gsasl_client_callback_qop_set:
939  * @ctx: libgsasl handle.
940  * @cb: callback function
941  *
942  * Specify the callback function to use in the client to determine the
943  * qop to use after looking at what the server offered. The function
944  * can be later retrieved using gsasl_client_callback_qop_get().
945  *
946  * Deprecated: This function is part of the old callback interface.
947  * The new interface uses gsasl_callback_set() to set the application
948  * callback, and uses gsasl_callback() or gsasl_property_get() to
949  * invoke the callback for certain properties.
950  **/
951 void
953 {
954  ctx->cbc_qop = cb;
955 }
956 
957 /**
958  * gsasl_client_callback_qop_get:
959  * @ctx: libgsasl handle.
960  *
961  * Get the callback earlier set by calling
962  * gsasl_client_callback_qop_set().
963  *
964  * Return value: Returns the callback earlier set by calling
965  * gsasl_client_callback_qop_set().
966  *
967  * Deprecated: This function is part of the old callback interface.
968  * The new interface uses gsasl_callback_set() to set the application
969  * callback, and uses gsasl_callback() or gsasl_property_get() to
970  * invoke the callback for certain properties.
971  **/
974 {
975  return ctx ? ctx->cbc_qop : NULL;
976 }
977 
978 /**
979  * gsasl_client_callback_maxbuf_set:
980  * @ctx: libgsasl handle.
981  * @cb: callback function
982  *
983  * Specify the callback function to use in the client to inform the
984  * server of the largest buffer the client is able to receive when
985  * using the DIGEST-MD5 "auth-int" or "auth-conf" Quality of
986  * Protection (qop). If this directive is missing, the default value
987  * 65536 will be assumed. The function can be later retrieved using
988  * gsasl_client_callback_maxbuf_get().
989  *
990  * Deprecated: This function is part of the old callback interface.
991  * The new interface uses gsasl_callback_set() to set the application
992  * callback, and uses gsasl_callback() or gsasl_property_get() to
993  * invoke the callback for certain properties.
994  **/
995 void
998 {
999  ctx->cbc_maxbuf = cb;
1000 }
1001 
1002 /**
1003  * gsasl_client_callback_maxbuf_get:
1004  * @ctx: libgsasl handle.
1005  *
1006  * Get the callback earlier set by calling
1007  * gsasl_client_callback_maxbuf_set().
1008  *
1009  * Return value: Returns the callback earlier set by calling
1010  * gsasl_client_callback_maxbuf_set().
1011  *
1012  * Deprecated: This function is part of the old callback interface.
1013  * The new interface uses gsasl_callback_set() to set the application
1014  * callback, and uses gsasl_callback() or gsasl_property_get() to
1015  * invoke the callback for certain properties.
1016  **/
1019 {
1020  return ctx ? ctx->cbc_maxbuf : NULL;
1021 }
1022 
1023 /**
1024  * gsasl_client_callback_realm_set:
1025  * @ctx: libgsasl handle.
1026  * @cb: callback function
1027  *
1028  * Specify the callback function to use in the client to know which
1029  * realm it belongs to. The realm is used by the server to determine
1030  * which username and password to use. The function can be later
1031  * retrieved using gsasl_client_callback_realm_get().
1032  *
1033  * Deprecated: This function is part of the old callback interface.
1034  * The new interface uses gsasl_callback_set() to set the application
1035  * callback, and uses gsasl_callback() or gsasl_property_get() to
1036  * invoke the callback for certain properties.
1037  **/
1038 void
1040 {
1041  ctx->cbc_realm = cb;
1042 }
1043 
1044 /**
1045  * gsasl_client_callback_realm_get:
1046  * @ctx: libgsasl handle.
1047  *
1048  * Get the callback earlier set by calling
1049  * gsasl_client_callback_realm_set().
1050  *
1051  * Return value: Returns the callback earlier set by calling
1052  * gsasl_client_callback_realm_set().
1053  *
1054  * Deprecated: This function is part of the old callback interface.
1055  * The new interface uses gsasl_callback_set() to set the application
1056  * callback, and uses gsasl_callback() or gsasl_property_get() to
1057  * invoke the callback for certain properties.
1058  **/
1061 {
1062  return ctx ? ctx->cbc_realm : NULL;
1063 }
1064 
1065 /**
1066  * gsasl_server_callback_validate_set:
1067  * @ctx: libgsasl handle.
1068  * @cb: callback function
1069  *
1070  * Specify the callback function to use in the server for deciding if
1071  * user is authenticated using authentication identity, authorization
1072  * identity and password. The function can be later retrieved using
1073  * gsasl_server_callback_validate_get().
1074  *
1075  * Deprecated: This function is part of the old callback interface.
1076  * The new interface uses gsasl_callback_set() to set the application
1077  * callback, and uses gsasl_callback() or gsasl_property_get() to
1078  * invoke the callback for certain properties.
1079  **/
1080 void
1083 {
1084  ctx->cbs_validate = cb;
1085 }
1086 
1087 /**
1088  * gsasl_server_callback_validate_get:
1089  * @ctx: libgsasl handle.
1090  *
1091  * Get the callback earlier set by calling
1092  * gsasl_server_callback_validate_set().
1093  *
1094  * Return value: Returns the callback earlier set by calling
1095  * gsasl_server_callback_validate_set().
1096  *
1097  * Deprecated: This function is part of the old callback interface.
1098  * The new interface uses gsasl_callback_set() to set the application
1099  * callback, and uses gsasl_callback() or gsasl_property_get() to
1100  * invoke the callback for certain properties.
1101  **/
1104 {
1105  return ctx ? ctx->cbs_validate : NULL;
1106 }
1107 
1108 /**
1109  * gsasl_server_callback_retrieve_set:
1110  * @ctx: libgsasl handle.
1111  * @cb: callback function
1112  *
1113  * Specify the callback function to use in the server for deciding if
1114  * user is authenticated using authentication identity, authorization
1115  * identity and password. The function can be later retrieved using
1116  * gsasl_server_callback_retrieve_get().
1117  *
1118  * Deprecated: This function is part of the old callback interface.
1119  * The new interface uses gsasl_callback_set() to set the application
1120  * callback, and uses gsasl_callback() or gsasl_property_get() to
1121  * invoke the callback for certain properties.
1122  **/
1123 void
1126 {
1127  ctx->cbs_retrieve = cb;
1128 }
1129 
1130 /**
1131  * gsasl_server_callback_retrieve_get:
1132  * @ctx: libgsasl handle.
1133  *
1134  * Get the callback earlier set by calling
1135  * gsasl_server_callback_retrieve_set().
1136  *
1137  * Return value: Returns the callback earlier set by calling
1138  * gsasl_server_callback_retrieve_set().
1139  *
1140  * Deprecated: This function is part of the old callback interface.
1141  * The new interface uses gsasl_callback_set() to set the application
1142  * callback, and uses gsasl_callback() or gsasl_property_get() to
1143  * invoke the callback for certain properties.
1144  **/
1147 {
1148  return ctx ? ctx->cbs_retrieve : NULL;
1149 }
1150 
1151 /**
1152  * gsasl_server_callback_cram_md5_set:
1153  * @ctx: libgsasl handle.
1154  * @cb: callback function
1155  *
1156  * Specify the callback function to use in the server for deciding if
1157  * user is authenticated using CRAM-MD5 challenge and response. The
1158  * function can be later retrieved using
1159  * gsasl_server_callback_cram_md5_get().
1160  *
1161  * Deprecated: This function is part of the old callback interface.
1162  * The new interface uses gsasl_callback_set() to set the application
1163  * callback, and uses gsasl_callback() or gsasl_property_get() to
1164  * invoke the callback for certain properties.
1165  **/
1166 void
1169 {
1170  ctx->cbs_cram_md5 = cb;
1171 }
1172 
1173 /**
1174  * gsasl_server_callback_cram_md5_get:
1175  * @ctx: libgsasl handle.
1176  *
1177  * Get the callback earlier set by calling
1178  * gsasl_server_callback_cram_md5_set().
1179  *
1180  * Return value: Returns the callback earlier set by calling
1181  * gsasl_server_callback_cram_md5_set().
1182  *
1183  * Deprecated: This function is part of the old callback interface.
1184  * The new interface uses gsasl_callback_set() to set the application
1185  * callback, and uses gsasl_callback() or gsasl_property_get() to
1186  * invoke the callback for certain properties.
1187  **/
1190 {
1191  return ctx ? ctx->cbs_cram_md5 : NULL;
1192 }
1193 
1194 /**
1195  * gsasl_server_callback_digest_md5_set:
1196  * @ctx: libgsasl handle.
1197  * @cb: callback function
1198  *
1199  * Specify the callback function to use in the server for retrieving
1200  * the secret hash of the username, realm and password for use in the
1201  * DIGEST-MD5 mechanism. The function can be later retrieved using
1202  * gsasl_server_callback_digest_md5_get().
1203  *
1204  * Deprecated: This function is part of the old callback interface.
1205  * The new interface uses gsasl_callback_set() to set the application
1206  * callback, and uses gsasl_callback() or gsasl_property_get() to
1207  * invoke the callback for certain properties.
1208  **/
1209 void
1212 {
1213  ctx->cbs_digest_md5 = cb;
1214 }
1215 
1216 /**
1217  * gsasl_server_callback_digest_md5_get:
1218  * @ctx: libgsasl handle.
1219  *
1220  * Get the callback earlier set by calling
1221  * gsasl_server_callback_digest_md5_set().
1222  *
1223  * Return value: Return the callback earlier set by calling
1224  * gsasl_server_callback_digest_md5_set().
1225  *
1226  * Deprecated: This function is part of the old callback interface.
1227  * The new interface uses gsasl_callback_set() to set the application
1228  * callback, and uses gsasl_callback() or gsasl_property_get() to
1229  * invoke the callback for certain properties.
1230  **/
1233 {
1234  return ctx->cbs_digest_md5;
1235 }
1236 
1237 /**
1238  * gsasl_server_callback_external_set:
1239  * @ctx: libgsasl handle.
1240  * @cb: callback function
1241  *
1242  * Specify the callback function to use in the server for deciding if
1243  * user is authenticated out of band. The function can be later
1244  * retrieved using gsasl_server_callback_external_get().
1245  *
1246  * Deprecated: This function is part of the old callback interface.
1247  * The new interface uses gsasl_callback_set() to set the application
1248  * callback, and uses gsasl_callback() or gsasl_property_get() to
1249  * invoke the callback for certain properties.
1250  **/
1251 void
1254 {
1255  ctx->cbs_external = cb;
1256 }
1257 
1258 /**
1259  * gsasl_server_callback_external_get:
1260  * @ctx: libgsasl handle.
1261  *
1262  * Get the callback earlier set by calling
1263  * gsasl_server_callback_external_set().
1264  *
1265  * Return value: Returns the callback earlier set by calling
1266  * gsasl_server_callback_external_set().
1267  *
1268  * Deprecated: This function is part of the old callback interface.
1269  * The new interface uses gsasl_callback_set() to set the application
1270  * callback, and uses gsasl_callback() or gsasl_property_get() to
1271  * invoke the callback for certain properties.
1272  **/
1275 {
1276  return ctx ? ctx->cbs_external : NULL;
1277 }
1278 
1279 /**
1280  * gsasl_server_callback_anonymous_set:
1281  * @ctx: libgsasl handle.
1282  * @cb: callback function
1283  *
1284  * Specify the callback function to use in the server for deciding if
1285  * user is permitted anonymous access. The function can be later
1286  * retrieved using gsasl_server_callback_anonymous_get().
1287  *
1288  * Deprecated: This function is part of the old callback interface.
1289  * The new interface uses gsasl_callback_set() to set the application
1290  * callback, and uses gsasl_callback() or gsasl_property_get() to
1291  * invoke the callback for certain properties.
1292  **/
1293 void
1296 {
1297  ctx->cbs_anonymous = cb;
1298 }
1299 
1300 /**
1301  * gsasl_server_callback_anonymous_get:
1302  * @ctx: libgsasl handle.
1303  *
1304  * Get the callback earlier set by calling
1305  * gsasl_server_callback_anonymous_set().
1306  *
1307  * Return value: Returns the callback earlier set by calling
1308  * gsasl_server_callback_anonymous_set().
1309  *
1310  * Deprecated: This function is part of the old callback interface.
1311  * The new interface uses gsasl_callback_set() to set the application
1312  * callback, and uses gsasl_callback() or gsasl_property_get() to
1313  * invoke the callback for certain properties.
1314  **/
1317 {
1318  return ctx ? ctx->cbs_anonymous : NULL;
1319 }
1320 
1321 /**
1322  * gsasl_server_callback_realm_set:
1323  * @ctx: libgsasl handle.
1324  * @cb: callback function
1325  *
1326  * Specify the callback function to use in the server to know which
1327  * realm it serves. The realm is used by the user to determine which
1328  * username and password to use. The function can be later retrieved
1329  * using gsasl_server_callback_realm_get().
1330  *
1331  * Deprecated: This function is part of the old callback interface.
1332  * The new interface uses gsasl_callback_set() to set the application
1333  * callback, and uses gsasl_callback() or gsasl_property_get() to
1334  * invoke the callback for certain properties.
1335  **/
1336 void
1338 {
1339  ctx->cbs_realm = cb;
1340 }
1341 
1342 /**
1343  * gsasl_server_callback_realm_get:
1344  * @ctx: libgsasl handle.
1345  *
1346  * Get the callback earlier set by calling
1347  * gsasl_server_callback_realm_set().
1348  *
1349  * Return value: Returns the callback earlier set by calling
1350  * gsasl_server_callback_realm_set().
1351  *
1352  * Deprecated: This function is part of the old callback interface.
1353  * The new interface uses gsasl_callback_set() to set the application
1354  * callback, and uses gsasl_callback() or gsasl_property_get() to
1355  * invoke the callback for certain properties.
1356  **/
1359 {
1360  return ctx ? ctx->cbs_realm : NULL;
1361 }
1362 
1363 /**
1364  * gsasl_server_callback_qop_set:
1365  * @ctx: libgsasl handle.
1366  * @cb: callback function
1367  *
1368  * Specify the callback function to use in the server to know which
1369  * quality of protection it accepts. The quality of protection
1370  * eventually used is selected by the client though. It is currently
1371  * used by the DIGEST-MD5 mechanism. The function can be later
1372  * retrieved using gsasl_server_callback_qop_get().
1373  *
1374  * Deprecated: This function is part of the old callback interface.
1375  * The new interface uses gsasl_callback_set() to set the application
1376  * callback, and uses gsasl_callback() or gsasl_property_get() to
1377  * invoke the callback for certain properties.
1378  **/
1379 void
1381 {
1382  ctx->cbs_qop = cb;
1383 }
1384 
1385 /**
1386  * gsasl_server_callback_qop_get:
1387  * @ctx: libgsasl handle.
1388  *
1389  * Get the callback earlier set by calling
1390  * gsasl_server_callback_qop_set().
1391  *
1392  * Return value: Returns the callback earlier set by calling
1393  * gsasl_server_callback_qop_set().
1394  *
1395  * Deprecated: This function is part of the old callback interface.
1396  * The new interface uses gsasl_callback_set() to set the application
1397  * callback, and uses gsasl_callback() or gsasl_property_get() to
1398  * invoke the callback for certain properties.
1399  **/
1402 {
1403  return ctx ? ctx->cbs_qop : NULL;
1404 }
1405 
1406 /**
1407  * gsasl_server_callback_maxbuf_set:
1408  * @ctx: libgsasl handle.
1409  * @cb: callback function
1410  *
1411  * Specify the callback function to use in the server to inform the
1412  * client of the largest buffer the server is able to receive when
1413  * using the DIGEST-MD5 "auth-int" or "auth-conf" Quality of
1414  * Protection (qop). If this directive is missing, the default value
1415  * 65536 will be assumed. The function can be later retrieved using
1416  * gsasl_server_callback_maxbuf_get().
1417  *
1418  * Deprecated: This function is part of the old callback interface.
1419  * The new interface uses gsasl_callback_set() to set the application
1420  * callback, and uses gsasl_callback() or gsasl_property_get() to
1421  * invoke the callback for certain properties.
1422  **/
1423 void
1426 {
1427  ctx->cbs_maxbuf = cb;
1428 }
1429 
1430 /**
1431  * gsasl_server_callback_maxbuf_get:
1432  * @ctx: libgsasl handle.
1433  *
1434  * Get the callback earlier set by calling
1435  * gsasl_server_callback_maxbuf_set().
1436  *
1437  * Return value: Returns the callback earlier set by calling
1438  * gsasl_server_callback_maxbuf_set().
1439  *
1440  * Deprecated: This function is part of the old callback interface.
1441  * The new interface uses gsasl_callback_set() to set the application
1442  * callback, and uses gsasl_callback() or gsasl_property_get() to
1443  * invoke the callback for certain properties.
1444  **/
1447 {
1448  return ctx ? ctx->cbs_maxbuf : NULL;
1449 }
1450 
1451 /**
1452  * gsasl_server_callback_cipher_set:
1453  * @ctx: libgsasl handle.
1454  * @cb: callback function
1455  *
1456  * Specify the callback function to use in the server to inform the
1457  * client of the cipher suites supported. The DES and 3DES ciphers
1458  * must be supported for interoperability. It is currently used by
1459  * the DIGEST-MD5 mechanism. The function can be later retrieved
1460  * using gsasl_server_callback_cipher_get().
1461  *
1462  * Deprecated: This function is part of the old callback interface.
1463  * The new interface uses gsasl_callback_set() to set the application
1464  * callback, and uses gsasl_callback() or gsasl_property_get() to
1465  * invoke the callback for certain properties.
1466  **/
1467 void
1470 {
1471  ctx->cbs_cipher = cb;
1472 }
1473 
1474 /**
1475  * gsasl_server_callback_cipher_get:
1476  * @ctx: libgsasl handle.
1477  *
1478  * Get the callback earlier set by calling
1479  * gsasl_server_callback_cipher_set().
1480  *
1481  * Return value: Returns the callback earlier set by calling
1482  * gsasl_server_callback_cipher_set().
1483  *
1484  * Deprecated: This function is part of the old callback interface.
1485  * The new interface uses gsasl_callback_set() to set the application
1486  * callback, and uses gsasl_callback() or gsasl_property_get() to
1487  * invoke the callback for certain properties.
1488  **/
1491 {
1492  return ctx ? ctx->cbs_cipher : NULL;
1493 }
1494 
1495 /**
1496  * gsasl_server_callback_securid_set:
1497  * @ctx: libgsasl handle.
1498  * @cb: callback function
1499  *
1500  * Specify the callback function to use in the server for validating a
1501  * user via the SECURID mechanism. The function should return
1502  * GSASL_OK if user authenticated successfully,
1503  * GSASL_SECURID_SERVER_NEED_ADDITIONAL_PASSCODE if it wants another
1504  * passcode, GSASL_SECURID_SERVER_NEED_NEW_PIN if it wants a PIN
1505  * change, or an error. When (and only when)
1506  * GSASL_SECURID_SERVER_NEED_NEW_PIN is returned, suggestpin can be
1507  * populated with a PIN code the server suggests, and suggestpinlen
1508  * set to the length of the PIN. The function can be later retrieved
1509  * using gsasl_server_callback_securid_get().
1510  *
1511  * Deprecated: This function is part of the old callback interface.
1512  * The new interface uses gsasl_callback_set() to set the application
1513  * callback, and uses gsasl_callback() or gsasl_property_get() to
1514  * invoke the callback for certain properties.
1515  **/
1516 void
1519 {
1520  ctx->cbs_securid = cb;
1521 }
1522 
1523 /**
1524  * gsasl_server_callback_securid_get:
1525  * @ctx: libgsasl handle.
1526  *
1527  * Get the callback earlier set by calling
1528  * gsasl_server_callback_securid_set().
1529  *
1530  * Return value: Returns the callback earlier set by calling
1531  * gsasl_server_callback_securid_set().
1532  *
1533  * Deprecated: This function is part of the old callback interface.
1534  * The new interface uses gsasl_callback_set() to set the application
1535  * callback, and uses gsasl_callback() or gsasl_property_get() to
1536  * invoke the callback for certain properties.
1537  **/
1540 {
1541  return ctx ? ctx->cbs_securid : NULL;
1542 }
1543 
1544 /**
1545  * gsasl_server_callback_gssapi_set:
1546  * @ctx: libgsasl handle.
1547  * @cb: callback function
1548  *
1549  * Specify the callback function to use in the server for checking if
1550  * a GSSAPI user is authorized for username (by, e.g., calling
1551  * krb5_kuserok). The function should return GSASL_OK if the user
1552  * should be permitted access, or an error code such as
1553  * GSASL_AUTHENTICATION_ERROR on failure. The function can be later
1554  * retrieved using gsasl_server_callback_gssapi_get().
1555  *
1556  * Deprecated: This function is part of the old callback interface.
1557  * The new interface uses gsasl_callback_set() to set the application
1558  * callback, and uses gsasl_callback() or gsasl_property_get() to
1559  * invoke the callback for certain properties.
1560  **/
1561 void
1564 {
1565  ctx->cbs_gssapi = cb;
1566 }
1567 
1568 /**
1569  * gsasl_server_callback_gssapi_get:
1570  * @ctx: libgsasl handle.
1571  *
1572  * Get the callback earlier set by calling
1573  * gsasl_server_callback_gssapi_set().
1574  *
1575  * Return value: Returns the callback earlier set by calling
1576  * gsasl_server_callback_gssapi_set().
1577  *
1578  * Deprecated: This function is part of the old callback interface.
1579  * The new interface uses gsasl_callback_set() to set the application
1580  * callback, and uses gsasl_callback() or gsasl_property_get() to
1581  * invoke the callback for certain properties.
1582  **/
1585 {
1586  return ctx ? ctx->cbs_gssapi : NULL;
1587 }
1588 
1589 /**
1590  * gsasl_server_callback_service_set:
1591  * @ctx: libgsasl handle.
1592  * @cb: callback function
1593  *
1594  * Specify the callback function to use in the server to set the name
1595  * of the service. The service buffer should be a registered GSSAPI
1596  * host-based service name, hostname the name of the server. The
1597  * function can be later retrieved using
1598  * gsasl_server_callback_service_get().
1599  *
1600  * Deprecated: This function is part of the old callback interface.
1601  * The new interface uses gsasl_callback_set() to set the application
1602  * callback, and uses gsasl_callback() or gsasl_property_get() to
1603  * invoke the callback for certain properties.
1604  **/
1605 void
1608 {
1609  ctx->cbs_service = cb;
1610 }
1611 
1612 /**
1613  * gsasl_server_callback_service_get:
1614  * @ctx: libgsasl handle.
1615  *
1616  * Get the callback earlier set by calling
1617  * gsasl_server_callback_service_set().
1618  *
1619  * Return value: Returns the callback earlier set by calling
1620  * gsasl_server_callback_service_set().
1621  *
1622  * Deprecated: This function is part of the old callback interface.
1623  * The new interface uses gsasl_callback_set() to set the application
1624  * callback, and uses gsasl_callback() or gsasl_property_get() to
1625  * invoke the callback for certain properties.
1626  **/
1629 {
1630  return ctx ? ctx->cbs_service : NULL;
1631 }
1632 
1633 #if HAVE_LIBIDN
1634 #include <stringprep.h>
1635 #endif
1636 
1637 /**
1638  * gsasl_stringprep_nfkc:
1639  * @in: a UTF-8 encoded string.
1640  * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
1641  *
1642  * Converts a string into canonical form, standardizing such issues as
1643  * whether a character with an accent is represented as a base
1644  * character and combining accent or as a single precomposed
1645  * character.
1646  *
1647  * The normalization mode is NFKC (ALL COMPOSE). It standardizes
1648  * differences that do not affect the text content, such as the
1649  * above-mentioned accent representation. It standardizes the
1650  * "compatibility" characters in Unicode, such as SUPERSCRIPT THREE to
1651  * the standard forms (in this case DIGIT THREE). Formatting
1652  * information may be lost but for most text operations such
1653  * characters should be considered the same. It returns a result with
1654  * composed forms rather than a maximally decomposed form.
1655  *
1656  * Return value: Return a newly allocated string, that is the NFKC
1657  * normalized form of @str, or NULL on error.
1658  *
1659  * Deprecated: No replacement functionality in GNU SASL, use GNU
1660  * Libidn instead. Note that in SASL, you most likely want to use
1661  * SASLprep and not bare NFKC, see gsasl_saslprep().
1662  **/
1663 char *
1664 gsasl_stringprep_nfkc (const char *in, ssize_t len)
1665 {
1666  char *out = NULL;
1667 
1668 #if HAVE_LIBIDN
1669  out = stringprep_utf8_nfkc_normalize (in, len);
1670 #endif
1671 
1672  return out;
1673 }
1674 
1675 /**
1676  * gsasl_stringprep_saslprep:
1677  * @in: input ASCII or UTF-8 string with data to prepare according to SASLprep.
1678  * @stringprep_rc: pointer to output variable with stringprep error code,
1679  * or NULL to indicate that you don't care about it.
1680  *
1681  * Process a Unicode string for comparison, according to the
1682  * "SASLprep" stringprep profile. This function is intended to be
1683  * used by Simple Authentication and Security Layer (SASL) mechanisms
1684  * (such as PLAIN, CRAM-MD5, and DIGEST-MD5) as well as other
1685  * protocols exchanging user names and/or passwords.
1686  *
1687  * Return value: Return a newly allocated string that is the
1688  * "SASLprep" processed form of the input string, or NULL on error,
1689  * in which case @stringprep_rc contain the stringprep library error
1690  * code.
1691  *
1692  * Deprecated: Use gsasl_saslprep() instead.
1693  **/
1694 char *
1695 gsasl_stringprep_saslprep (const char *in, int *stringprep_rc)
1696 {
1697  char *out = NULL;
1698 #if HAVE_LIBIDN
1699  int rc;
1700 
1701  rc = stringprep_profile (in, &out, "SASLprep", 0);
1702  if (stringprep_rc)
1703  *stringprep_rc = rc;
1704  if (rc != STRINGPREP_OK)
1705  out = NULL;
1706 #endif
1707 
1708  return out;
1709 }
1710 
1711 /**
1712  * gsasl_stringprep_trace:
1713  * @in: input ASCII or UTF-8 string with data to prepare according to "trace".
1714  * @stringprep_rc: pointer to output variable with stringprep error code,
1715  * or NULL to indicate that you don't care about it.
1716  *
1717  * Process a Unicode string for use as trace information, according to
1718  * the "trace" stringprep profile. The profile is designed for use
1719  * with the SASL ANONYMOUS Mechanism.
1720  *
1721  * Return value: Return a newly allocated string that is the "trace"
1722  * processed form of the input string, or NULL on error, in which
1723  * case @stringprep_rc contain the stringprep library error code.
1724  *
1725  * Deprecated: No replacement functionality in GNU SASL, use GNU
1726  * Libidn instead.
1727  **/
1728 char *
1729 gsasl_stringprep_trace (const char *in, int *stringprep_rc)
1730 {
1731  char *out = NULL;
1732 #if HAVE_LIBIDN
1733  int rc;
1734 
1735  rc = stringprep_profile (in, &out, "trace", 0);
1736  if (stringprep_rc)
1737  *stringprep_rc = rc;
1738  if (rc != STRINGPREP_OK)
1739  out = NULL;
1740 #endif
1741 
1742  return out;
1743 }
1744 
1745 /**
1746  * gsasl_md5pwd_get_password:
1747  * @filename: filename of file containing passwords.
1748  * @username: username string.
1749  * @key: output character array.
1750  * @keylen: input maximum size of output character array, on output
1751  * contains actual length of output array.
1752  *
1753  * Retrieve password for user from specified file. To find out how
1754  * large the output array must be, call this function with out=NULL.
1755  *
1756  * The file should be on the UoW "MD5 Based Authentication" format,
1757  * which means it is in text format with comments denoted by # first
1758  * on the line, with user entries looking as "usernameTABpassword".
1759  * This function removes CR and LF at the end of lines before
1760  * processing. TAB, CR, and LF denote ASCII values 9, 13, and 10,
1761  * respectively.
1762  *
1763  * Return value: Return GSASL_OK if output buffer contains the
1764  * password, GSASL_AUTHENTICATION_ERROR if the user could not be
1765  * found, or other error code.
1766  *
1767  * Deprecated: Use gsasl_simple_getpass() instead.
1768  **/
1769 int
1770 gsasl_md5pwd_get_password (const char *filename,
1771  const char *username, char *key, size_t *keylen)
1772 {
1773  char *tmp;
1774  size_t tmplen;
1775  int res;
1776  FILE *fh;
1777 
1778  fh = fopen (filename, "r");
1779  if (fh == NULL)
1780  return GSASL_FOPEN_ERROR;
1781  fclose (fh);
1782 
1783  res = gsasl_simple_getpass (filename, username, &tmp);
1784  if (res != GSASL_OK)
1785  return res;
1786 
1787  tmplen = strlen (tmp);
1788 
1789  if (*keylen < tmplen + 1)
1790  {
1791  free (tmp);
1792  return GSASL_TOO_SMALL_BUFFER;
1793  }
1794 
1795  *keylen = tmplen;
1796 
1797  if (key)
1798  memcpy (key, tmp, tmplen);
1799 
1800  free (tmp);
1801 
1802  return GSASL_OK;
1803 }
1804 
1805 #include <minmax.h>
1806 
1807 /**
1808  * gsasl_base64_encode:
1809  * @src: input byte array
1810  * @srclength: size of input byte array
1811  * @target: output byte array
1812  * @targsize: size of output byte array
1813  *
1814  * Encode data as base64. Converts characters, three at a time,
1815  * starting at src into four base64 characters in the target area
1816  * until the entire input buffer is encoded.
1817  *
1818  * Return value: Returns the number of data bytes stored at the
1819  * target, or -1 on error.
1820  *
1821  * Deprecated: Use gsasl_base64_to() instead.
1822  **/
1823 int
1824 gsasl_base64_encode (char const *src,
1825  size_t srclength, char *target, size_t targsize)
1826 {
1827  int rc;
1828  char *out;
1829  size_t outlen;
1830  int copied;
1831 
1832  rc = gsasl_base64_to (src, srclength, &out, &outlen);
1833  if (rc)
1834  return -1;
1835 
1836  copied = MIN (outlen, targsize);
1837  memcpy (target, out, copied);
1838  free (out);
1839 
1840  return copied;
1841 }
1842 
1843 /**
1844  * gsasl_base64_decode:
1845  * @src: input byte array
1846  * @target: output byte array
1847  * @targsize: size of output byte array
1848  *
1849  * Decode Base64 data. Skips all whitespace anywhere. Converts
1850  * characters, four at a time, starting at (or after) src from Base64
1851  * numbers into three 8 bit bytes in the target area.
1852  *
1853  * Return value: Returns the number of data bytes stored at the
1854  * target, or -1 on error.
1855  *
1856  * Deprecated: Use gsasl_base64_from() instead.
1857  **/
1858 int
1859 gsasl_base64_decode (char const *src, char *target, size_t targsize)
1860 {
1861  int rc;
1862  char *out;
1863  size_t outlen;
1864  int copied;
1865 
1866  rc = gsasl_base64_from (src, strlen (src), &out, &outlen);
1867  if (rc)
1868  return -1;
1869 
1870  copied = MIN (outlen, targsize);
1871  memcpy (target, out, copied);
1872  free (out);
1873 
1874  return copied;
1875 }
1876 
1877 static const char *
1878 pmap (Gsasl_session * sctx, Gsasl_property prop, char *buf, size_t buflen)
1879 {
1880  int res;
1881 
1882  buf[0] = '\0';
1883 
1884  /* Translate obsolete callbacks to modern properties. */
1885 
1886  switch (prop)
1887  {
1888  case GSASL_SERVICE:
1889  {
1892  if (!cb_service)
1893  break;
1894  res = cb_service (sctx, buf, &buflen, NULL, 0, NULL, 0);
1895  if (res != GSASL_OK)
1896  break;
1897  buf[buflen] = '\0';
1898  gsasl_property_set (sctx, prop, buf);
1899  break;
1900  }
1901 
1902  case GSASL_HOSTNAME:
1903  {
1906  if (!cb_service)
1907  break;
1908  res = cb_service (sctx, NULL, 0, buf, &buflen, NULL, 0);
1909  if (res != GSASL_OK)
1910  break;
1911  buf[buflen] = '\0';
1912  gsasl_property_set (sctx, prop, buf);
1913  break;
1914  }
1915 
1916  case GSASL_ANONYMOUS_TOKEN:
1917  {
1918  Gsasl_client_callback_anonymous cb_anonymous
1920  if (!cb_anonymous)
1921  break;
1922  res = cb_anonymous (sctx, buf, &buflen);
1923  if (res != GSASL_OK)
1924  break;
1925  buf[buflen] = '\0';
1926  gsasl_property_set (sctx, prop, buf);
1927  break;
1928  }
1929 
1930  case GSASL_AUTHID:
1931  {
1932  Gsasl_client_callback_authentication_id cb_authentication_id
1934  if (!cb_authentication_id)
1935  break;
1936  res = cb_authentication_id (sctx, buf, &buflen);
1937  if (res != GSASL_OK)
1938  break;
1939  buf[buflen] = '\0';
1940  gsasl_property_set (sctx, prop, buf);
1941  break;
1942  }
1943 
1944  case GSASL_AUTHZID:
1945  {
1946  Gsasl_client_callback_authorization_id cb_authorization_id
1948  if (!cb_authorization_id)
1949  break;
1950  res = cb_authorization_id (sctx, buf, &buflen);
1951  if (res != GSASL_OK)
1952  break;
1953  buf[buflen] = '\0';
1954  gsasl_property_set (sctx, prop, buf);
1955  break;
1956  }
1957 
1958  case GSASL_PASSWORD:
1959  {
1960  Gsasl_client_callback_password cb_password
1962  if (!cb_password)
1963  break;
1964  res = cb_password (sctx, buf, &buflen);
1965  if (res != GSASL_OK)
1966  break;
1967  buf[buflen] = '\0';
1968  gsasl_property_set (sctx, prop, buf);
1969  break;
1970  }
1971 
1972  case GSASL_PASSCODE:
1973  {
1974  Gsasl_client_callback_passcode cb_passcode
1976  if (!cb_passcode)
1977  break;
1978  res = cb_passcode (sctx, buf, &buflen);
1979  if (res != GSASL_OK)
1980  break;
1981  buf[buflen] = '\0';
1982  gsasl_property_set (sctx, prop, buf);
1983  break;
1984  }
1985 
1986  case GSASL_PIN:
1987  {
1990  if (!cb_pin)
1991  break;
1992  res = cb_pin (sctx, sctx->suggestedpin, buf, &buflen);
1993  if (res != GSASL_OK)
1994  break;
1995  buf[buflen] = '\0';
1996  gsasl_property_set (sctx, prop, buf);
1997  break;
1998  }
1999 
2000  case GSASL_REALM:
2001  {
2004  if (!cb_realm)
2005  break;
2006  res = cb_realm (sctx, buf, &buflen);
2007  if (res != GSASL_OK)
2008  break;
2009  buf[buflen] = '\0';
2010  gsasl_property_set (sctx, prop, buf);
2011  break;
2012  }
2013 
2014 #if USE_DIGEST_MD5
2015  case GSASL_QOP:
2016  {
2019  int serverqops;
2020  Gsasl_qop qop;
2021  if (!cb_qop)
2022  break;
2023  serverqops = digest_md5_qopstr2qops (sctx->qops);
2024  if (serverqops == -1)
2025  return NULL;
2026  qop = cb_qop (sctx, serverqops);
2027  if (qop & 0x07)
2028  gsasl_property_set (sctx, prop, digest_md5_qops2qopstr (qop));
2029  break;
2030  }
2031  break;
2032 #endif
2033 
2034  default:
2035  break;
2036  }
2037 
2038  return gsasl_property_fast (sctx, prop);
2039 }
2040 
2041 const char *
2043 {
2044  const char *ret;
2045  char *buf;
2046 
2047  buf = malloc (BUFSIZ);
2048  if (!buf)
2049  return NULL;
2050 
2051  ret = pmap (sctx, prop, buf, BUFSIZ - 1);
2052 
2053  free (buf);
2054 
2055  return ret;
2056 }
2057 
2058 int
2060  Gsasl_session * sctx, Gsasl_property prop)
2061 {
2062  int res;
2063 
2064  /* Call obsolete callbacks. */
2065 
2066  switch (prop)
2067  {
2069  {
2070  Gsasl_server_callback_anonymous cb_anonymous;
2071  if (!sctx->anonymous_token)
2072  break;
2073  cb_anonymous = gsasl_server_callback_anonymous_get (sctx->ctx);
2074  if (!cb_anonymous)
2075  break;
2076  res = cb_anonymous (sctx, sctx->anonymous_token);
2077  return res;
2078  break;
2079  }
2080 
2082  {
2083  Gsasl_server_callback_external cb_external
2085  if (!cb_external)
2086  break;
2087  res = cb_external (sctx);
2088  return res;
2089  break;
2090  }
2091 
2093  {
2096 #define MAX_SECURID 32 /* See RFC 2808. */
2097  char buf[MAX_SECURID + 1];
2098  size_t buflen = MAX_SECURID;
2099  if (!cb_securid)
2100  break;
2101  res = cb_securid (sctx, sctx->authid, sctx->authzid, sctx->passcode,
2102  sctx->pin, buf, &buflen);
2103  if (buflen > 0 && buflen < MAX_SECURID)
2104  {
2105  buf[buflen] = '\0';
2107  }
2108  return res;
2109  break;
2110  }
2111 
2112  case GSASL_VALIDATE_GSSAPI:
2113  {
2116  if (!cb_gssapi)
2117  break;
2118  res = cb_gssapi (sctx, sctx->gssapi_display_name, sctx->authzid);
2119  return res;
2120  break;
2121  }
2122 
2123  case GSASL_VALIDATE_SIMPLE:
2124  {
2125  Gsasl_server_callback_validate cb_validate
2127  if (!cb_validate)
2128  break;
2129  res = cb_validate (sctx, sctx->authzid, sctx->authid, sctx->password);
2130  return res;
2131  break;
2132  }
2133 
2134  case GSASL_PASSWORD:
2135  {
2136  Gsasl_server_callback_retrieve cb_retrieve
2138  char *buf;
2139  size_t buflen = BUFSIZ - 1;
2140  if (!cb_retrieve)
2141  break;
2142  buf = malloc (BUFSIZ);
2143  if (!buf)
2144  return GSASL_MALLOC_ERROR;
2145  res = cb_retrieve (sctx, sctx->authid, sctx->authzid,
2146  sctx->hostname, buf, &buflen);
2147  if (res == GSASL_OK)
2148  gsasl_property_set_raw (sctx, GSASL_PASSWORD, buf, buflen);
2149  /* FIXME else if (res == GSASL_TOO_SMALL_BUFFER)... */
2150  free (buf);
2151  return res;
2152  break;
2153  }
2154 
2155 #if USE_DIGEST_MD5
2156  case GSASL_QOPS:
2157  {
2160  Gsasl_qop qops;
2161  if (!cb_qop)
2162  break;
2163  qops = cb_qop (sctx);
2164  if (qops & 0x07)
2166  digest_md5_qops2qopstr (qops));
2167  return GSASL_OK;
2168  break;
2169  }
2170 #endif
2171 
2172  default:
2173  break;
2174  }
2175 
2176  return GSASL_NO_CALLBACK;
2177 }
2178 
2179 #include "gc.h"
2180 
2181 /**
2182  * gsasl_md5:
2183  * @in: input character array of data to hash.
2184  * @inlen: length of input character array of data to hash.
2185  * @out: newly allocated 16-byte character array with hash of data.
2186  *
2187  * Compute hash of data using MD5. The @out buffer must be
2188  * deallocated by the caller.
2189  *
2190  * Return value: Returns %GSASL_OK iff successful.
2191  *
2192  * Deprecated: Use a crypto library.
2193  **/
2194 int
2195 gsasl_md5 (const char *in, size_t inlen, char *out[])
2196 {
2197  *out = malloc (GC_MD5_DIGEST_SIZE);
2198  if (!*out)
2199  return GSASL_MALLOC_ERROR;
2200  return gc_md5 (in, inlen, *out);
2201 }
2202 
2203 /**
2204  * gsasl_hmac_md5:
2205  * @key: input character array with key to use.
2206  * @keylen: length of input character array with key to use.
2207  * @in: input character array of data to hash.
2208  * @inlen: length of input character array of data to hash.
2209  * @outhash: newly allocated 16-byte character array with keyed hash of data.
2210  *
2211  * Compute keyed checksum of data using HMAC-MD5. The @outhash buffer
2212  * must be deallocated by the caller.
2213  *
2214  * Return value: Returns %GSASL_OK iff successful.
2215  *
2216  * Deprecated: Use a crypto library.
2217  **/
2218 int
2219 gsasl_hmac_md5 (const char *key, size_t keylen,
2220  const char *in, size_t inlen, char *outhash[])
2221 {
2222  *outhash = malloc (GC_MD5_DIGEST_SIZE);
2223  if (!*outhash)
2224  return GSASL_MALLOC_ERROR;
2225  return gc_hmac_md5 (key, keylen, in, inlen, *outhash);
2226 }
2227 
2228 /**
2229  * gsasl_sha1:
2230  * @in: input character array of data to hash.
2231  * @inlen: length of input character array of data to hash.
2232  * @out: newly allocated 20-byte character array with hash of data.
2233  *
2234  * Compute hash of data using SHA1. The @out buffer must be
2235  * deallocated by the caller.
2236  *
2237  * Return value: Returns %GSASL_OK iff successful.
2238  *
2239  * Since: 1.3
2240  *
2241  * Deprecated: Use a crypto library.
2242  **/
2243 int
2244 gsasl_sha1 (const char *in, size_t inlen, char *out[])
2245 {
2246  *out = malloc (GC_SHA1_DIGEST_SIZE);
2247  if (!*out)
2248  return GSASL_MALLOC_ERROR;
2249  return gc_sha1 (in, inlen, *out);
2250 }
2251 
2252 /**
2253  * gsasl_hmac_sha1:
2254  * @key: input character array with key to use.
2255  * @keylen: length of input character array with key to use.
2256  * @in: input character array of data to hash.
2257  * @inlen: length of input character array of data to hash.
2258  * @outhash: newly allocated 20-byte character array with keyed hash of data.
2259  *
2260  * Compute keyed checksum of data using HMAC-SHA1. The @outhash buffer
2261  * must be deallocated by the caller.
2262  *
2263  * Return value: Returns %GSASL_OK iff successful.
2264  *
2265  * Since: 1.3
2266  *
2267  * Deprecated: Use a crypto library.
2268  **/
2269 int
2270 gsasl_hmac_sha1 (const char *key, size_t keylen,
2271  const char *in, size_t inlen, char *outhash[])
2272 {
2273  *outhash = malloc (GC_SHA1_DIGEST_SIZE);
2274  if (!*outhash)
2275  return GSASL_MALLOC_ERROR;
2276  return gc_hmac_sha1 (key, keylen, in, inlen, *outhash);
2277 }
_W64 int ssize_t
Definition: ac-stdint.h:18
int gsasl_random(char *data, size_t datalen)
Definition: crypto.c:54
int gsasl_nonce(char *data, size_t datalen)
Definition: crypto.c:38
Gc_rc gc_md5(const void *in, size_t inlen, void *resbuf)
Definition: gc-gnulib.c:982
Gc_rc gc_hmac_sha1(const void *key, size_t keylen, const void *in, size_t inlen, char *resbuf)
Definition: gc-gnulib.c:1037
Gc_rc gc_hmac_md5(const void *key, size_t keylen, const void *in, size_t inlen, char *resbuf)
Definition: gc-gnulib.c:1027
Gc_rc gc_sha1(const void *in, size_t inlen, void *resbuf)
Definition: gc-gnulib.c:991
#define GC_SHA1_DIGEST_SIZE
Definition: gc.h:68
#define GC_MD5_DIGEST_SIZE
Definition: gc.h:66
#define MIN(a, b)
Definition: minmax.h:57
#define NULL
Definition: stddef.in.h:72
int(* Gsasl_client_callback_password)(Gsasl_session *sctx, char *out, size_t *outlen)
Definition: gsasl-compat.h:166
int(* Gsasl_server_callback_validate)(Gsasl_session *sctx, const char *authorization_id, const char *authentication_id, const char *password)
Definition: gsasl-compat.h:191
size_t(* Gsasl_client_callback_maxbuf)(Gsasl_session *sctx, size_t servermaxbuf)
Definition: gsasl-compat.h:182
int(* Gsasl_server_callback_securid)(Gsasl_session *sctx, const char *authentication_id, const char *authorization_id, const char *passcode, char *pin, char *suggestpin, size_t *suggestpinlen)
Definition: gsasl-compat.h:198
size_t(* Gsasl_server_callback_maxbuf)(Gsasl_session *sctx)
Definition: gsasl-compat.h:222
Gsasl_qop(* Gsasl_server_callback_qop)(Gsasl_session *sctx)
Definition: gsasl-compat.h:221
int(* Gsasl_client_callback_realm)(Gsasl_session *sctx, char *out, size_t *outlen)
Definition: gsasl-compat.h:184
int(* Gsasl_server_callback_service)(Gsasl_session *sctx, char *service, size_t *servicelen, char *hostname, size_t *hostnamelen)
Definition: gsasl-compat.h:211
@ GSASL_TOO_SMALL_BUFFER
Definition: gsasl-compat.h:36
@ GSASL_FOPEN_ERROR
Definition: gsasl-compat.h:37
int(* Gsasl_server_callback_anonymous)(Gsasl_session *sctx, const char *token)
Definition: gsasl-compat.h:217
int(* Gsasl_client_callback_anonymous)(Gsasl_session *sctx, char *out, size_t *outlen)
Definition: gsasl-compat.h:158
int(* Gsasl_server_callback_gssapi)(Gsasl_session *sctx, const char *clientname, const char *authentication_id)
Definition: gsasl-compat.h:195
int(* Gsasl_client_callback_passcode)(Gsasl_session *sctx, char *out, size_t *outlen)
Definition: gsasl-compat.h:168
int(* Gsasl_server_callback_retrieve)(Gsasl_session *sctx, const char *authentication_id, const char *authorization_id, const char *realm, char *key, size_t *keylen)
Definition: gsasl-compat.h:186
int(* Gsasl_client_callback_service)(Gsasl_session *sctx, char *service, size_t *servicelen, char *hostname, size_t *hostnamelen, char *servicename, size_t *servicenamelen)
Definition: gsasl-compat.h:173
int(* Gsasl_client_callback_pin)(Gsasl_session *sctx, char *suggestion, char *out, size_t *outlen)
Definition: gsasl-compat.h:170
Gsasl_qop(* Gsasl_client_callback_qop)(Gsasl_session *sctx, Gsasl_qop serverqops)
Definition: gsasl-compat.h:180
int(* Gsasl_client_callback_authorization_id)(Gsasl_session *sctx, char *out, size_t *outlen)
Definition: gsasl-compat.h:163
int(* Gsasl_server_callback_external)(Gsasl_session *sctx)
Definition: gsasl-compat.h:216
int(* Gsasl_client_callback_authentication_id)(Gsasl_session *sctx, char *out, size_t *outlen)
Definition: gsasl-compat.h:160
int(* Gsasl_server_callback_digest_md5)(Gsasl_session *sctx, char *username, char *realm, char *secrethash)
Definition: gsasl-compat.h:208
Gsasl_cipher(* Gsasl_server_callback_cipher)(Gsasl_session *sctx)
Definition: gsasl-compat.h:223
int(* Gsasl_server_callback_cram_md5)(Gsasl_session *sctx, char *username, char *challenge, char *response)
Definition: gsasl-compat.h:204
int(* Gsasl_server_callback_realm)(Gsasl_session *sctx, char *out, size_t *outlen, size_t nth)
Definition: gsasl-compat.h:219
void gsasl_finish(Gsasl_session *sctx)
Definition: xfinish.c:33
void gsasl_property_set(Gsasl_session *sctx, Gsasl_property prop, const char *data)
Definition: property.c:158
int gsasl_decode(Gsasl_session *sctx, const char *input, size_t input_len, char **output, size_t *output_len)
Definition: xcode.c:96
Gsasl_qop
Definition: gsasl.h:234
@ GSASL_NO_CALLBACK
Definition: gsasl.h:184
@ GSASL_OK
Definition: gsasl.h:171
@ GSASL_NEEDS_MORE
Definition: gsasl.h:172
@ GSASL_MALLOC_ERROR
Definition: gsasl.h:175
int gsasl_simple_getpass(const char *filename, const char *username, char **key)
Definition: md5pwd.c:47
void gsasl_property_set_raw(Gsasl_session *sctx, Gsasl_property prop, const char *data, size_t len)
Definition: property.c:184
int gsasl_encode(Gsasl_session *sctx, const char *input, size_t input_len, char **output, size_t *output_len)
Definition: xcode.c:64
const char * gsasl_property_fast(Gsasl_session *sctx, Gsasl_property prop)
Definition: property.c:226
Gsasl_property
Definition: gsasl.h:333
@ GSASL_HOSTNAME
Definition: gsasl.h:340
@ GSASL_AUTHZID
Definition: gsasl.h:336
@ GSASL_VALIDATE_GSSAPI
Definition: gsasl.h:366
@ GSASL_QOP
Definition: gsasl.h:348
@ GSASL_SERVICE
Definition: gsasl.h:339
@ GSASL_VALIDATE_SIMPLE
Definition: gsasl.h:363
@ GSASL_VALIDATE_EXTERNAL
Definition: gsasl.h:364
@ GSASL_QOPS
Definition: gsasl.h:347
@ GSASL_PASSWORD
Definition: gsasl.h:337
@ GSASL_REALM
Definition: gsasl.h:345
@ GSASL_PASSCODE
Definition: gsasl.h:342
@ GSASL_AUTHID
Definition: gsasl.h:335
@ GSASL_PIN
Definition: gsasl.h:344
@ GSASL_VALIDATE_SECURID
Definition: gsasl.h:367
@ GSASL_VALIDATE_ANONYMOUS
Definition: gsasl.h:365
@ GSASL_ANONYMOUS_TOKEN
Definition: gsasl.h:338
@ GSASL_SUGGESTED_PIN
Definition: gsasl.h:343
int gsasl_step64(Gsasl_session *sctx, const char *b64input, char **b64output)
Definition: xstep.c:86
int gsasl_client_mechlist(Gsasl *ctx, char **out)
Definition: listmech.c:74
int gsasl_step(Gsasl_session *sctx, const char *input, size_t input_len, char **output, size_t *output_len)
Definition: xstep.c:51
int gsasl_server_mechlist(Gsasl *ctx, char **out)
Definition: listmech.c:93
static gss_OID_desc tmp
Definition: gss-extra.c:38
int rc
Definition: error.c:42
int res
Definition: mbrtowc-impl.h:45
char buf[4]
Definition: mbrtowc-impl.h:39
void gsasl_server_callback_maxbuf_set(Gsasl *ctx, Gsasl_server_callback_maxbuf cb)
Definition: obsolete.c:1424
void gsasl_server_callback_digest_md5_set(Gsasl *ctx, Gsasl_server_callback_digest_md5 cb)
Definition: obsolete.c:1210
void gsasl_server_callback_gssapi_set(Gsasl *ctx, Gsasl_server_callback_gssapi cb)
Definition: obsolete.c:1562
void gsasl_client_callback_maxbuf_set(Gsasl *ctx, Gsasl_client_callback_maxbuf cb)
Definition: obsolete.c:996
int gsasl_randomize(int strong, char *data, size_t datalen)
Definition: obsolete.c:432
void * gsasl_server_application_data_get(Gsasl_session *sctx)
Definition: obsolete.c:413
Gsasl_server_callback_cram_md5 gsasl_server_callback_cram_md5_get(Gsasl *ctx)
Definition: obsolete.c:1189
void gsasl_client_callback_pin_set(Gsasl *ctx, Gsasl_client_callback_pin cb)
Definition: obsolete.c:822
Gsasl_client_callback_pin gsasl_client_callback_pin_get(Gsasl *ctx)
Definition: obsolete.c:844
Gsasl_server_callback_retrieve gsasl_server_callback_retrieve_get(Gsasl *ctx)
Definition: obsolete.c:1146
#define MAX_SECURID
Gsasl_client_callback_qop gsasl_client_callback_qop_get(Gsasl *ctx)
Definition: obsolete.c:973
void gsasl_client_callback_anonymous_set(Gsasl *ctx, Gsasl_client_callback_anonymous cb)
Definition: obsolete.c:910
int gsasl_base64_encode(char const *src, size_t srclength, char *target, size_t targsize)
Definition: obsolete.c:1824
static const char * pmap(Gsasl_session *sctx, Gsasl_property prop, char *buf, size_t buflen)
Definition: obsolete.c:1878
void gsasl_client_callback_realm_set(Gsasl *ctx, Gsasl_client_callback_realm cb)
Definition: obsolete.c:1039
static int _gsasl_step64(Gsasl_session *sctx, const char *b64input, char *b64output, size_t b64output_len)
Definition: obsolete.c:205
char * gsasl_stringprep_trace(const char *in, int *stringprep_rc)
Definition: obsolete.c:1729
int gsasl_client_listmech(Gsasl *ctx, char *out, size_t *outlen)
Definition: obsolete.c:46
int gsasl_md5(const char *in, size_t inlen, char *out[])
Definition: obsolete.c:2195
void * gsasl_application_data_get(Gsasl *ctx)
Definition: obsolete.c:568
void gsasl_server_callback_anonymous_set(Gsasl *ctx, Gsasl_server_callback_anonymous cb)
Definition: obsolete.c:1294
void gsasl_server_callback_retrieve_set(Gsasl *ctx, Gsasl_server_callback_retrieve cb)
Definition: obsolete.c:1124
void gsasl_client_callback_password_set(Gsasl *ctx, Gsasl_client_callback_password cb)
Definition: obsolete.c:734
int gsasl_md5pwd_get_password(const char *filename, const char *username, char *key, size_t *keylen)
Definition: obsolete.c:1770
void gsasl_client_finish(Gsasl_session *sctx)
Definition: obsolete.c:284
void gsasl_server_callback_service_set(Gsasl *ctx, Gsasl_server_callback_service cb)
Definition: obsolete.c:1606
void * gsasl_appinfo_get(Gsasl_session *sctx)
Definition: obsolete.c:606
void gsasl_server_finish(Gsasl_session *sctx)
Definition: obsolete.c:299
int gsasl_server_step_base64(Gsasl_session *sctx, const char *b64input, char *b64output, size_t b64output_len)
Definition: obsolete.c:267
int gsasl_client_step(Gsasl_session *sctx, const char *input, size_t input_len, char *output, size_t *output_len)
Definition: obsolete.c:167
void gsasl_appinfo_set(Gsasl_session *sctx, void *appdata)
Definition: obsolete.c:587
void gsasl_client_callback_service_set(Gsasl *ctx, Gsasl_client_callback_service cb)
Definition: obsolete.c:867
int gsasl_encode_inline(Gsasl_session *sctx, const char *input, size_t input_len, char *output, size_t *output_len)
Definition: obsolete.c:474
Gsasl_client_callback_passcode gsasl_client_callback_passcode_get(Gsasl *ctx)
Definition: obsolete.c:800
void gsasl_server_callback_external_set(Gsasl *ctx, Gsasl_server_callback_external cb)
Definition: obsolete.c:1252
int gsasl_server_step(Gsasl_session *sctx, const char *input, size_t input_len, char *output, size_t *output_len)
Definition: obsolete.c:197
Gsasl_server_callback_validate gsasl_server_callback_validate_get(Gsasl *ctx)
Definition: obsolete.c:1103
Gsasl * gsasl_ctx_get(Gsasl_session *sctx)
Definition: obsolete.c:450
void gsasl_application_data_set(Gsasl *ctx, void *appdata)
Definition: obsolete.c:549
int _gsasl_obsolete_callback(Gsasl *ctx _GL_UNUSED, Gsasl_session *sctx, Gsasl_property prop)
Definition: obsolete.c:2059
void gsasl_server_callback_cipher_set(Gsasl *ctx, Gsasl_server_callback_cipher cb)
Definition: obsolete.c:1468
void gsasl_client_callback_authorization_id_set(Gsasl *ctx, Gsasl_client_callback_authorization_id cb)
Definition: obsolete.c:691
Gsasl_server_callback_external gsasl_server_callback_external_get(Gsasl *ctx)
Definition: obsolete.c:1274
Gsasl_client_callback_authorization_id gsasl_client_callback_authorization_id_get(Gsasl *ctx)
Definition: obsolete.c:714
void * gsasl_client_application_data_get(Gsasl_session *sctx)
Definition: obsolete.c:356
int gsasl_decode_inline(Gsasl_session *sctx, const char *input, size_t input_len, char *output, size_t *output_len)
Definition: obsolete.c:514
int gsasl_hmac_sha1(const char *key, size_t keylen, const char *in, size_t inlen, char *outhash[])
Definition: obsolete.c:2270
void gsasl_server_callback_securid_set(Gsasl *ctx, Gsasl_server_callback_securid cb)
Definition: obsolete.c:1517
Gsasl_server_callback_qop gsasl_server_callback_qop_get(Gsasl *ctx)
Definition: obsolete.c:1401
int gsasl_server_listmech(Gsasl *ctx, char *out, size_t *outlen)
Definition: obsolete.c:89
Gsasl_client_callback_realm gsasl_client_callback_realm_get(Gsasl *ctx)
Definition: obsolete.c:1060
Gsasl_client_callback_maxbuf gsasl_client_callback_maxbuf_get(Gsasl *ctx)
Definition: obsolete.c:1018
char * gsasl_stringprep_nfkc(const char *in, ssize_t len)
Definition: obsolete.c:1664
Gsasl_server_callback_cipher gsasl_server_callback_cipher_get(Gsasl *ctx)
Definition: obsolete.c:1490
Gsasl * gsasl_server_ctx_get(Gsasl_session *sctx)
Definition: obsolete.c:372
void gsasl_server_callback_cram_md5_set(Gsasl *ctx, Gsasl_server_callback_cram_md5 cb)
Definition: obsolete.c:1167
Gsasl * gsasl_client_ctx_get(Gsasl_session *sctx)
Definition: obsolete.c:315
int gsasl_sha1(const char *in, size_t inlen, char *out[])
Definition: obsolete.c:2244
void gsasl_client_callback_authentication_id_set(Gsasl *ctx, Gsasl_client_callback_authentication_id cb)
Definition: obsolete.c:648
const char * gsasl_server_suggest_mechanism(Gsasl *ctx _GL_UNUSED, const char *mechlist _GL_UNUSED)
Definition: obsolete.c:627
Gsasl_server_callback_realm gsasl_server_callback_realm_get(Gsasl *ctx)
Definition: obsolete.c:1358
void gsasl_server_callback_realm_set(Gsasl *ctx, Gsasl_server_callback_realm cb)
Definition: obsolete.c:1337
Gsasl_server_callback_service gsasl_server_callback_service_get(Gsasl *ctx)
Definition: obsolete.c:1628
Gsasl_server_callback_digest_md5 gsasl_server_callback_digest_md5_get(Gsasl *ctx)
Definition: obsolete.c:1232
void gsasl_client_application_data_set(Gsasl_session *sctx, void *application_data)
Definition: obsolete.c:335
Gsasl_client_callback_anonymous gsasl_client_callback_anonymous_get(Gsasl *ctx)
Definition: obsolete.c:932
void gsasl_client_callback_qop_set(Gsasl *ctx, Gsasl_client_callback_qop cb)
Definition: obsolete.c:952
Gsasl_client_callback_service gsasl_client_callback_service_get(Gsasl *ctx)
Definition: obsolete.c:889
void gsasl_client_callback_passcode_set(Gsasl *ctx, Gsasl_client_callback_passcode cb)
Definition: obsolete.c:777
void gsasl_server_application_data_set(Gsasl_session *sctx, void *application_data)
Definition: obsolete.c:392
void gsasl_server_callback_qop_set(Gsasl *ctx, Gsasl_server_callback_qop cb)
Definition: obsolete.c:1380
char * gsasl_stringprep_saslprep(const char *in, int *stringprep_rc)
Definition: obsolete.c:1695
int gsasl_client_step_base64(Gsasl_session *sctx, const char *b64input, char *b64output, size_t b64output_len)
Definition: obsolete.c:245
int gsasl_hmac_md5(const char *key, size_t keylen, const char *in, size_t inlen, char *outhash[])
Definition: obsolete.c:2219
int gsasl_base64_decode(char const *src, char *target, size_t targsize)
Definition: obsolete.c:1859
Gsasl_client_callback_authentication_id gsasl_client_callback_authentication_id_get(Gsasl *ctx)
Definition: obsolete.c:671
Gsasl_server_callback_gssapi gsasl_server_callback_gssapi_get(Gsasl *ctx)
Definition: obsolete.c:1584
Gsasl_server_callback_anonymous gsasl_server_callback_anonymous_get(Gsasl *ctx)
Definition: obsolete.c:1316
Gsasl_server_callback_maxbuf gsasl_server_callback_maxbuf_get(Gsasl *ctx)
Definition: obsolete.c:1446
void gsasl_server_callback_validate_set(Gsasl *ctx, Gsasl_server_callback_validate cb)
Definition: obsolete.c:1081
const char * _gsasl_obsolete_property_map(Gsasl_session *sctx, Gsasl_property prop)
Definition: obsolete.c:2042
static int _gsasl_step(Gsasl_session *sctx, const char *input, size_t input_len, char *output, size_t *output_len)
Definition: obsolete.c:116
Gsasl_client_callback_password gsasl_client_callback_password_get(Gsasl *ctx)
Definition: obsolete.c:757
Gsasl_server_callback_securid gsasl_server_callback_securid_get(Gsasl *ctx)
Definition: obsolete.c:1539
const char * digest_md5_qops2qopstr(int qops)
Definition: qop.c:92
int digest_md5_qopstr2qops(const char *qopstr)
Definition: qop.c:37
int gsasl_base64_from(const char *in, size_t inlen, char **out, size_t *outlen)
Definition: base64.c:74
int gsasl_base64_to(const char *in, size_t inlen, char **out, size_t *outlen)
Definition: base64.c:44
char * qops
Definition: internal.h:99
char * hostname
Definition: internal.h:95
char * authid
Definition: internal.h:88
char * gssapi_display_name
Definition: internal.h:96
char * pin
Definition: internal.h:92
void * application_data
Definition: internal.h:116
Gsasl * ctx
Definition: internal.h:80
char * passcode
Definition: internal.h:91
char * anonymous_token
Definition: internal.h:87
char * password
Definition: internal.h:90
char * suggestedpin
Definition: internal.h:93
char * authzid
Definition: internal.h:89
Definition: internal.h:41
Gsasl_client_callback_pin cbc_pin
Definition: internal.h:55
Gsasl_server_callback_service cbs_service
Definition: internal.h:72
Gsasl_client_callback_authentication_id cbc_authentication_id
Definition: internal.h:52
Gsasl_server_callback_anonymous cbs_anonymous
Definition: internal.h:67
Gsasl_client_callback_anonymous cbc_anonymous
Definition: internal.h:56
Gsasl_client_callback_password cbc_password
Definition: internal.h:53
Gsasl_client_callback_passcode cbc_passcode
Definition: internal.h:54
Gsasl_client_callback_service cbc_service
Definition: internal.h:59
Gsasl_server_callback_cipher cbs_cipher
Definition: internal.h:71
Gsasl_server_callback_realm cbs_realm
Definition: internal.h:68
Gsasl_server_callback_retrieve cbs_retrieve
Definition: internal.h:63
Gsasl_server_callback_gssapi cbs_gssapi
Definition: internal.h:73
Gsasl_client_callback_maxbuf cbc_maxbuf
Definition: internal.h:58
Gsasl_client_callback_realm cbc_realm
Definition: internal.h:60
Gsasl_server_callback_maxbuf cbs_maxbuf
Definition: internal.h:70
Gsasl_server_callback_cram_md5 cbs_cram_md5
Definition: internal.h:64
Gsasl_server_callback_external cbs_external
Definition: internal.h:66
Gsasl_server_callback_digest_md5 cbs_digest_md5
Definition: internal.h:65
void * application_hook
Definition: internal.h:48
Gsasl_server_callback_qop cbs_qop
Definition: internal.h:69
Gsasl_client_callback_authorization_id cbc_authorization_id
Definition: internal.h:51
Gsasl_client_callback_qop cbc_qop
Definition: internal.h:57
Gsasl_server_callback_validate cbs_validate
Definition: internal.h:61
Gsasl_server_callback_securid cbs_securid
Definition: internal.h:62