本文整理汇总了C++中sasl_dispose函数的典型用法代码示例。如果您正苦于以下问题:C++ sasl_dispose函数的具体用法?C++ sasl_dispose怎么用?C++ sasl_dispose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sasl_dispose函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: php_mongo_io_authenticate_gssapi
int php_mongo_io_authenticate_gssapi(mongo_con_manager *manager, mongo_connection *con, mongo_server_options *options, mongo_server_def *server_def, char **error_message)
{
int result;
char *initpayload;
int initpayload_len;
sasl_conn_t *conn;
int32_t conversation_id;
result = sasl_client_new(options->gssapiServiceName, server_def->host, NULL, NULL, NULL, 0, &conn);
if (result != SASL_OK) {
sasl_dispose(&conn);
sasl_client_done();
*error_message = strdup("Could not initialize a client exchange (SASL) to MongoDB");
return 0;
}
conn = php_mongo_saslstart(manager, con, options, server_def, conn, &initpayload, &initpayload_len, &conversation_id, error_message);
if (!conn) {
sasl_dispose(&conn);
sasl_client_done();
/* error message populate by php_mongo_saslstart() */
return 0;
}
php_mongo_saslcontinue(manager, con, options, server_def, conn, initpayload, initpayload_len, conversation_id, error_message);
free(initpayload);
sasl_dispose(&conn);
sasl_client_done();
return 1;
}
示例2: free_conn
static void
free_conn(void)
{
if (server_conn) {
sasl_dispose(&server_conn);
}
if (client_conn) {
sasl_dispose(&client_conn);
}
}
示例3: OnLoginAttempt
virtual EModRet OnLoginAttempt(CSmartPtr<CAuthBase> Auth) {
CString const user(Auth->GetUsername());
CString const pass(Auth->GetPassword());
CUser* pUser(CZNC::Get().FindUser(user));
sasl_conn_t *sasl_conn(0);
if (!pUser) { // @todo Will want to do some sort of && !m_bAllowCreate in the future
Auth->RefuseLogin("Invalid User - Halting SASL Authentication");
return HALT;
}
CString const key(CString(user + ":" + pass).MD5());
if (m_Cache.HasItem(key)) {
Auth->AcceptLogin(*pUser);
DEBUG("+++ Found in cache");
}
else if (sasl_server_new("znc", NULL, NULL, NULL, NULL, cbs, 0, &sasl_conn) == SASL_OK &&
sasl_checkpass(sasl_conn, user.c_str(), user.size(), pass.c_str(), pass.size()) == SASL_OK) {
Auth->AcceptLogin(*pUser);
m_Cache.AddItem(key);
DEBUG("+++ Successful SASL password check");
}
else {
Auth->RefuseLogin("SASL Authentication failed");
DEBUG("--- FAILED SASL password check");
}
sasl_dispose(&sasl_conn);
return HALT;
}
示例4: reds_stream_free
void reds_stream_free(RedsStream *s)
{
if (!s) {
return;
}
reds_stream_push_channel_event(s, SPICE_CHANNEL_EVENT_DISCONNECTED);
#if HAVE_SASL
if (s->priv->sasl.conn) {
s->priv->sasl.runSSF = s->priv->sasl.wantSSF = 0;
s->priv->sasl.len = 0;
s->priv->sasl.encodedLength = s->priv->sasl.encodedOffset = 0;
s->priv->sasl.encoded = NULL;
free(s->priv->sasl.mechlist);
free(s->priv->sasl.mechname);
s->priv->sasl.mechlist = NULL;
sasl_dispose(&s->priv->sasl.conn);
s->priv->sasl.conn = NULL;
}
#endif
if (s->priv->ssl) {
SSL_free(s->priv->ssl);
}
reds_stream_remove_watch(s);
spice_debug("close socket fd %d", s->socket);
close(s->socket);
free(s);
}
示例5: rd_kafka_transport_close
/**
* Close and destroy a transport handle
*/
void rd_kafka_transport_close (rd_kafka_transport_t *rktrans) {
#if WITH_SSL
if (rktrans->rktrans_ssl) {
SSL_shutdown(rktrans->rktrans_ssl);
SSL_free(rktrans->rktrans_ssl);
}
#endif
#if WITH_SASL
if (rktrans->rktrans_sasl.conn)
sasl_dispose(&rktrans->rktrans_sasl.conn);
#endif
if (rktrans->rktrans_recv_buf)
rd_kafka_buf_destroy(rktrans->rktrans_recv_buf);
if (rktrans->rktrans_s != -1) {
#ifndef _MSC_VER
close(rktrans->rktrans_s);
#else
closesocket(rktrans->rktrans_s);
#endif
}
rd_free(rktrans);
}
示例6: VmDirSASLSessionClose
/*
* Free SASL related resources.
*/
VOID
VmDirSASLSessionClose(
PVDIR_SASL_BIND_INFO pSaslBindInfo
)
{
if (pSaslBindInfo)
{
if (pSaslBindInfo->pSaslCtx)
{
if (pSaslBindInfo->saslSSF > 0)
{
VmDirSASLSockbufRemove(pSaslBindInfo->pSockbuf);
}
sasl_dispose(&pSaslBindInfo->pSaslCtx);
pSaslBindInfo->pSaslCtx = NULL;
}
VMDIR_SAFE_FREE_MEMORY(pSaslBindInfo->pSessionCB);
VMDIR_SAFE_FREE_MEMORY(pSaslBindInfo->pszBindUserName);
VmDirFreeBervalContent(&pSaslBindInfo->bvMechnism);
}
return;
}
示例7: backend_disconnect
void backend_disconnect(struct backend *s)
{
char buf[1024];
if (!s || s->sock == -1) return;
if (!prot_error(s->in)) {
if (s->prot->logout_cmd.cmd) {
prot_printf(s->out, "%s\r\n", s->prot->logout_cmd.cmd);
prot_flush(s->out);
for (;;) {
if (!prot_fgets(buf, sizeof(buf), s->in)) {
/* connection closed? */
break;
} else if (s->prot->logout_cmd.unsol &&
!strncmp(s->prot->logout_cmd.unsol, buf,
strlen(s->prot->logout_cmd.unsol))) {
/* unsolicited response */
continue;
} else {
/* success/fail response -- don't care either way */
break;
}
}
}
}
/* Flush the incoming buffer */
prot_NONBLOCK(s->in);
prot_fill(s->in);
#ifdef HAVE_SSL
/* Free tlsconn */
if (s->tlsconn) {
tls_reset_servertls(&s->tlsconn);
s->tlsconn = NULL;
}
#endif /* HAVE_SSL */
/* close/free socket & prot layer */
cyrus_close_sock(s->sock);
s->sock = -1;
prot_free(s->in);
prot_free(s->out);
s->in = s->out = NULL;
/* Free saslconn */
if(s->saslconn) {
sasl_dispose(&(s->saslconn));
s->saslconn = NULL;
}
/* free last_result buffer */
buf_free(&s->last_result);
forget_capabilities(s);
}
示例8: virNetSASLSessionDispose
void virNetSASLSessionDispose(void *obj)
{
virNetSASLSessionPtr sasl = obj;
if (sasl->conn)
sasl_dispose(&sasl->conn);
}
示例9: virNetSASLSessionDispose
void virNetSASLSessionDispose(void *obj)
{
virNetSASLSessionPtr sasl = obj;
if (sasl->conn)
sasl_dispose(&sasl->conn);
VIR_FREE(sasl->callbacks);
}
示例10: jabber_cyrus_handle_failure
static JabberSaslState
jabber_cyrus_handle_failure(JabberStream *js, xmlnode *packet,
xmlnode **reply, char **error)
{
if (js->auth_fail_count++ < 5) {
if (js->current_mech && *js->current_mech) {
char *pos;
if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) {
g_string_erase(js->sasl_mechs, pos-js->sasl_mechs->str, strlen(js->current_mech));
}
/* Remove space which separated this mech from the next */
if ((js->sasl_mechs->str)[0] == ' ') {
g_string_erase(js->sasl_mechs, 0, 1);
}
}
if (*js->sasl_mechs->str) {
/* If we have remaining mechs to try, do so */
sasl_dispose(&js->sasl);
return jabber_auth_start_cyrus(js, reply, error);
} else if ((js->auth_fail_count == 1) &&
(js->current_mech && g_str_equal(js->current_mech, "GSSAPI"))) {
/* If we tried GSSAPI first, it failed, and it was the only method we had to try, try jabber:iq:auth
* for compatibility with iChat 10.5 Server and other jabberd based servers.
*
* iChat Server 10.5 and certain other corporate servers offer SASL GSSAPI by default, which is often
* not configured on the client side, and expects a fallback to jabber:iq:auth when it (predictably) fails.
*
* Note: xep-0078 points out that using jabber:iq:auth after a sasl failure is wrong. However,
* I believe this refers to actual authentication failure, not a simple lack of concordant mechanisms.
* Doing otherwise means that simply compiling with SASL support renders the client unable to connect to servers
* which would connect without issue otherwise. -evands
*/
sasl_dispose(&js->sasl);
js->sasl = NULL;
js->auth_mech = NULL;
jabber_auth_start_old(js);
return JABBER_SASL_STATE_CONTINUE;
}
}
/* Nothing to send */
return JABBER_SASL_STATE_FAIL;
}
示例11: virNetSASLSessionDispose
void virNetSASLSessionDispose(void *obj)
{
virNetSASLSessionPtr sasl = obj;
if (sasl->conn)
sasl_dispose(&sasl->conn);
virMutexDestroy(&sasl->lock);
}
示例12: pni_sasl_impl_free
void pni_sasl_impl_free(pn_transport_t *transport)
{
sasl_conn_t *cyrus_conn = (sasl_conn_t*)transport->sasl->impl_context;
sasl_dispose(&cyrus_conn);
transport->sasl->impl_context = cyrus_conn;
if (transport->sasl->client) {
sasl_client_done();
} else {
sasl_server_done();
}
}
示例13: free
void Pop3SaslWrapper::SaslDispose()
{
if(secret)
{
free(secret);
secret = NULL;
}
sasl_dispose(&conn);
sasl_done();
}
示例14: sieve_dispose
/* we need this separate from the free() call so that we can reuse
* the same memory for referrals */
static void sieve_dispose(isieve_t *obj)
{
if(!obj) return;
sasl_dispose(&obj->conn);
free(obj->serverFQDN);
free(obj->refer_authinfo);
free(obj->refer_callbacks);
prot_free(obj->pin);
prot_free(obj->pout);
}
示例15: xsasl_cyrus_server_free
static void xsasl_cyrus_server_free(XSASL_SERVER *xp)
{
XSASL_CYRUS_SERVER *server = (XSASL_CYRUS_SERVER *) xp;
sasl_dispose(&server->sasl_conn);
vstring_free(server->decoded);
if (server->username)
myfree(server->username);
if (server->mechanism_list)
myfree(server->mechanism_list);
myfree((void *) server);
}