1 |
/** |
2 |
* sasl.h: Data structures for SASL plugin use. |
3 |
* |
4 |
* Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team |
5 |
* Rights to this code are as documented in COPYING. |
6 |
* |
7 |
* |
8 |
* Portions of this file were derived from sources bearing the following license: |
9 |
* Copyright © 2006 Atheme Development Group |
10 |
* Rights to this code are as documented in doc/pod/license.pod. |
11 |
* |
12 |
* $Id: sasl.h,v 1.3 2007-08-28 17:08:07 pippijn Exp $ |
13 |
*/ |
14 |
|
15 |
#ifndef SASL_H |
16 |
#define SASL_H |
17 |
|
18 |
struct sasl_mechanism_t; |
19 |
|
20 |
struct sasl_session_t : zero_initialised |
21 |
{ |
22 |
char uid[IDLEN]; |
23 |
char *buf, *p; |
24 |
int len, flags; |
25 |
|
26 |
sasl_mechanism_t *mechptr; |
27 |
void *mechdata; |
28 |
|
29 |
char *username; |
30 |
}; |
31 |
|
32 |
struct sasl_message_t : zero_initialised |
33 |
{ |
34 |
char *uid; |
35 |
char mode; |
36 |
char *buf; |
37 |
}; |
38 |
|
39 |
struct sasl_mechanism_t : zero_initialised |
40 |
{ |
41 |
char const *name; |
42 |
int (*mech_start) (sasl_session_t *sptr, char **buffer, int *buflen); |
43 |
int (*mech_step) (sasl_session_t *sptr, char *message, int length, char **buffer, int *buflen); |
44 |
void (*mech_finish) (sasl_session_t *sptr); |
45 |
|
46 |
sasl_mechanism_t (char const * const mechname, |
47 |
int (*start) (sasl_session_t *sptr, char **buffer, int *buflen), |
48 |
int (*step) (sasl_session_t *sptr, char *message, int length, char **buffer, int *buflen), |
49 |
void (*finish) (sasl_session_t *sptr)) |
50 |
: name (mechname), mech_start (start), mech_step (step), mech_finish (finish) |
51 |
{ |
52 |
} |
53 |
}; |
54 |
|
55 |
#define ASASL_FAIL 0 /* client supplied invalid credentials / screwed up their formatting */ |
56 |
#define ASASL_MORE 1 /* everything looks good so far, but we're not done yet */ |
57 |
#define ASASL_DONE 2 /* client successfully authenticated */ |
58 |
|
59 |
#define ASASL_MARKED_FOR_DELETION 1 /* see delete_stale() in saslserv/main.c */ |
60 |
#define ASASL_NEED_LOG 2 /* user auth success needs to be logged still */ |
61 |
|
62 |
#endif |