auth.c File Reference

Authentication function and handlers. More...

## Data Structures

struct | scram_user_data

## Macros

#define | FEATURES_TIMEOUT 15000 /* 15 seconds */
| Time to wait for <stream:features/> stanza.
#define | BIND_TIMEOUT 15000 /* 15 seconds */
| Time to wait for <bind/> stanza reply.
#define | SESSION_TIMEOUT 15000 /* 15 seconds */
| Time to wait for <session/> stanza reply.
#define | LEGACY_TIMEOUT 15000 /* 15 seconds */
| Time to wait for legacy authentication to complete.
#define | HANDSHAKE_TIMEOUT 15000 /* 15 seconds */
| Time to wait for component authentication to complete.

## Typedefs

typedef void(* | text_handler) (xmpp_conn_t *conn, const char *text)

## Functions

static void | _auth (xmpp_conn_t *conn)
static void | _auth_legacy (xmpp_conn_t *conn)
static void | _handle_open_compress (xmpp_conn_t *conn)
static void | _handle_open_sasl (xmpp_conn_t *conn)
static void | _handle_open_tls (xmpp_conn_t *conn)
static int | _handle_component_auth (xmpp_conn_t *conn)
static int | _handle_component_hs_response (xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata)
static int | _handle_features_sasl (xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata)
static int | _handle_features_compress (xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata)
static int | _handle_sasl_result (xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata)
static int | _handle_digestmd5_challenge (xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata)
static int | _handle_digestmd5_rspauth (xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata)
static int | _handle_scram_challenge (xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata)
static int | _make_scram_init_msg (struct scram_user_data *scram)
static int | _handle_missing_features_sasl (xmpp_conn_t *conn, void *userdata)
static int | _handle_missing_bind (xmpp_conn_t *conn, void *userdata)
static int | _handle_bind (xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata)
static int | _handle_session (xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata)
static int | _handle_missing_session (xmpp_conn_t *conn, void *userdata)
static int | _handle_missing_handshake (xmpp_conn_t *conn, void *userdata)
static int | _handle_sm (xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata)
static int | _handle_error (xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata)
static int | _handle_missing_features (xmpp_conn_t *conn, void *userdata)
static void | _foreach_child (xmpp_conn_t *conn, xmpp_stanza_t *parent, const char *name, text_handler hndl)
static void | _handle_sasl_children (xmpp_conn_t *conn, const char *text)
static int | _handle_features (xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata)
static char * | _get_authid (xmpp_conn_t *conn)
static int | _handle_proceedtls_default (xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata)
static xmpp_stanza_t * | _make_starttls (xmpp_conn_t *conn)
static xmpp_stanza_t * | _make_sasl_auth (xmpp_conn_t *conn, const char *mechanism)
static void | _stream_negotiation_success (xmpp_conn_t *conn)
void | auth_handle_open (xmpp_conn_t *conn)
| Set up handlers at stream start.
static int | _do_bind (xmpp_conn_t *conn, xmpp_stanza_t *bind)
static int | _handle_compress_result (xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata)
static void | _session_start (xmpp_conn_t *conn)
static void | _sm_enable (xmpp_conn_t *conn)
static int | _handle_missing_legacy (xmpp_conn_t *conn, void *userdata)
static int | _get_h_attribute (xmpp_stanza_t *stanza, unsigned long *ul_h)
static void | _sm_queue_cleanup (xmpp_conn_t *conn, unsigned long ul_h)
static void | _sm_queue_resend (xmpp_conn_t *conn)
static int | _handle_legacy (xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata)
void | auth_handle_component_open (xmpp_conn_t *conn)
void | auth_handle_open_raw (xmpp_conn_t *conn)
void | auth_handle_open_stub (xmpp_conn_t *conn)

## Detailed Description

Authentication function and handlers.

## Macro Definition Documentation

## FEATURES_TIMEOUT

#define FEATURES_TIMEOUT 15000 /* 15 seconds */

Time to wait for <stream:features/> stanza.

## BIND_TIMEOUT

#define BIND_TIMEOUT 15000 /* 15 seconds */

Time to wait for <bind/> stanza reply.

## SESSION_TIMEOUT

#define SESSION_TIMEOUT 15000 /* 15 seconds */

Time to wait for <session/> stanza reply.

## LEGACY_TIMEOUT

#define LEGACY_TIMEOUT 15000 /* 15 seconds */

Time to wait for legacy authentication to complete.

## HANDSHAKE_TIMEOUT

#define HANDSHAKE_TIMEOUT 15000 /* 15 seconds */

Time to wait for component authentication to complete.

## Typedef Documentation

## text_handler

typedef void(* text_handler) (xmpp_conn_t *conn, const char *text)

## Function Documentation

## _auth()

void _auth | ( | xmpp_conn_t * | conn | ) |

static

## _auth_legacy()

void _auth_legacy | ( | xmpp_conn_t * | conn | ) |

static

## _handle_open_compress()

void _handle_open_compress | ( | xmpp_conn_t * | conn | ) |

static

## _handle_open_sasl()

void _handle_open_sasl | ( | xmpp_conn_t * | conn | ) |

static

## _handle_open_tls()

void _handle_open_tls | ( | xmpp_conn_t * | conn | ) |

static

## _handle_component_auth()

int _handle_component_auth | ( | xmpp_conn_t * | conn | ) |

static

## _handle_component_hs_response()

int _handle_component_hs_response | ( | xmpp_conn_t * | conn,
|  | xmpp_stanza_t * | stanza,
|  | void * | userdata )

static

## _handle_features_sasl()

int _handle_features_sasl | ( | xmpp_conn_t * | conn,
|  | xmpp_stanza_t * | stanza,
|  | void * | userdata )

