1 | /* |
1 | /* |
2 | * Copyright © 2006 Atheme Development Group |
2 | * Copyright © 2006 Atheme Development Group |
3 | * Rights to this code are as documented in doc/pod/license.pod. |
3 | * Rights to this code are as documented in doc/pod/license.pod. |
4 | * |
4 | * |
5 | * Data structures for SASL plugin use. |
5 | * Data structures for SASL plugin use. |
6 | * |
6 | * |
7 | * $Id: sasl.h,v 1.2 2007/07/21 01:29:07 pippijn Exp $ |
7 | * $Id: sasl.h,v 1.3 2007/08/28 17:08:07 pippijn Exp $ |
8 | */ |
8 | */ |
9 | |
9 | |
10 | #ifndef SASL_H |
10 | #ifndef SASL_H |
11 | #define SASL_H |
11 | #define SASL_H |
12 | |
12 | |
13 | struct sasl_mechanism_t; |
13 | struct sasl_mechanism_t; |
14 | |
14 | |
15 | struct sasl_session_t |
15 | struct sasl_session_t : zero_initialised |
16 | { |
16 | { |
17 | char uid[IDLEN]; |
17 | char uid[IDLEN]; |
18 | char *buf, *p; |
18 | char *buf, *p; |
19 | int len, flags; |
19 | int len, flags; |
20 | |
20 | |
… | |
… | |
22 | void *mechdata; |
22 | void *mechdata; |
23 | |
23 | |
24 | char *username; |
24 | char *username; |
25 | }; |
25 | }; |
26 | |
26 | |
27 | struct sasl_message_t |
27 | struct sasl_message_t : zero_initialised |
28 | { |
28 | { |
29 | char *uid; |
29 | char *uid; |
30 | char mode; |
30 | char mode; |
31 | char *buf; |
31 | char *buf; |
32 | }; |
32 | }; |
33 | |
33 | |
34 | struct sasl_mechanism_t |
34 | struct sasl_mechanism_t : zero_initialised |
35 | { |
35 | { |
36 | char name[21]; |
36 | char const *name; |
37 | int (*mech_start) (sasl_session_t *sptr, char **buffer, int *buflen); |
37 | int (*mech_start) (sasl_session_t *sptr, char **buffer, int *buflen); |
38 | int (*mech_step) (sasl_session_t *sptr, char *message, int length, char **buffer, int *buflen); |
38 | int (*mech_step) (sasl_session_t *sptr, char *message, int length, char **buffer, int *buflen); |
39 | void (*mech_finish) (sasl_session_t *sptr); |
39 | void (*mech_finish) (sasl_session_t *sptr); |
|
|
40 | |
|
|
41 | sasl_mechanism_t (char const * const mechname, |
|
|
42 | int (*start) (sasl_session_t *sptr, char **buffer, int *buflen), |
|
|
43 | int (*step) (sasl_session_t *sptr, char *message, int length, char **buffer, int *buflen), |
|
|
44 | void (*finish) (sasl_session_t *sptr)) |
|
|
45 | : name (mechname), mech_start (start), mech_step (step), mech_finish (finish) |
|
|
46 | { |
|
|
47 | } |
40 | }; |
48 | }; |
41 | |
49 | |
42 | #define ASASL_FAIL 0 /* client supplied invalid credentials / screwed up their formatting */ |
50 | #define ASASL_FAIL 0 /* client supplied invalid credentials / screwed up their formatting */ |
43 | #define ASASL_MORE 1 /* everything looks good so far, but we're not done yet */ |
51 | #define ASASL_MORE 1 /* everything looks good so far, but we're not done yet */ |
44 | #define ASASL_DONE 2 /* client successfully authenticated */ |
52 | #define ASASL_DONE 2 /* client successfully authenticated */ |