static void infd_xmpp_server_dispose(GObject* object) { InfdXmppServer* xmpp; InfdXmppServerPrivate* priv; xmpp = INFD_XMPP_SERVER(object); priv = INFD_XMPP_SERVER_PRIVATE(xmpp); if(priv->status != INFD_XMPP_SERVER_CLOSED) infd_xml_server_close(INFD_XML_SERVER(xmpp)); infd_xmpp_server_set_tcp(xmpp, NULL); if(priv->sasl_own_context != NULL) { inf_sasl_context_unref(priv->sasl_own_context); priv->sasl_own_context = NULL; } if(priv->sasl_context != NULL) { inf_sasl_context_unref(priv->sasl_context); priv->sasl_context = NULL; } if(priv->tls_creds != NULL) { inf_certificate_credentials_unref(priv->tls_creds); priv->tls_creds = NULL; } G_OBJECT_CLASS(parent_class)->dispose(object); }
static void infd_xmpp_server_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) { InfdXmppServer* xmpp; InfdXmppServerPrivate* priv; xmpp = INFD_XMPP_SERVER(object); priv = INFD_XMPP_SERVER_PRIVATE(xmpp); switch(prop_id) { case PROP_TCP: infd_xmpp_server_set_tcp( xmpp, INFD_TCP_SERVER(g_value_get_object(value)) ); break; case PROP_LOCAL_HOSTNAME: g_free(priv->local_hostname); priv->local_hostname = g_value_dup_string(value); if(priv->local_hostname == NULL) priv->local_hostname = g_strdup(g_get_host_name()); break; case PROP_CREDENTIALS: if(priv->tls_creds != NULL) inf_certificate_credentials_unref(priv->tls_creds); priv->tls_creds = g_value_dup_boxed(value); break; case PROP_SASL_CONTEXT: if(priv->sasl_own_context != NULL) { inf_sasl_context_unref(priv->sasl_own_context); priv->sasl_own_context = NULL; } if(priv->sasl_context != NULL) inf_sasl_context_unref(priv->sasl_context); priv->sasl_context = g_value_dup_boxed(value); infd_xmpp_server_setup_own_sasl_context(xmpp); break; case PROP_SASL_MECHANISMS: g_free(priv->sasl_mechanisms); priv->sasl_mechanisms = g_value_dup_string(value); break; case PROP_SECURITY_POLICY: infd_xmpp_server_set_security_policy(xmpp, g_value_get_enum(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } }
/** * infinoted_startup_free: * @startup: A #InfinotedStartup. * * Frees all ressources allocated by @startup. */ void infinoted_startup_free(InfinotedStartup* startup) { guint i; if(startup->credentials != NULL) inf_certificate_credentials_unref(startup->credentials); if(startup->certificates != NULL) inf_certificate_chain_unref(startup->certificates); if(startup->private_key != NULL) gnutls_x509_privkey_deinit(startup->private_key); if(startup->log != NULL) g_object_unref(startup->log); if(startup->options != NULL) infinoted_options_free(startup->options); if(startup->sasl_context != NULL) inf_sasl_context_unref(startup->sasl_context); g_slice_free(InfinotedStartup, startup); inf_deinit(); }
Gobby::AuthCommands::~AuthCommands() { m_connection_manager.set_sasl_context(NULL, NULL); inf_sasl_context_unref(m_sasl_context); for(RetryMap::iterator iter = m_retries.begin(); iter != m_retries.end(); ++iter) { g_signal_handler_disconnect(iter->first, iter->second.handle); } }
static void infd_xmpp_server_set_tcp(InfdXmppServer* xmpp, InfdTcpServer* tcp) { InfdXmppServerPrivate* priv; InfdTcpServerStatus tcp_status; priv = INFD_XMPP_SERVER_PRIVATE(xmpp); g_object_freeze_notify(G_OBJECT(xmpp)); if(priv->tcp != NULL) { g_object_get(G_OBJECT(priv->tcp), "status", &tcp_status, NULL); /* This will cause a notify that will adjust the XMPP status later */ if(tcp_status != INFD_TCP_SERVER_CLOSED) infd_tcp_server_close(priv->tcp); /* TODO: Make sure there are no connections with sasl_own_context out * there anymore because otherwise the SASL callback might access an * invalid InfdServer pointer once we get finalized. */ #if 0 if(priv->sasl_own_context != NULL) { inf_sasl_context_unref(priv->sasl_own_context); priv->sasl_own_context = NULL; } #endif inf_signal_handlers_disconnect_by_func( G_OBJECT(priv->tcp), G_CALLBACK(infd_xmpp_server_new_connection_cb), xmpp ); inf_signal_handlers_disconnect_by_func( G_OBJECT(priv->tcp), G_CALLBACK(infd_xmpp_server_error_cb), xmpp ); inf_signal_handlers_disconnect_by_func( G_OBJECT(priv->tcp), G_CALLBACK(infd_xmpp_server_notify_status_cb), xmpp ); g_object_unref(G_OBJECT(priv->tcp)); } priv->tcp = tcp; if(tcp != NULL) { g_object_ref(G_OBJECT(tcp)); g_signal_connect( G_OBJECT(tcp), "new-connection", G_CALLBACK(infd_xmpp_server_new_connection_cb), xmpp ); g_signal_connect( G_OBJECT(tcp), "error", G_CALLBACK(infd_xmpp_server_error_cb), xmpp ); g_signal_connect( G_OBJECT(tcp), "notify::status", G_CALLBACK(infd_xmpp_server_notify_status_cb), xmpp ); g_object_get(G_OBJECT(tcp), "status", &tcp_status, NULL); switch(tcp_status) { case INFD_TCP_SERVER_CLOSED: case INFD_TCP_SERVER_BOUND: g_assert(priv->status == INFD_XMPP_SERVER_CLOSED); break; case INFD_TCP_SERVER_OPEN: priv->status = INFD_XMPP_SERVER_OPEN; g_object_notify(G_OBJECT(xmpp), "status"); break; default: g_assert_not_reached(); break; } } infd_xmpp_server_setup_own_sasl_context(xmpp); g_object_thaw_notify(G_OBJECT(xmpp)); }
Gobby::SelfHoster::~SelfHoster() { g_object_unref(m_directory); inf_sasl_context_unref(m_sasl_context); }