static

## _handle_features_compress()

int _handle_features_compress | ( | xmpp_conn_t * | conn,
|  | xmpp_stanza_t * | stanza,
|  | void * | userdata )

static

## _handle_sasl_result()

int _handle_sasl_result | ( | xmpp_conn_t * | conn,
|  | xmpp_stanza_t * | stanza,
|  | void * | userdata )

static

## _handle_digestmd5_challenge()

int _handle_digestmd5_challenge | ( | xmpp_conn_t * | conn,
|  | xmpp_stanza_t * | stanza,
|  | void * | userdata )

static

## _handle_digestmd5_rspauth()

int _handle_digestmd5_rspauth | ( | xmpp_conn_t * | conn,
|  | xmpp_stanza_t * | stanza,
|  | void * | userdata )

static

## _handle_scram_challenge()

int _handle_scram_challenge | ( | xmpp_conn_t * | conn,
|  | xmpp_stanza_t * | stanza,
|  | void * | userdata )

static

## _make_scram_init_msg()

int _make_scram_init_msg | ( | struct scram_user_data * | scram | ) |

static

## _handle_missing_features_sasl()

int _handle_missing_features_sasl | ( | xmpp_conn_t * | conn,
|  | void * | userdata )

static

## _handle_missing_bind()

int _handle_missing_bind | ( | xmpp_conn_t * | conn,
|  | void * | userdata )

static

## _handle_bind()

int _handle_bind | ( | xmpp_conn_t * | conn,
|  | xmpp_stanza_t * | stanza,
|  | void * | userdata )

static

## _handle_session()

int _handle_session | ( | xmpp_conn_t * | conn,
|  | xmpp_stanza_t * | stanza,
|  | void * | userdata )

static

## _handle_missing_session()

int _handle_missing_session | ( | xmpp_conn_t * | conn,
|  | void * | userdata )

static

## _handle_missing_handshake()

int _handle_missing_handshake | ( | xmpp_conn_t * | conn,
|  | void * | userdata )

static

## _handle_sm()

int _handle_sm | ( | xmpp_conn_t *const | conn,
|  | xmpp_stanza_t *const | stanza,
|  | void *const | userdata )

static

## _handle_error()

int _handle_error | ( | xmpp_conn_t * | conn,
|  | xmpp_stanza_t * | stanza,
|  | void * | userdata )

static

## _handle_missing_features()

int _handle_missing_features | ( | xmpp_conn_t * | conn,
|  | void * | userdata )

static

## _foreach_child()

void _foreach_child | ( | xmpp_conn_t * | conn,
|  | xmpp_stanza_t * | parent,
|  | const char * | name,
|  | text_handler | hndl )

static

## _handle_sasl_children()

void _handle_sasl_children | ( | xmpp_conn_t * | conn,
|  | const char * | text )

static

## _handle_features()

int _handle_features | ( | xmpp_conn_t * | conn,
|  | xmpp_stanza_t * | stanza,
|  | void * | userdata )

static

## _get_authid()

char * _get_authid | ( | xmpp_conn_t * | conn | ) |

static

## _handle_proceedtls_default()

int _handle_proceedtls_default | ( | xmpp_conn_t * | conn,
|  | xmpp_stanza_t * | stanza,
|  | void * | userdata )

static

## _make_starttls()

xmpp_stanza_t * _make_starttls | ( | xmpp_conn_t * | conn | ) |

static

## _make_sasl_auth()

xmpp_stanza_t * _make_sasl_auth | ( | xmpp_conn_t * | conn,
|  | const char * | mechanism )

static

## _stream_negotiation_success()

void _stream_negotiation_success | ( | xmpp_conn_t * | conn | ) |

static

## auth_handle_open()

void auth_handle_open | ( | xmpp_conn_t * | conn | ) |

Set up handlers at stream start.

This function is called internally to Strophe for handling the opening of an XMPP stream. It's called by the parser when a stream is opened or reset, and adds the initial handlers for <stream:error/> and <stream:features/>. This function is not intended for use outside of Strophe.

Parameters

  conn | a Strophe connection object

## _do_bind()

int _do_bind | ( | xmpp_conn_t * | conn,
|  | xmpp_stanza_t * | bind )

static

## _handle_compress_result()

int _handle_compress_result | ( | xmpp_conn_t *const | conn,
|  | xmpp_stanza_t *const | stanza,
|  | void *const | userdata )

static

## _session_start()

void _session_start | ( | xmpp_conn_t * | conn | ) |

static

## _sm_enable()

void _sm_enable | ( | xmpp_conn_t * | conn | ) |

static

## _handle_missing_legacy()

int _handle_missing_legacy | ( | xmpp_conn_t * | conn,
|  | void * | userdata )

static

## _get_h_attribute()

int _get_h_attribute | ( | xmpp_stanza_t * | stanza,
|  | unsigned long * | ul_h )

static

## _sm_queue_cleanup()

void _sm_queue_cleanup | ( | xmpp_conn_t * | conn,
|  | unsigned long | ul_h )

static

## _sm_queue_resend()

void _sm_queue_resend | ( | xmpp_conn_t * | conn | ) |

static

## _handle_legacy()

int _handle_legacy | ( | xmpp_conn_t * | conn,
|  | xmpp_stanza_t * | stanza,
|  | void * | userdata )

static

## auth_handle_component_open()

void auth_handle_component_open | ( | xmpp_conn_t * | conn | ) |

## auth_handle_open_raw()

void auth_handle_open_raw | ( | xmpp_conn_t * | conn | ) |

## auth_handle_open_stub()

void auth_handle_open_stub | ( | xmpp_conn_t * | conn | ) |