jabberd2
2.2.16
|
Go to the source code of this file.
Data Structures | |
struct | _sx_sasl_st |
our context More... | |
struct | Gsasl_session |
struct | digest_md5_challenge |
struct | digest_md5_response |
struct | digest_md5_finish |
struct | _Gsasl_digest_md5_server_state |
Defines | |
#define | DIGEST_MD5_LENGTH 16 |
#define | DIGEST_MD5_RESPONSE_LENGTH 32 |
Typedefs | |
typedef struct _sx_sasl_st * | _sx_sasl_t |
our context | |
typedef struct digest_md5_challenge | digest_md5_challenge |
typedef enum digest_md5_qop | digest_md5_qop |
typedef enum digest_md5_cipher | digest_md5_cipher |
typedef struct digest_md5_response | digest_md5_response |
typedef struct digest_md5_finish | digest_md5_finish |
typedef struct _Gsasl_digest_md5_server_state | _Gsasl_digest_md5_server_state |
Enumerations | |
enum | digest_md5_qop { DIGEST_MD5_QOP_AUTH = 1, DIGEST_MD5_QOP_AUTH_INT = 2, DIGEST_MD5_QOP_AUTH_CONF = 4 } |
enum | digest_md5_cipher { DIGEST_MD5_CIPHER_DES = 1, DIGEST_MD5_CIPHER_3DES = 2, DIGEST_MD5_CIPHER_RC4 = 4, DIGEST_MD5_CIPHER_RC4_40 = 8, DIGEST_MD5_CIPHER_RC4_56 = 16, DIGEST_MD5_CIPHER_AES_CBC = 32 } |
Functions | |
static nad_t | _sx_sasl_success (sx_t s, char *data, int dlen) |
utility: generate a success nad | |
static nad_t | _sx_sasl_failure (sx_t s, const char *err) |
utility: generate a failure nad | |
static nad_t | _sx_sasl_challenge (sx_t s, char *data, int dlen) |
utility: generate a challenge nad | |
static nad_t | _sx_sasl_response (sx_t s, char *data, int dlen) |
utility: generate a response nad | |
static nad_t | _sx_sasl_abort (sx_t s) |
utility: generate an abort nad | |
static int | _sx_sasl_wio (sx_t s, sx_plugin_t p, sx_buf_t buf) |
static int | _sx_sasl_rio (sx_t s, sx_plugin_t p, sx_buf_t buf) |
void | _sx_sasl_open (sx_t s, Gsasl_session *sd) |
move the stream to the auth state | |
static void | _sx_sasl_stream (sx_t s, sx_plugin_t p) |
make the stream authenticated second time round | |
static void | _sx_sasl_features (sx_t s, sx_plugin_t p, nad_t nad) |
static void | _sx_sasl_notify_success (sx_t s, void *arg) |
auth done, restart the stream | |
static void | _sx_sasl_client_process (sx_t s, sx_plugin_t p, Gsasl_session *sd, char *mech, char *in, int inlen) |
process handshake packets from the client | |
static void | _sx_sasl_server_process (sx_t s, sx_plugin_t p, Gsasl_session *sd, char *in, int inlen) |
process handshake packets from the server | |
static int | _sx_sasl_process (sx_t s, sx_plugin_t p, nad_t nad) |
main nad processor | |
static void | _sx_sasl_free (sx_t s, sx_plugin_t p) |
cleanup | |
static int | _sx_sasl_gsasl_callback (Gsasl *gsasl_ctx, Gsasl_session *sd, Gsasl_property prop) |
static void | _sx_sasl_unload (sx_plugin_t p) |
int | sx_sasl_init (sx_env_t env, sx_plugin_t p, va_list args) |
args: appname, callback, cb arg | |
int | sx_sasl_auth (sx_plugin_t p, sx_t s, char *appname, char *mech, char *user, char *pass) |
kick off the auth handshake |
#define DIGEST_MD5_LENGTH 16 |
Definition at line 67 of file sasl_gsasl.c.
#define DIGEST_MD5_RESPONSE_LENGTH 32 |
Definition at line 101 of file sasl_gsasl.c.
typedef struct _sx_sasl_st * _sx_sasl_t |
our context
typedef struct digest_md5_challenge digest_md5_challenge |
Definition at line 80 of file sasl_gsasl.c.
typedef enum digest_md5_qop digest_md5_qop |
Definition at line 88 of file sasl_gsasl.c.
typedef enum digest_md5_cipher digest_md5_cipher |
Definition at line 99 of file sasl_gsasl.c.
typedef struct digest_md5_response digest_md5_response |
Definition at line 117 of file sasl_gsasl.c.
typedef struct digest_md5_finish digest_md5_finish |
Definition at line 123 of file sasl_gsasl.c.
typedef struct _Gsasl_digest_md5_server_state _Gsasl_digest_md5_server_state |
Definition at line 138 of file sasl_gsasl.c.
enum digest_md5_qop |
Definition at line 82 of file sasl_gsasl.c.
enum digest_md5_cipher |
DIGEST_MD5_CIPHER_DES | |
DIGEST_MD5_CIPHER_3DES | |
DIGEST_MD5_CIPHER_RC4 | |
DIGEST_MD5_CIPHER_RC4_40 | |
DIGEST_MD5_CIPHER_RC4_56 | |
DIGEST_MD5_CIPHER_AES_CBC |
Definition at line 90 of file sasl_gsasl.c.
utility: generate a success nad
Definition at line 141 of file sasl_gsasl.c.
References nad_new(), nad_add_namespace(), uri_SASL, nad_append_elem(), and nad_append_cdata().
Referenced by _sx_sasl_client_process().
utility: generate a failure nad
Definition at line 156 of file sasl_gsasl.c.
References nad_new(), nad_add_namespace(), uri_SASL, and nad_append_elem().
Referenced by _sx_sasl_client_process(), and _sx_sasl_process().
utility: generate a challenge nad
Definition at line 171 of file sasl_gsasl.c.
References nad_new(), nad_add_namespace(), uri_SASL, nad_append_elem(), and nad_append_cdata().
Referenced by _sx_sasl_client_process().
utility: generate a response nad
Definition at line 186 of file sasl_gsasl.c.
References nad_new(), nad_add_namespace(), uri_SASL, nad_append_elem(), and nad_append_cdata().
Referenced by _sx_sasl_server_process().
utility: generate an abort nad
Definition at line 201 of file sasl_gsasl.c.
References nad_new(), nad_add_namespace(), uri_SASL, and nad_append_elem().
Referenced by _sx_sasl_server_process().
static int _sx_sasl_wio | ( | sx_t | s, |
sx_plugin_t | p, | ||
sx_buf_t | buf | ||
) | [static] |
Definition at line 213 of file sasl_gsasl.c.
References _sx_st::plugin_data, _sx_plugin_st::index, _sx_debug, ZONE, _sx_buf_st::data, _sx_buf_st::len, _sx_gen_error, SX_ERR_AUTH, _sx_event, event_ERROR, and _sx_buffer_set().
Referenced by sx_sasl_init().
static int _sx_sasl_rio | ( | sx_t | s, |
sx_plugin_t | p, | ||
sx_buf_t | buf | ||
) | [static] |
Definition at line 241 of file sasl_gsasl.c.
References _sx_st::plugin_data, _sx_plugin_st::index, _sx_debug, ZONE, _sx_buf_st::data, _sx_buf_st::len, _sx_gen_error, SX_ERR_AUTH, _sx_event, event_ERROR, and _sx_buffer_set().
Referenced by sx_sasl_init().
void _sx_sasl_open | ( | sx_t | s, |
Gsasl_session * | sd | ||
) |
move the stream to the auth state
Definition at line 270 of file sasl_gsasl.c.
References Gsasl_session::mech, sx_sasl_creds_st::authzid, sx_sasl_creds_st::authnid, sx_sasl_creds_st::realm, _sx_sasl_st::cb, sx_sasl_cb_CHECK_AUTHZID, _sx_sasl_st::cbarg, sx_sasl_ret_OK, _sx_debug, ZONE, _sx_st::req_to, and sx_auth().
static void _sx_sasl_stream | ( | sx_t | s, |
sx_plugin_t | p | ||
) | [static] |
make the stream authenticated second time round
Definition at line 314 of file sasl_gsasl.c.
References _sx_st::plugin_data, _sx_plugin_st::index, _sx_debug, ZONE, and _sx_sasl_open().
Referenced by sx_sasl_init().
static void _sx_sasl_features | ( | sx_t | s, |
sx_plugin_t | p, | ||
nad_t | nad | ||
) | [static] |
Definition at line 331 of file sasl_gsasl.c.
References _sx_plugin_st::private, _sx_st::plugin_data, _sx_plugin_st::index, _sx_st::type, type_SERVER, _sx_debug, ZONE, _sx_st::flags, SX_SASL_OFFER, SX_SSL_STARTTLS_REQUIRE, _sx_st::ssf, _sx_sasl_st::gsasl_ctx, _sx_sasl_st::cb, sx_sasl_cb_CHECK_MECH, _sx_sasl_st::cbarg, sx_sasl_ret_OK, nad_add_namespace(), uri_SASL, nad_append_elem(), and nad_append_cdata().
Referenced by sx_sasl_init().
static void _sx_sasl_notify_success | ( | sx_t | s, |
void * | arg | ||
) | [static] |
auth done, restart the stream
Definition at line 394 of file sasl_gsasl.c.
References _sx_chain_io_plugin(), _sx_debug, ZONE, _sx_reset(), sx_server_init(), and _sx_st::flags.
Referenced by _sx_sasl_client_process().
static void _sx_sasl_client_process | ( | sx_t | s, |
sx_plugin_t | p, | ||
Gsasl_session * | sd, | ||
char * | mech, | ||
char * | in, | ||
int | inlen | ||
) | [static] |
process handshake packets from the client
Definition at line 406 of file sasl_gsasl.c.
References _sx_plugin_st::private, sx_sasl_creds_st::realm, _sx_debug, ZONE, _sx_sasl_st::gsasl_ctx, _sx_nad_write(), _sx_sasl_failure(), _sasl_err_INVALID_MECHANISM, _sasl_err_TEMPORARY_FAILURE, _sx_sasl_st::cb, sx_sasl_cb_GET_REALM, _sx_sasl_st::cbarg, Gsasl_session::mech_data, _Gsasl_digest_md5_server_state::challenge, digest_md5_challenge::qops, DIGEST_MD5_QOP_AUTH, SX_SSL_MAGIC, SX_CONN_EXTERNAL_ID_MAX_COUNT, _sx_plugin_st::index, sx_sasl_cb_GEN_AUTHZID, _sasl_err_INCORRECT_ENCODING, _sasl_err_MALFORMED_REQUEST, _sasl_err_MECH_TOO_WEAK, _sx_sasl_success(), _sx_st::wbufq, _jqueue_st::front, _jqueue_node_st::data, _sx_sasl_notify_success(), and _sx_sasl_challenge().
Referenced by _sx_sasl_process().
static void _sx_sasl_server_process | ( | sx_t | s, |
sx_plugin_t | p, | ||
Gsasl_session * | sd, | ||
char * | in, | ||
int | inlen | ||
) | [static] |
process handshake packets from the server
Definition at line 591 of file sasl_gsasl.c.
References _sx_debug, ZONE, _sx_nad_write(), _sx_sasl_response(), and _sx_sasl_abort().
Referenced by _sx_sasl_process().
static int _sx_sasl_process | ( | sx_t | s, |
sx_plugin_t | p, | ||
nad_t | nad | ||
) | [static] |
main nad processor
Definition at line 635 of file sasl_gsasl.c.
References _sx_st::plugin_data, _sx_plugin_st::index, NAD_ENS, NAD_NURI_L, uri_SASL, NAD_NURI, _sx_st::state, state_STREAM, _sx_debug, ZONE, nad_free(), _sx_st::type, type_SERVER, _sx_st::flags, SX_SASL_OFFER, SX_SSL_STARTTLS_REQUIRE, _sx_st::ssf, NAD_ENAME_L, NAD_ENAME, nad_find_attr(), _sx_nad_write(), _sx_sasl_failure(), _sasl_err_INVALID_MECHANISM, NAD_AVAL_L, NAD_AVAL, _sx_sasl_client_process(), NAD_CDATA, NAD_CDATA_L, _sasl_err_ABORTED, type_CLIENT, _sx_sasl_server_process(), _sx_st::ns, _sx_st::req_to, _sx_st::req_from, _sx_st::req_version, _sx_reset(), sx_client_init(), _sx_gen_error, SX_ERR_AUTH, _sx_event, and event_ERROR.
Referenced by sx_sasl_init().
static void _sx_sasl_free | ( | sx_t | s, |
sx_plugin_t | p | ||
) | [static] |
cleanup
Definition at line 781 of file sasl_gsasl.c.
References _sx_st::plugin_data, _sx_plugin_st::index, _sx_debug, and ZONE.
Referenced by sx_sasl_init().
static int _sx_sasl_gsasl_callback | ( | Gsasl * | gsasl_ctx, |
Gsasl_session * | sd, | ||
Gsasl_property | prop | ||
) | [static] |
Definition at line 793 of file sasl_gsasl.c.
References _sx_debug, ZONE, _sx_sasl_st::cb, sx_sasl_creds_st::authnid, sx_sasl_creds_st::realm, sx_sasl_cb_GET_PASS, _sx_sasl_st::cbarg, sx_sasl_ret_OK, sx_sasl_creds_st::pass, sx_sasl_cb_CHECK_PASS, sx_sasl_creds_st::authzid, SX_CONN_EXTERNAL_ID_MAX_COUNT, and _sx_sasl_st::ext_id.
Referenced by sx_sasl_init().
static void _sx_sasl_unload | ( | sx_plugin_t | p | ) | [static] |
Definition at line 910 of file sasl_gsasl.c.
References _sx_plugin_st::private, _sx_sasl_st::gsasl_ctx, _sx_sasl_st::appname, SX_CONN_EXTERNAL_ID_MAX_COUNT, and _sx_sasl_st::ext_id.
Referenced by sx_sasl_init().
int sx_sasl_init | ( | sx_env_t | env, |
sx_plugin_t | p, | ||
va_list | args | ||
) |
args: appname, callback, cb arg
init function
Definition at line 926 of file sasl_gsasl.c.
References _sx_debug, ZONE, _sx_sasl_st::appname, _sx_sasl_st::cb, _sx_sasl_st::cbarg, SX_CONN_EXTERNAL_ID_MAX_COUNT, _sx_sasl_st::ext_id, _sx_sasl_st::gsasl_ctx, _sx_sasl_gsasl_callback(), _sx_plugin_st::private, _sx_plugin_st::unload, _sx_sasl_unload(), _sx_plugin_st::wio, _sx_sasl_wio(), _sx_plugin_st::rio, _sx_sasl_rio(), _sx_plugin_st::stream, _sx_sasl_stream(), _sx_plugin_st::features, _sx_sasl_features(), _sx_plugin_st::process, _sx_sasl_process(), _sx_plugin_st::free, and _sx_sasl_free().
Referenced by JABBER_MAIN().
int sx_sasl_auth | ( | sx_plugin_t | p, |
sx_t | s, | ||
char * | appname, | ||
char * | mech, | ||
char * | user, | ||
char * | pass | ||
) |
kick off the auth handshake
trigger for client auth
Definition at line 979 of file sasl_gsasl.c.
References _sx_plugin_st::private, _sx_st::type, type_CLIENT, _sx_st::state, state_STREAM, _sx_debug, ZONE, _sx_sasl_st::gsasl_ctx, _sx_st::plugin_data, _sx_plugin_st::index, nad_new(), nad_add_namespace(), uri_SASL, nad_append_elem(), nad_append_attr(), nad_append_cdata(), and sx_nad_write.
Referenced by c2s_router_sx_callback(), sm_sx_callback(), and s2s_router_sx_callback().