d9898ee8 |
1 | #ifndef courierauthsaslclient_h |
2 | #define courierauthsaslclient_h |
3 | |
4 | /* |
5 | ** Copyright 2000-2004 Double Precision, Inc. See COPYING for |
6 | ** distribution information. |
7 | */ |
8 | |
9 | #include "courier_auth_config.h" |
10 | #include "courierauthsasl.h" |
11 | #include <sys/types.h> |
12 | |
13 | #ifdef __cplusplus |
14 | extern "C" { |
15 | #endif |
16 | |
17 | static const char courierauthsaslclient_h_rcsid[]="$Id: courierauthsaslclient.h,v 1.1 2004/10/23 17:31:22 mrsam Exp $"; |
18 | |
19 | /* |
20 | These family of functions are used to implement the SASL client |
21 | interface on top of authlib. |
22 | */ |
23 | |
24 | |
25 | /* |
26 | ** The authsaslclientinfo structure is initialized by the sasl client. |
27 | ** It's the sole argument to authsaslclient(). |
28 | */ |
29 | |
30 | struct authsaslclientinfo { |
31 | |
32 | const char *userid; /* Usually required */ |
33 | const char *password; /* Usually required */ |
34 | |
35 | const char *sasl_funcs; /* A list of SASL methods supported |
36 | ** by the server, space-separated. |
37 | */ |
38 | |
39 | const char *(*start_conv_func)(const char *, const char *, void *); |
40 | /* |
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. |
45 | */ |
46 | |
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). |
51 | */ |
52 | |
53 | int (*final_conv_func)(const char *, void *); |
54 | /* |
55 | ** The "final" base64 message to send to the server. |
56 | */ |
57 | |
58 | int (*plain_conv_func)(const char *, const char *, void *); |
59 | /* |
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 |
64 | ** deal. |
65 | */ |
66 | |
67 | void *conv_func_arg; /* Callback argument to conv_func */ |
68 | } ; |
69 | |
70 | int auth_sasl_client(const struct authsaslclientinfo *); |
71 | /* Returns 0 for success, non zero for failure */ |
72 | |
73 | /* Additional error codes */ |
74 | |
75 | #define AUTHSASL_NOMETHODS -3 |
76 | #define AUTHSASL_CANCELLED -4 |
77 | |
78 | #ifdef __cplusplus |
79 | } |
80 | #endif |
81 | |
82 | #endif |