jabberd2
2.3.1
|
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 More... | |
static mod_ret_t | _privacy_in_router (mod_instance_t mi, pkt_t pkt) |
check incoming packets More... | |
static mod_ret_t | _privacy_out_router (mod_instance_t mi, pkt_t pkt) |
check outgoing packets More... | |
static void | _privacy_result_builder (xht zhash, const char *name, void *val, void *arg) |
add a list to the return packet More... | |
static void | _privacy_lists_result_builder (const char *name, int namelen, void *val, void *arg) |
add a list to the return packet More... | |
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 More... | |
static mod_ret_t | _privacy_in_sess (mod_instance_t mi, sess_t sess, pkt_t pkt) |
list management requests More... | |
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, const 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 |
Enumerator | |
---|---|
zebra_NONE | |
zebra_JID | |
zebra_GROUP | |
zebra_S10N |
Definition at line 37 of file mod_privacy.c.
enum zebra_block_type_t |
Enumerator | |
---|---|
block_NONE | |
block_MESSAGE | |
block_PRES_IN | |
block_PRES_OUT | |
block_IQ |
Definition at line 44 of file mod_privacy.c.
|
static |
Definition at line 101 of file mod_privacy.c.
References zebra_st::lists, log_debug, zebra_list_st::p, pool_free(), xhashv::val, xhash_free(), xhash_iter_first(), xhash_iter_get(), xhash_iter_next(), xhashv::z_val, and ZONE.
Referenced by _privacy_user_free(), and _privacy_user_load().
|
static |
Definition at line 118 of file mod_privacy.c.
References _privacy_free_z().
Referenced by _privacy_user_load().
|
static |
Definition at line 123 of file mod_privacy.c.
References _privacy_free_z(), _privacy_user_free(), zebra_item_st::block, zebra_st::def, zebra_item_st::deny, zebra_item_st::from, zebra_item_st::group, module_st::index, zebra_list_st::items, zebra_item_st::jid, user_st::jid, jid_free(), jid_full(), jid_new(), jid_user(), zebra_list_st::last, zebra_st::lists, log_debug, mod_instance_st::mod, user_st::module_data, zebra_list_st::name, zebra_item_st::next, zebra_item_st::order, zebra_list_st::p, user_st::p, pmalloco(), pool_cleanup(), pool_new, zebra_item_st::prev, pstrdup(), user_st::sm, sm_st::st, zebra_item_st::to, zebra_item_st::type, xhash_get(), xhash_new(), xhash_put(), zebra_GROUP, zebra_JID, zebra_NONE, zebra_S10N, and ZONE.
Referenced by module_init().
|
static |
returns 0 if the packet should be allowed, otherwise 1
Definition at line 319 of file mod_privacy.c.
References zebra_item_st::block, block_IQ, block_MESSAGE, block_NONE, block_PRES_IN, block_PRES_OUT, zebra_item_st::deny, jid_st::domain, zebra_item_st::from, item_st::from, zebra_item_st::group, item_st::groups, zebra_list_st::items, zebra_item_st::jid, jid_compare_full(), jid_full(), jid_user(), log_debug, zebra_list_st::name, zebra_item_st::next, item_st::ngroups, pkt_IQ, pkt_MESSAGE, pkt_PRESENCE, pkt_PRESENCE_PROBE, jid_st::resource, user_st::roster, zebra_item_st::to, item_st::to, zebra_item_st::type, xhash_get(), zebra_GROUP, zebra_JID, zebra_NONE, zebra_S10N, and ZONE.
Referenced by _privacy_in_router(), and _privacy_out_router().
|
static |
check incoming packets
Definition at line 405 of file mod_privacy.c.
References _privacy_action(), zebra_st::def, pkt_st::from, module_st::index, jid_user(), log_debug, module_st::mm, mod_instance_st::mod, mod_HANDLED, mod_PASS, user_st::module_data, sess_st::module_data, jid_st::node, pkt_free(), pkt_IQ, pkt_IQ_SET, jid_st::resource, sess_match(), mm_st::sm, stanza_err_FEATURE_NOT_IMPLEMENTED, pkt_st::to, user_st::top, pkt_st::type, user_load(), and ZONE.
Referenced by module_init().
|
static |
check outgoing packets
Definition at line 463 of file mod_privacy.c.
References _privacy_action(), zebra_st::def, pkt_st::from, module_st::index, jid_user(), log_debug, module_st::mm, mod_instance_st::mod, mod_HANDLED, mod_PASS, user_st::module_data, sess_st::module_data, pkt_st::nad, nad_add_namespace(), nad_find_elem(), nad_insert_elem(), jid_st::node, pkt_error(), pkt_free(), pkt_MESSAGE, pkt_sess(), jid_st::resource, sess_match(), mm_st::sm, stanza_err_NOT_ACCEPTABLE, pkt_st::to, pkt_st::type, urn_BLOCKING_ERR, user_load(), and ZONE.
Referenced by module_init().
|
static |
add a list to the return packet
Definition at line 525 of file mod_privacy.c.
References zebra_item_st::block, block_IQ, block_MESSAGE, block_PRES_IN, block_PRES_OUT, zebra_item_st::deny, zebra_item_st::from, zebra_item_st::group, zebra_list_st::items, zebra_item_st::jid, jid_full(), pkt_st::nad, nad_find_elem(), nad_find_scoped_namespace(), nad_insert_elem(), nad_set_attr(), zebra_list_st::name, zebra_item_st::next, zebra_item_st::order, zebra_item_st::to, zebra_item_st::type, uri_PRIVACY, zebra_GROUP, zebra_JID, zebra_NONE, and zebra_S10N.
Referenced by _privacy_in_sess().
|
static |
add a list to the return packet
Definition at line 593 of file mod_privacy.c.
References pkt_st::nad, nad_find_elem(), nad_find_scoped_namespace(), nad_insert_elem(), nad_set_attr(), zebra_list_st::name, and uri_PRIVACY.
Referenced by _privacy_in_sess().
|
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 sess_st::A, sess_st::available, zebra_item_st::deny, sess_st::E, zebra_list_st::items, zebra_item_st::jid, user_st::jid, sess_st::jid, jid_compare_full(), jid_full(), jid_search(), jid_user(), zebra_list_st::last, log_debug, zebra_item_st::next, sess_st::next, pkt_dup(), pkt_router(), sess_st::pres, pres_trust(), zebra_item_st::prev, user_st::sessions, zebra_item_st::type, urn_BLOCKING, zebra_JID, and ZONE.
Referenced by _privacy_in_sess().
|
static |
list management requests
Definition at line 658 of file mod_privacy.c.
References _privacy_lists_result_builder(), _privacy_result_builder(), _unblock_jid(), sess_st::A, sess_st::available, zebra_item_st::block, block_IQ, block_MESSAGE, block_NONE, block_PRES_IN, block_PRES_OUT, zebra_st::def, zebra_item_st::deny, sess_st::E, zebra_item_st::from, pkt_st::from, zebra_item_st::group, module_st::index, zebra_list_st::items, zebra_item_st::jid, user_st::jid, sess_st::jid, jid_compare_full(), jid_free(), jid_full(), jid_new(), jid_search(), jid_user(), zebra_list_st::last, zebra_st::lists, log_debug, module_st::mm, mod_instance_st::mod, mod_HANDLED, mod_PASS, user_st::module_data, sess_st::module_data, pkt_st::nad, nad_add_namespace(), NAD_AVAL, NAD_AVAL_L, nad_find_attr(), nad_find_elem(), nad_find_scoped_namespace(), nad_insert_elem(), nad_set_attr(), zebra_list_st::name, zebra_item_st::next, sess_st::next, pkt_st::ns, ns_BLOCKING, ns_PRIVACY, zebra_item_st::order, zebra_list_st::p, sess_st::p, pkt_create(), pkt_dup(), pkt_free(), pkt_id(), pkt_id_new(), pkt_IQ, pkt_IQ_SET, pkt_router(), pkt_sess(), pmalloco(), pool_cleanup(), pool_free(), pool_new, pres_trust(), zebra_item_st::prev, pstrdup(), pstrdupx(), user_st::sessions, pkt_st::sm, user_st::sm, mm_st::sm, sm_st::st, stanza_err_BAD_REQUEST, stanza_err_INTERNAL_SERVER_ERROR, stanza_err_ITEM_NOT_FOUND, zebra_item_st::to, pkt_st::to, zebra_item_st::type, pkt_st::type, uri_PRIVACY, urn_BLOCKING, sess_st::user, xhash_get(), xhash_getx(), xhash_put(), xhash_walk(), xhash_zap(), zebra_GROUP, zebra_JID, zebra_S10N, and ZONE.
Referenced by module_init().
|
static |
Definition at line 1311 of file mod_privacy.c.
References jid_user(), log_debug, mod_instance_st::sm, sm_st::st, and ZONE.
Referenced by module_init().
|
static |
Definition at line 1318 of file mod_privacy.c.
References feature_unregister(), module_st::mm, mm_st::sm, sm_unregister_ns(), and uri_PRIVACY.
Referenced by module_init().
DLLEXPORT int module_init | ( | mod_instance_t | mi, |
const char * | arg | ||
) |
Definition at line 1323 of file mod_privacy.c.
References _privacy_free(), _privacy_in_router(), _privacy_in_sess(), _privacy_out_router(), _privacy_user_delete(), _privacy_user_load(), feature_register(), module_st::free, module_st::in_router, module_st::in_sess, module_st::init, module_st::mm, mod_instance_st::mod, ns_BLOCKING, ns_PRIVACY, module_st::out_router, mm_st::sm, sm_register_ns(), uri_PRIVACY, urn_BLOCKING, module_st::user_delete, and module_st::user_load.
|
static |
Definition at line 30 of file mod_privacy.c.
Referenced by _privacy_in_sess(), and module_init().
|
static |
Definition at line 31 of file mod_privacy.c.
Referenced by _privacy_in_sess(), and module_init().