jabberd2
2.2.17
|
#include "sx.h"
#include "sasl.h"
#include <sasl/sasl.h>
#include <sasl/saslutil.h>
#include <sasl/saslplug.h>
Go to the source code of this file.
Data Structures | |
struct | _sx_sasl_st |
our context More... | |
struct | _sx_sasl_data_st |
Typedefs | |
typedef struct _sx_sasl_st * | _sx_sasl_t |
our context | |
typedef struct _sx_sasl_data_st * | _sx_sasl_data_t |
Functions | |
static void | _sx_sasl_free (sx_t s, sx_plugin_t p) |
cleanup | |
static int | _sx_sasl_getopt (void *glob_context, const char *plugin_name, const char *option, const char **result, unsigned *len) |
static void | _sx_auxprop_lookup (void *glob_context, sasl_server_params_t *sparams, unsigned flags, const char *user, unsigned ulen) |
static int | sx_auxprop_init (const sasl_utils_t *utils, int max_version, int *out_version, sasl_auxprop_plug_t **plug, const char *plugname) |
static int | _sx_sasl_checkpass (sasl_conn_t *conn, void *ctx, const char *user, const char *pass, unsigned passlen, struct propctx *propctx) |
static int | _sx_sasl_canon_user (sasl_conn_t *conn, void *ctx, const char *user, unsigned ulen, unsigned flags, const char *user_realm, char *out_user, unsigned out_umax, unsigned *out_ulen) |
static int | _sx_sasl_proxy_policy (sasl_conn_t *conn, void *ctx, const char *requested_user, int rlen, const char *auth_identity, int alen, const char *realm, int urlen, struct propctx *propctx) |
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, sasl_conn_t *sasl) |
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 nad_t | _sx_sasl_success (sx_t s) |
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 void | _sx_sasl_decode (char *in, int inlen, char **out, int *outlen) |
utility: decode incoming handshake data | |
static void | _sx_sasl_encode (char *in, int inlen, char **out, int *outlen) |
utility: encode outgoing handshake data | |
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, 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, 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_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 | |
static int | _sx_sasl_cb_get_simple (void *ctx, int id, const char **result, unsigned *len) |
static int | _sx_sasl_cb_get_secret (sasl_conn_t *conn, void *ctx, int id, sasl_secret_t **psecret) |
int | sx_sasl_auth (sx_plugin_t p, sx_t s, char *appname, char *mech, char *user, char *pass) |
kick off the auth handshake |
Variables | |
static sasl_auxprop_plug_t | _sx_auxprop_plugin |
typedef struct _sx_sasl_st * _sx_sasl_t |
our context
typedef struct _sx_sasl_data_st * _sx_sasl_data_t |
|
static |
cleanup
Definition at line 1000 of file sasl_cyrus.c.
References _sx_debug, _sx_sasl_data_st::callbacks, _sx_plugin_st::index, _sx_st::plugin_data, _sx_sasl_data_st::psecret, _sx_sasl_data_st::sasl, _sx_sasl_data_st::user, and ZONE.
Referenced by _sx_sasl_features(), _sx_sasl_process(), and sx_sasl_init().
|
static |
Definition at line 69 of file sasl_cyrus.c.
Referenced by sx_sasl_init().
|
static |
Definition at line 111 of file sasl_cyrus.c.
References sx_sasl_creds_st::authnid, _sx_sasl_st::cb, _sx_sasl_st::cbarg, sx_sasl_creds_st::realm, sx_sasl_cb_GET_PASS, and sx_sasl_ret_OK.
|
static |
Definition at line 180 of file sasl_cyrus.c.
References _sx_auxprop_plugin.
Referenced by sx_sasl_init().
|
static |
Definition at line 198 of file sasl_cyrus.c.
References sx_sasl_creds_st::authnid, _sx_sasl_st::cb, _sx_sasl_st::cbarg, _sx_sasl_data_st::ctx, sx_sasl_creds_st::pass, sx_sasl_creds_st::realm, _sx_sasl_data_st::stream, sx_sasl_cb_CHECK_PASS, and sx_sasl_ret_OK.
Referenced by _sx_sasl_stream().
|
static |
Definition at line 232 of file sasl_cyrus.c.
References _sx_sasl_st::cb, _sx_sasl_st::cbarg, _sx_sasl_data_st::ctx, _sx_sasl_data_st::stream, and sx_sasl_cb_GEN_AUTHZID.
Referenced by _sx_sasl_stream().
|
static |
Definition at line 252 of file sasl_cyrus.c.
References sx_sasl_creds_st::authnid, sx_sasl_creds_st::authzid, _sx_sasl_st::cb, _sx_sasl_st::cbarg, _sx_sasl_data_st::ctx, sx_sasl_creds_st::realm, _sx_st::req_to, _sx_sasl_data_st::stream, sx_sasl_cb_CHECK_AUTHZID, and sx_sasl_ret_OK.
Referenced by _sx_sasl_stream().
|
static |
Definition at line 340 of file sasl_cyrus.c.
References _sx_buffer_set(), _sx_debug, _sx_buf_st::data, _sx_plugin_st::index, _sx_buf_st::len, _sx_st::plugin_data, and ZONE.
Referenced by sx_sasl_init().
|
static |
Definition at line 382 of file sasl_cyrus.c.
References _sx_buffer_set(), _sx_debug, _sx_event, _sx_gen_error, _sx_buf_st::data, event_ERROR, _sx_plugin_st::index, _sx_buf_st::len, _sx_st::plugin_data, SX_ERR_AUTH, and ZONE.
Referenced by sx_sasl_init().
void _sx_sasl_open | ( | sx_t | s, |
sasl_conn_t * | sasl | ||
) |
move the stream to the auth state
Definition at line 415 of file sasl_cyrus.c.
References sx_sasl_creds_st::authzid, _sx_st::req_to, _sx_st::ssf, sx_auth(), _sx_st::type, and type_SERVER.
Referenced by _sx_sasl_stream().
|
static |
make the stream authenticated second time round
Definition at line 471 of file sasl_cyrus.c.
References _sx_debug, _sx_sasl_canon_user(), _sx_sasl_checkpass(), _sx_sasl_open(), _sx_sasl_proxy_policy(), _sx_sasl_st::appname, _sx_sasl_st::cb, _sx_sasl_st::cbarg, _sx_st::flags, _sx_plugin_st::index, _sx_st::plugin_data, _sx_plugin_st::private, sx_sasl_creds_st::realm, _sx_sasl_st::sec_props, sx_sasl_cb_GET_REALM, SX_SASL_OFFER, SX_SSL_MAGIC, _sx_st::type, type_SERVER, and ZONE.
Referenced by sx_sasl_init().
|
static |
Definition at line 583 of file sasl_cyrus.c.
References _sx_debug, _sx_sasl_free(), _sx_sasl_st::cb, _sx_sasl_st::cbarg, _sx_sasl_data_st::ctx, _sx_st::flags, _sx_plugin_st::index, nad_add_namespace(), nad_append_cdata(), nad_append_elem(), _sx_st::plugin_data, _sx_sasl_data_st::sasl, _sx_st::ssf, _sx_sasl_data_st::stream, sx_sasl_cb_CHECK_MECH, SX_SASL_OFFER, sx_sasl_ret_OK, SX_SSL_STARTTLS_REQUIRE, _sx_st::type, type_SERVER, uri_SASL, and ZONE.
Referenced by sx_sasl_init().
utility: generate a success nad
Definition at line 650 of file sasl_cyrus.c.
References nad_add_namespace(), nad_append_elem(), nad_new(), and uri_SASL.
Referenced by _sx_sasl_client_process().
utility: generate a failure nad
Definition at line 663 of file sasl_cyrus.c.
References nad_add_namespace(), nad_append_elem(), nad_new(), and uri_SASL.
Referenced by _sx_sasl_client_process(), and _sx_sasl_process().
utility: generate a challenge nad
Definition at line 678 of file sasl_cyrus.c.
References nad_add_namespace(), nad_append_cdata(), nad_append_elem(), nad_new(), and uri_SASL.
Referenced by _sx_sasl_client_process().
utility: generate a response nad
Definition at line 693 of file sasl_cyrus.c.
References nad_add_namespace(), nad_append_cdata(), nad_append_elem(), nad_new(), and uri_SASL.
Referenced by _sx_sasl_server_process().
utility: generate an abort nad
Definition at line 708 of file sasl_cyrus.c.
References nad_add_namespace(), nad_append_elem(), nad_new(), and uri_SASL.
Referenced by _sx_sasl_server_process().
|
static |
utility: decode incoming handshake data
Definition at line 721 of file sasl_cyrus.c.
Referenced by _sx_sasl_client_process(), and _sx_sasl_server_process().
|
static |
utility: encode outgoing handshake data
Definition at line 727 of file sasl_cyrus.c.
Referenced by _sx_sasl_client_process(), and _sx_sasl_server_process().
|
static |
auth done, restart the stream
Definition at line 733 of file sasl_cyrus.c.
References _sx_chain_io_plugin(), _sx_debug, _sx_reset(), _sx_st::flags, sx_server_init(), and ZONE.
Referenced by _sx_sasl_client_process().
|
static |
process handshake packets from the client
Definition at line 745 of file sasl_cyrus.c.
References _sasl_err_MALFORMED_REQUEST, _sasl_err_MECH_TOO_WEAK, _sx_debug, _sx_nad_write(), _sx_sasl_challenge(), _sx_sasl_decode(), _sx_sasl_encode(), _sx_sasl_failure(), _sx_sasl_notify_success(), _sx_sasl_success(), _jqueue_node_st::data, _jqueue_st::front, _sx_plugin_st::index, _sx_st::plugin_data, _sx_sasl_data_st::sasl, _sx_st::wbufq, and ZONE.
Referenced by _sx_sasl_process().
|
static |
process handshake packets from the server
Definition at line 813 of file sasl_cyrus.c.
References _sx_debug, _sx_nad_write(), _sx_sasl_abort(), _sx_sasl_decode(), _sx_sasl_encode(), _sx_sasl_response(), _sx_plugin_st::index, _sx_st::plugin_data, _sx_sasl_data_st::sasl, and ZONE.
Referenced by _sx_sasl_process().
|
static |
main nad processor
Definition at line 853 of file sasl_cyrus.c.
References _sasl_err_ABORTED, _sasl_err_INVALID_MECHANISM, _sx_chain_io_plugin(), _sx_debug, _sx_event, _sx_gen_error, _sx_nad_write(), _sx_reset(), _sx_sasl_client_process(), _sx_sasl_failure(), _sx_sasl_free(), _sx_sasl_server_process(), event_ERROR, _sx_st::flags, _sx_plugin_st::index, NAD_AVAL, NAD_AVAL_L, NAD_CDATA, NAD_CDATA_L, NAD_ENAME, NAD_ENAME_L, NAD_ENS, nad_find_attr(), nad_free(), NAD_NURI, NAD_NURI_L, _sx_st::ns, _sx_st::plugin_data, _sx_st::req_from, _sx_st::req_to, _sx_st::req_version, _sx_st::ssf, _sx_st::state, state_STREAM, sx_client_init(), SX_ERR_AUTH, SX_SASL_OFFER, SX_SSL_STARTTLS_REQUIRE, _sx_st::type, type_CLIENT, type_SERVER, uri_SASL, and ZONE.
Referenced by sx_sasl_init().
|
static |
Definition at line 1018 of file sasl_cyrus.c.
References _sx_sasl_st::appname, _sx_plugin_st::private, and _sx_sasl_st::saslcallbacks.
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 1030 of file sasl_cyrus.c.
References _sx_debug, _sx_sasl_features(), _sx_sasl_free(), _sx_sasl_getopt(), _sx_sasl_process(), _sx_sasl_rio(), _sx_sasl_stream(), _sx_sasl_unload(), _sx_sasl_wio(), _sx_sasl_st::appname, _sx_sasl_st::cb, _sx_sasl_st::cbarg, _sx_plugin_st::features, _sx_plugin_st::free, _sx_plugin_st::private, _sx_plugin_st::process, _sx_plugin_st::rio, _sx_sasl_st::saslcallbacks, _sx_sasl_st::sec_props, _sx_plugin_st::stream, sx_auxprop_init(), _sx_plugin_st::unload, _sx_plugin_st::wio, and ZONE.
|
static |
Definition at line 1112 of file sasl_cyrus.c.
References _sx_debug, _sx_sasl_data_st::user, and ZONE.
|
static |
Definition at line 1125 of file sasl_cyrus.c.
References _sx_debug, _sx_sasl_data_st::psecret, and ZONE.
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 1141 of file sasl_cyrus.c.
References _sx_plugin_st::private.
|
static |
Definition at line 176 of file sasl_cyrus.c.
Referenced by sx_auxprop_init().