static void
multi_client_disconnect_script(struct multi_instance *mi)
{
- if ((mi->context.c2.context_auth == CAS_SUCCEEDED && mi->connection_established_flag)
+ if (mi->context.c2.context_auth == CAS_SUCCEEDED
|| mi->context.c2.context_auth == CAS_PARTIAL)
{
multi_client_disconnect_setenv(mi);
multi_client_disconnect_script(mi);
- if (mi->did_open_context)
- {
- close_context(&mi->context, SIGTERM, CC_GC_FREE);
- }
+ close_context(&mi->context, SIGTERM, CC_GC_FREE);
multi_tcp_instance_specific_free(mi);
generate_prefix(mi);
}
- mi->did_open_context = true;
inherit_context_child(&mi->context, &m->top);
if (IS_SIG(&mi->context))
{
mi->context.c2.context_auth = cc_succeeded_count ? CAS_PARTIAL : CAS_FAILED;
}
- /* set flag so we don't get called again */
- mi->connection_established_flag = true;
-
/* increment number of current authenticated clients */
++m->n_clients;
update_mstat_n_clients(m->n_clients);
{
/* connection is "established" when SSL/TLS key negotiation succeeds
* and (if specified) auth user/pass succeeds */
- if (!mi->connection_established_flag && CONNECTION_ESTABLISHED(&mi->context))
+ if (mi->context.c2.context_auth == CAS_PENDING
+ && CONNECTION_ESTABLISHED(&mi->context))
{
multi_connection_established(m, mi);
}
{
if (auth)
{
- if (!mi->connection_established_flag)
+ if (mi->context.c2.context_auth == CAS_PENDING)
{
set_cc_config(mi, cc_config);
cc_config_owned = false;
{
msg(D_MULTI_LOW, "MULTI: connection rejected: %s, CLI:%s", reason, np(client_reason));
}
- if (mi->connection_established_flag)
+ if (mi->context.c2.context_auth != CAS_PENDING)
{
send_auth_failed(&mi->context, client_reason); /* mid-session reauth failed */
multi_schedule_context_wakeup(m, mi);
struct multi_instance {
struct schedule_entry se; /* this must be the first element of the structure */
struct gc_arena gc;
- bool defined;
bool halt;
int refcount;
int route_count; /* number of routes (including cached routes) owned by this instance */
in_addr_t reporting_addr; /* IP address shown in status listing */
struct in6_addr reporting_addr_ipv6; /* IPv6 address in status listing */
- bool did_open_context;
bool did_real_hash;
bool did_iter;
#ifdef MANAGEMENT_DEF_AUTH
bool did_cid_hash;
struct buffer_list *cc_config;
#endif
- bool connection_established_flag;
bool did_iroutes;
int n_clients_delta; /* added to multi_context.n_clients when instance is closed */