예제 #1
0
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
0
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();
    }
}
예제 #3
0
void
_mongoc_sasl_destroy (mongoc_sasl_t *sasl)
{
   BSON_ASSERT (sasl);

   if (sasl->conn) {
      sasl_dispose (&sasl->conn);
   }

   free (sasl->user);
   free (sasl->pass);
   free (sasl->mechanism);
   free (sasl->service_name);
   free (sasl->service_host);

   sasl_client_done ();
}
예제 #4
0
static MONGOC_ONCE_FUN( _mongoc_do_cleanup)
{
#ifdef MONGOC_ENABLE_SSL
   _mongoc_ssl_cleanup();
#endif

#ifdef MONGOC_ENABLE_SASL
#ifdef MONGOC_HAVE_SASL_CLIENT_DONE
   sasl_client_done ();
#else
   /* fall back to deprecated function */
   sasl_done ();
#endif
#endif

#ifdef _WIN32
   WSACleanup ();
#endif

   MONGOC_ONCE_RETURN;
}