jabberd2  2.2.17
Data Structures | Typedefs | Functions | Variables
sasl_cyrus.c File Reference
#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 Documentation

typedef struct _sx_sasl_st * _sx_sasl_t

our context


Function Documentation

static void _sx_sasl_free ( sx_t  s,
sx_plugin_t  p 
)
static
static int _sx_sasl_getopt ( void *  glob_context,
const char *  plugin_name,
const char *  option,
const char **  result,
unsigned *  len 
)
static

Definition at line 69 of file sasl_cyrus.c.

Referenced by sx_sasl_init().

static void _sx_auxprop_lookup ( void *  glob_context,
sasl_server_params_t *  sparams,
unsigned  flags,
const char *  user,
unsigned  ulen 
)
static
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

Definition at line 180 of file sasl_cyrus.c.

References _sx_auxprop_plugin.

Referenced by sx_sasl_init().

static int _sx_sasl_checkpass ( sasl_conn_t *  conn,
void *  ctx,
const char *  user,
const char *  pass,
unsigned  passlen,
struct propctx *  propctx 
)
static
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
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
static int _sx_sasl_wio ( sx_t  s,
sx_plugin_t  p,
sx_buf_t  buf 
)
static
static int _sx_sasl_rio ( sx_t  s,
sx_plugin_t  p,
sx_buf_t  buf 
)
static
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 void _sx_sasl_stream ( sx_t  s,
sx_plugin_t  p 
)
static
static void _sx_sasl_features ( sx_t  s,
sx_plugin_t  p,
nad_t  nad 
)
static
static nad_t _sx_sasl_success ( sx_t  s)
static

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().

static nad_t _sx_sasl_failure ( sx_t  s,
const char *  err 
)
static

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().

static nad_t _sx_sasl_challenge ( sx_t  s,
char *  data,
int  dlen 
)
static

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().

static nad_t _sx_sasl_response ( sx_t  s,
char *  data,
int  dlen 
)
static

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().

static nad_t _sx_sasl_abort ( sx_t  s)
static

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 void _sx_sasl_decode ( char *  in,
int  inlen,
char **  out,
int *  outlen 
)
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 void _sx_sasl_encode ( char *  in,
int  inlen,
char **  out,
int *  outlen 
)
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 void _sx_sasl_notify_success ( sx_t  s,
void *  arg 
)
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 void _sx_sasl_client_process ( sx_t  s,
sx_plugin_t  p,
char *  mech,
char *  in,
int  inlen 
)
static
static void _sx_sasl_server_process ( sx_t  s,
sx_plugin_t  p,
char *  in,
int  inlen 
)
static
static int _sx_sasl_process ( sx_t  s,
sx_plugin_t  p,
nad_t  nad 
)
static
static void _sx_sasl_unload ( sx_plugin_t  p)
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 
)
static int _sx_sasl_cb_get_simple ( void *  ctx,
int  id,
const char **  result,
unsigned *  len 
)
static

Definition at line 1112 of file sasl_cyrus.c.

References _sx_debug, _sx_sasl_data_st::user, and ZONE.

static int _sx_sasl_cb_get_secret ( sasl_conn_t *  conn,
void *  ctx,
int  id,
sasl_secret_t **  psecret 
)
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.


Variable Documentation

sasl_auxprop_plug_t _sx_auxprop_plugin
static
Initial value:
{0, 0, NULL, NULL, _sx_auxprop_lookup, "jabberdsx", NULL}

Definition at line 176 of file sasl_cyrus.c.

Referenced by sx_auxprop_init().