src/ssl_sock.c
static int
smp_fetch_ssl_c_used(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp)
{
	X509 *crt;

	if (!l4 || l4->si[0].conn->xprt != &ssl_sock)
		return 0;

	if (!(l4->si[0].conn->flags & CO_FL_CONNECTED)) {
		smp->flags |= SMP_F_MAY_CHANGE;
		return 0;
	}

	/* SSL_get_peer_certificate returns a ptr on allocated X509 struct */
	crt = SSL_get_peer_certificate(l4->si[0].conn->xprt_ctx);
	if (crt) {
		X509_free(crt);
	}

	smp->type = SMP_T_BOOL;
	smp->data.uint = (crt != NULL);
	return 1;
}
/* integer, returns true if current session use a client certificate */
integer, returns true if current session use a client certificate
integer returns true if current session use a client certificate
static int
smp_fetch_ssl_c_used(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
                        const struct arg *args, struct sample *smp)
{
	X509 *crt;
	if (!l4 || l4->si[0].conn->xprt != &ssl_sock)
		return 0;
	if (!(l4->si[0].conn->flags & CO_FL_CONNECTED)) {
		smp->flags |= SMP_F_MAY_CHANGE;
		return 0;
	}
	crt = SSL_get_peer_certificate(l4->si[0].conn->xprt_ctx);
	if (crt) {
		X509_free(crt);
	}
	smp->type = SMP_T_BOOL;
	smp->data.uint = (crt != NULL);
	return 1;
}
static int smp_fetch_ssl_c_used ( struct proxy * px , struct session * l4 , void * l7 , unsigned int opt , const struct arg * args , struct sample * smp ) { X509 * crt ; if ( ! l4 || l4 -> si [ 0 ] . conn -> xprt != & ssl_sock ) return 0 ; if ( ! ( l4 -> si [ 0 ] . conn -> flags & CO_FL_CONNECTED ) ) { smp -> flags |= SMP_F_MAY_CHANGE ; return 0 ; } crt = SSL_get_peer_certificate ( l4 -> si [ 0 ] . conn -> xprt_ctx ) ; if ( crt ) { X509_free ( crt ) ; } smp -> type = SMP_T_BOOL ; smp -> data . uint = ( crt != NULL ) ; return 1 ; }
integer, returns true if current session use a client certificate
integer returns true if current session use a client certificate
/* SSL_get_peer_certificate returns a ptr on allocated X509 struct */