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>
19 These family of functions are used to implement the SASL client
20 interface on top of authlib.
25 ** The authsaslclientinfo structure is initialized by the sasl client.
26 ** It's the sole argument to authsaslclient().
29 struct authsaslclientinfo
{
31 const char *userid
; /* Usually required */
32 const char *password
; /* Usually required */
34 const char *sasl_funcs
; /* A list of SASL methods supported
35 ** by the server, space-separated.
38 const char *(*start_conv_func
)(const char *, const char *, void *);
40 ** Start SASL conversation. First argument is the
41 ** SASL method name. The second argument is the
42 ** initial message to send to the SASL server, base64-
43 ** encoded, or NULL if there is no initial message.
46 const char *(*conv_func
)(const char *, void *);
47 /* The conversation function. It receives a base64
48 ** string to send to the server, and returns a
49 ** base64 response (or NULL of there was an error).
52 int (*final_conv_func
)(const char *, void *);
54 ** The "final" base64 message to send to the server.
57 int (*plain_conv_func
)(const char *, const char *, void *);
59 ** plain_conv_func is used when the SASL method is
60 ** a simple method involving a single message, like
61 ** PLAIN. plain_conv_func is basically a merge between
62 ** start_conv_func and final_conv_func, a one-shot
66 void *conv_func_arg
; /* Callback argument to conv_func */
69 int auth_sasl_client(const struct authsaslclientinfo
*);
70 /* Returns 0 for success, non zero for failure */
72 /* Additional error codes */
74 #define AUTHSASL_NOMETHODS -3
75 #define AUTHSASL_CANCELLED -4