jabberd2
2.2.16
|
XEP-0016 Privacy Lists and XEP-0191 Simple Comunications Blocking. More...
#include "sm.h"
Go to the source code of this file.
Data Structures | |
struct | zebra_st |
zebra data for a single user More... | |
struct | zebra_list_st |
struct | zebra_item_st |
struct | privacy_st |
union | xhashv |
session packet handling More... | |
Typedefs | |
typedef struct zebra_st * | zebra_t |
typedef struct zebra_list_st * | zebra_list_t |
typedef struct zebra_item_st * | zebra_item_t |
typedef struct privacy_st * | privacy_t |
Enumerations | |
enum | zebra_item_type_t { zebra_NONE, zebra_JID, zebra_GROUP, zebra_S10N } |
enum | zebra_block_type_t { block_NONE = 0x00, block_MESSAGE = 0x01, block_PRES_IN = 0x02, block_PRES_OUT = 0x04, block_IQ = 0x08 } |
Functions | |
static void | _privacy_free_z (zebra_t z) |
static void | _privacy_user_free (zebra_t *z) |
static int | _privacy_user_load (mod_instance_t mi, user_t user) |
static int | _privacy_action (user_t user, zebra_list_t zlist, jid_t jid, pkt_type_t ptype, int in) |
returns 0 if the packet should be allowed, otherwise 1 | |
static mod_ret_t | _privacy_in_router (mod_instance_t mi, pkt_t pkt) |
check incoming packets | |
static mod_ret_t | _privacy_out_router (mod_instance_t mi, pkt_t pkt) |
check outgoing packets | |
static void | _privacy_result_builder (xht zhash, const char *name, void *val, void *arg) |
add a list to the return packet | |
static void | _privacy_lists_result_builder (const char *name, int namelen, void *val, void *arg) |
add a list to the return packet | |
static void | _unblock_jid (user_t user, storage_t st, zebra_list_t zlist, jid_t jid) |
remove jid deny ocurrences from the privacy list, unblock all if no jid given to match, then update unblocked contact with presence information | |
static mod_ret_t | _privacy_in_sess (mod_instance_t mi, sess_t sess, pkt_t pkt) |
list management requests | |
static void | _privacy_user_delete (mod_instance_t mi, jid_t jid) |
static void | _privacy_free (module_t mod) |
DLLEXPORT int | module_init (mod_instance_t mi, char *arg) |
Variables | |
static int | ns_PRIVACY = 0 |
static int | ns_BLOCKING = 0 |
XEP-0016 Privacy Lists and XEP-0191 Simple Comunications Blocking.
Definition in file mod_privacy.c.
Definition at line 33 of file mod_privacy.c.
typedef struct zebra_list_st* zebra_list_t |
Definition at line 34 of file mod_privacy.c.
typedef struct zebra_item_st* zebra_item_t |
Definition at line 35 of file mod_privacy.c.
typedef struct privacy_st * privacy_t |
enum zebra_item_type_t |
Definition at line 37 of file mod_privacy.c.
enum zebra_block_type_t |
Definition at line 44 of file mod_privacy.c.
static void _privacy_free_z | ( | zebra_t | z | ) | [static] |
Definition at line 101 of file mod_privacy.c.
References log_debug, ZONE, xhash_iter_first(), zebra_st::lists, xhashv::z_val, xhash_iter_get(), xhashv::val, pool_free(), zebra_list_st::p, xhash_iter_next(), and xhash_free().
Referenced by _privacy_user_free(), and _privacy_user_load().
static void _privacy_user_free | ( | zebra_t * | z | ) | [static] |
Definition at line 118 of file mod_privacy.c.
References _privacy_free_z().
Referenced by _privacy_user_load().
static int _privacy_user_load | ( | mod_instance_t | mi, |
user_t | user | ||
) | [static] |
Definition at line 123 of file mod_privacy.c.
References mod_instance_st::mod, log_debug, ZONE, jid_user(), user_st::jid, user_st::module_data, module_st::index, _privacy_free_z(), zebra_st::lists, xhash_new(), pool_cleanup(), user_st::p, _privacy_user_free(), user_st::sm, sm_st::st, xhash_get(), pool_new, pmalloco(), zebra_list_st::p, zebra_list_st::name, pstrdup(), xhash_put(), zebra_item_st::type, zebra_JID, zebra_GROUP, zebra_S10N, zebra_NONE, zebra_item_st::jid, jid_new(), jid_free(), jid_full(), zebra_item_st::group, zebra_item_st::to, zebra_item_st::from, zebra_item_st::deny, zebra_item_st::order, zebra_item_st::block, zebra_list_st::items, zebra_item_st::next, zebra_list_st::last, zebra_item_st::prev, and zebra_st::def.
Referenced by module_init().
static int _privacy_action | ( | user_t | user, |
zebra_list_t | zlist, | ||
jid_t | jid, | ||
pkt_type_t | ptype, | ||
int | in | ||
) | [static] |
returns 0 if the packet should be allowed, otherwise 1
Definition at line 319 of file mod_privacy.c.
References log_debug, ZONE, zebra_list_st::name, jid_full(), zebra_list_st::items, zebra_item_st::next, zebra_item_st::type, zebra_NONE, zebra_JID, jid_st::domain, jid_st::resource, jid_compare_full(), zebra_item_st::jid, jid_user(), zebra_GROUP, xhash_get(), user_st::roster, item_st::ngroups, zebra_item_st::group, item_st::groups, zebra_S10N, zebra_item_st::to, item_st::to, zebra_item_st::from, item_st::from, zebra_item_st::block, block_NONE, zebra_item_st::deny, pkt_MESSAGE, block_MESSAGE, pkt_PRESENCE, block_PRES_IN, pkt_IQ, block_IQ, block_PRES_OUT, and pkt_PRESENCE_PROBE.
Referenced by _privacy_in_router(), and _privacy_out_router().
static mod_ret_t _privacy_in_router | ( | mod_instance_t | mi, |
pkt_t | pkt | ||
) | [static] |
check incoming packets
Definition at line 405 of file mod_privacy.c.
References mod_instance_st::mod, pkt_st::to, jid_st::node, mod_PASS, user_load(), module_st::mm, mm_st::sm, log_debug, ZONE, jid_user(), user_st::module_data, module_st::index, jid_st::resource, sess_match(), user_st::top, sess_st::module_data, zebra_st::def, _privacy_action(), pkt_st::from, pkt_st::type, pkt_IQ, pkt_IQ_SET, stanza_err_FEATURE_NOT_IMPLEMENTED, pkt_free(), and mod_HANDLED.
Referenced by module_init().
static mod_ret_t _privacy_out_router | ( | mod_instance_t | mi, |
pkt_t | pkt | ||
) | [static] |
check outgoing packets
Definition at line 463 of file mod_privacy.c.
References mod_instance_st::mod, pkt_st::from, jid_st::node, mod_PASS, user_load(), module_st::mm, mm_st::sm, log_debug, ZONE, jid_user(), pkt_st::to, user_st::module_data, module_st::index, jid_st::resource, sess_match(), sess_st::module_data, zebra_st::def, _privacy_action(), pkt_st::type, pkt_MESSAGE, pkt_error(), stanza_err_NOT_ACCEPTABLE, nad_find_elem(), pkt_st::nad, nad_add_namespace(), urn_BLOCKING_ERR, nad_insert_elem(), pkt_sess(), mod_HANDLED, and pkt_free().
Referenced by module_init().
static void _privacy_result_builder | ( | xht | zhash, |
const char * | name, | ||
void * | val, | ||
void * | arg | ||
) | [static] |
add a list to the return packet
Definition at line 525 of file mod_privacy.c.
References nad_find_scoped_namespace(), pkt_st::nad, uri_PRIVACY, nad_find_elem(), nad_insert_elem(), nad_set_attr(), zebra_list_st::name, zebra_list_st::items, zebra_item_st::next, zebra_item_st::type, zebra_JID, jid_full(), zebra_item_st::jid, zebra_GROUP, zebra_item_st::group, zebra_S10N, zebra_item_st::to, zebra_item_st::from, zebra_NONE, zebra_item_st::deny, zebra_item_st::order, zebra_item_st::block, block_MESSAGE, block_PRES_IN, block_PRES_OUT, and block_IQ.
Referenced by _privacy_in_sess().
static void _privacy_lists_result_builder | ( | const char * | name, |
int | namelen, | ||
void * | val, | ||
void * | arg | ||
) | [static] |
add a list to the return packet
Definition at line 593 of file mod_privacy.c.
References nad_find_scoped_namespace(), pkt_st::nad, uri_PRIVACY, nad_find_elem(), nad_insert_elem(), nad_set_attr(), and zebra_list_st::name.
Referenced by _privacy_in_sess().
static void _unblock_jid | ( | user_t | user, |
storage_t | st, | ||
zebra_list_t | zlist, | ||
jid_t | jid | ||
) | [static] |
remove jid deny ocurrences from the privacy list, unblock all if no jid given to match, then update unblocked contact with presence information
Definition at line 608 of file mod_privacy.c.
References zebra_list_st::items, zebra_item_st::next, zebra_item_st::type, zebra_JID, zebra_item_st::deny, jid_compare_full(), zebra_item_st::jid, zebra_item_st::prev, zebra_list_st::last, urn_BLOCKING, jid_full(), jid_user(), user_st::jid, pres_trust(), user_st::sessions, sess_st::next, sess_st::available, jid_search(), sess_st::A, sess_st::E, log_debug, ZONE, sess_st::jid, pkt_router(), pkt_dup(), and sess_st::pres.
Referenced by _privacy_in_sess().
static mod_ret_t _privacy_in_sess | ( | mod_instance_t | mi, |
sess_t | sess, | ||
pkt_t | pkt | ||
) | [static] |
list management requests
Definition at line 658 of file mod_privacy.c.
References mod_instance_st::mod, pkt_st::type, pkt_IQ, pkt_IQ_SET, pkt_st::ns, ns_PRIVACY, ns_BLOCKING, mod_PASS, pkt_st::to, stanza_err_BAD_REQUEST, sess_st::user, user_st::module_data, module_st::index, sess_st::module_data, pmalloco(), sess_st::p, nad_find_scoped_namespace(), pkt_st::nad, urn_BLOCKING, nad_find_elem(), zebra_st::def, xhash_get(), zebra_st::lists, pool_free(), zebra_list_st::p, module_st::mm, mm_st::sm, sm_st::st, jid_user(), user_st::jid, pool_new, zebra_list_st::name, pstrdup(), xhash_put(), stanza_err_INTERNAL_SERVER_ERROR, log_debug, ZONE, jid_full(), sess_st::jid, _unblock_jid(), nad_find_attr(), jid_new(), NAD_AVAL, NAD_AVAL_L, zebra_list_st::items, zebra_item_st::next, zebra_item_st::type, zebra_JID, jid_compare_full(), zebra_item_st::jid, zebra_item_st::deny, zebra_item_st::block, block_NONE, pres_trust(), user_st::sessions, sess_st::next, sess_st::available, jid_search(), sess_st::A, sess_st::E, pkt_router(), pkt_create(), user_st::sm, pool_cleanup(), jid_free(), zebra_item_st::order, zebra_list_st::last, zebra_item_st::prev, stanza_err_ITEM_NOT_FOUND, pkt_st::sm, pkt_id(), pkt_sess(), pkt_dup(), pkt_st::from, nad_set_attr(), pkt_id_new(), pkt_free(), mod_HANDLED, nad_add_namespace(), nad_insert_elem(), uri_PRIVACY, zebra_GROUP, zebra_item_st::group, pstrdupx(), zebra_S10N, zebra_item_st::to, zebra_item_st::from, block_MESSAGE, block_PRES_IN, block_PRES_OUT, block_IQ, xhash_zap(), xhash_getx(), _privacy_result_builder(), xhash_walk(), and _privacy_lists_result_builder().
Referenced by module_init().
static void _privacy_user_delete | ( | mod_instance_t | mi, |
jid_t | jid | ||
) | [static] |
Definition at line 1311 of file mod_privacy.c.
References log_debug, ZONE, jid_user(), mod_instance_st::sm, and sm_st::st.
Referenced by module_init().
static void _privacy_free | ( | module_t | mod | ) | [static] |
Definition at line 1318 of file mod_privacy.c.
References sm_unregister_ns(), module_st::mm, mm_st::sm, uri_PRIVACY, and feature_unregister().
Referenced by module_init().
DLLEXPORT int module_init | ( | mod_instance_t | mi, |
char * | arg | ||
) |
Definition at line 1323 of file mod_privacy.c.
References mod_instance_st::mod, module_st::init, module_st::user_load, _privacy_user_load(), module_st::in_router, _privacy_in_router(), module_st::out_router, _privacy_out_router(), module_st::in_sess, _privacy_in_sess(), module_st::user_delete, _privacy_user_delete(), module_st::free, _privacy_free(), ns_PRIVACY, sm_register_ns(), module_st::mm, mm_st::sm, uri_PRIVACY, feature_register(), ns_BLOCKING, and urn_BLOCKING.
int ns_PRIVACY = 0 [static] |
Definition at line 30 of file mod_privacy.c.
Referenced by _privacy_in_sess(), and module_init().
int ns_BLOCKING = 0 [static] |
Definition at line 31 of file mod_privacy.c.
Referenced by _privacy_in_sess(), and module_init().