1 #ifndef courierauthsaslclient_h
2 #define courierauthsaslclient_h
5 ** Copyright 2000-2004 Double Precision, Inc. See COPYING for
6 ** distribution information.
9 #include "courier_auth_config.h"
10 #include "courierauthsasl.h"
11 #include <sys/types.h>
17 static const char courierauthsaslclient_h_rcsid
[]="$Id: courierauthsaslclient.h,v 1.1 2004/10/23 17:31:22 mrsam Exp $";
20 These family of functions are used to implement the SASL client
21 interface on top of authlib.
26 ** The authsaslclientinfo structure is initialized by the sasl client.
27 ** It's the sole argument to authsaslclient().
30 struct authsaslclientinfo
{
32 const char *userid
; /* Usually required */
33 const char *password
; /* Usually required */
35 const char *sasl_funcs
; /* A list of SASL methods supported
36 ** by the server, space-separated.
39 const char *(*start_conv_func
)(const char *, const char *, void *);
41 ** Start SASL conversation. First argument is the
42 ** SASL method name. The second argument is the
43 ** initial message to send to the SASL server, base64-
44 ** encoded, or NULL if there is no initial message.
47 const char *(*conv_func
)(const char *, void *);
48 /* The conversation function. It receives a base64
49 ** string to send to the server, and returns a
50 ** base64 response (or NULL of there was an error).
53 int (*final_conv_func
)(const char *, void *);
55 ** The "final" base64 message to send to the server.
58 int (*plain_conv_func
)(const char *, const char *, void *);
60 ** plain_conv_func is used when the SASL method is
61 ** a simple method involving a single message, like
62 ** PLAIN. plain_conv_func is basically a merge between
63 ** start_conv_func and final_conv_func, a one-shot
67 void *conv_func_arg
; /* Callback argument to conv_func */
70 int auth_sasl_client(const struct authsaslclientinfo
*);
71 /* Returns 0 for success, non zero for failure */
73 /* Additional error codes */
75 #define AUTHSASL_NOMETHODS -3
76 #define AUTHSASL_CANCELLED -4