jabberd2  2.3.1
Data Structures | Typedefs | Functions | Variables
sasl_cyrus.c File Reference
#include <sys/types.h>
#include "sasl_switch_hit.h"
#include "auth_event.h"
#include "odkerb.h"
#include "sx.h"
#include "sasl.h"
#include <ldap.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 More...
 
typedef struct _sx_sasl_data_st_sx_sasl_data_t
 

Functions

static void _sx_sasl_free (sx_t s, sx_plugin_t p)
 cleanup More...
 
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, const 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, sx_plugin_t p)
 move the stream to the auth state More...
 
static void _sx_sasl_stream (sx_t s, sx_plugin_t p)
 make the stream authenticated second time round More...
 
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 More...
 
static nad_t _sx_sasl_failure (sx_t s, const char *err)
 utility: generate a failure nad More...
 
static nad_t _sx_sasl_challenge (sx_t s, const char *data, int dlen)
 utility: generate a challenge nad More...
 
static nad_t _sx_sasl_response (sx_t s, const char *data, int dlen)
 utility: generate a response nad More...
 
static nad_t _sx_sasl_abort (sx_t s)
 utility: generate an abort nad More...
 
static void _sx_sasl_decode (char *in, int inlen, char **out, int *outlen)
 utility: decode incoming handshake data More...
 
static void _sx_sasl_encode (char *in, int inlen, char **out, int *outlen)
 utility: encode outgoing handshake data More...
 
static void _sx_sasl_notify_success (sx_t s, void *arg)
 auth done, restart the stream More...
 
static void _sx_sasl_client_process (sx_t s, sx_plugin_t p, const char *mech, const char *in, int inlen)
 process handshake packets from the client More...
 
static void _sx_sasl_server_process (sx_t s, sx_plugin_t p, const char *in, int inlen)
 process handshake packets from the server More...
 
static int _sx_sasl_process (sx_t s, sx_plugin_t p, nad_t nad)
 main nad processor More...
 
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 More...
 
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, const char *appname, const char *mech, const char *user, const char *pass)
 kick off the auth handshake More...
 

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 78 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 189 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,
const 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,
sx_plugin_t  p 
)

move the stream to the auth state

Definition at line 487 of file sasl_cyrus.c.

References sx_sasl_creds_st::authzid, sx_sasl_creds_st::realm, _sx_st::req_to, _sx_st::ssf, sx_auth(), _sx_st::type, type_CLIENT, 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 749 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 762 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,
const char *  data,
int  dlen 
)
static

utility: generate a challenge nad

Definition at line 777 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,
const char *  data,
int  dlen 
)
static

utility: generate a response nad

Definition at line 792 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 807 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 820 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 826 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 832 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,
const char *  mech,
const char *  in,
int  inlen 
)
static
static void _sx_sasl_server_process ( sx_t  s,
sx_plugin_t  p,
const 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 1141 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 1239 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 1252 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,
const char *  appname,
const char *  mech,
const char *  user,
const char *  pass 
)

kick off the auth handshake

trigger for client auth

Definition at line 1268 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}
static void _sx_auxprop_lookup(void *glob_context, sasl_server_params_t *sparams, unsigned flags, const char *user, unsigned ulen)
Definition: sasl_cyrus.c:120

Definition at line 185 of file sasl_cyrus.c.

Referenced by sx_auxprop_init().