diff --git a/src/context.c b/src/context.c index 275faaca..b6b07e66 100644 --- a/src/context.c +++ b/src/context.c @@ -717,12 +717,12 @@ _getdns_upstream_shutdown(getdns_upstream *upstream) STUB_DEBUG_DAEMON, upstream->addr_str, (upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP"), (int)upstream->responses_received, (int)upstream->responses_timeouts, - getdns_auth_str_array[upstream->tls_auth_state], (int)upstream->keepalive_timeout); + _getdns_auth_str(upstream->tls_auth_state), (int)upstream->keepalive_timeout); DEBUG_DAEMON("%s %s : Upstream stats: Transport=%s - Resp=%d,Timeouts=%d,Best_auth=%s\n", STUB_DEBUG_DAEMON, upstream->addr_str, (upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP"), (int)upstream->total_responses, (int)upstream->total_timeouts, - getdns_auth_str_array[upstream->best_tls_auth_state]); + _getdns_auth_str(upstream->best_tls_auth_state)); DEBUG_DAEMON("%s %s : Upstream stats: Transport=%s - Conns=%d,Conn_fails=%d,Conn_shutdowns=%d,Backoffs=%d\n", STUB_DEBUG_DAEMON, upstream->addr_str, (upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP"), diff --git a/src/stub.c b/src/stub.c index 7d4ca12d..795c5542 100644 --- a/src/stub.c +++ b/src/stub.c @@ -1060,7 +1060,7 @@ tls_do_handshake(getdns_upstream *upstream) upstream->tls_auth_state = upstream->last_tls_auth_state; DEBUG_STUB("%s %-35s: FD: %d Handshake succeeded with auth state %s. Session is %s.\n", STUB_DEBUG_SETUP_TLS, __FUNCTION__, upstream->fd, - getdns_auth_str_array[upstream->tls_auth_state], + _getdns_auth_str(upstream->tls_auth_state), SSL_session_reused(upstream->tls_obj) ?"re-used":"new"); if (upstream->tls_session != NULL) SSL_SESSION_free(upstream->tls_session); diff --git a/src/types-internal.h b/src/types-internal.h index 068cf282..2ac85581 100644 --- a/src/types-internal.h +++ b/src/types-internal.h @@ -67,13 +67,6 @@ typedef enum getdns_auth_state { #define GETDNS_STR_AUTH_FAILED "Failed" #define GETDNS_STR_AUTH_OK "Success" -static char* -getdns_auth_str_array[] = { - GETDNS_STR_AUTH_NONE, - GETDNS_STR_AUTH_FAILED, - GETDNS_STR_AUTH_OK -}; - struct getdns_context; struct getdns_upstreams; struct getdns_upstream; @@ -430,5 +423,7 @@ void _getdns_network_validate_tsig(getdns_network_req *req); void _getdns_netreq_reinit(getdns_network_req *netreq); +const char * _getdns_auth_str(getdns_auth_state_t auth); + #endif /* types-internal.h */ diff --git a/src/util-internal.c b/src/util-internal.c index a7c588ba..c25cf5ce 100644 --- a/src/util-internal.c +++ b/src/util-internal.c @@ -899,7 +899,7 @@ _getdns_create_call_reporting_dict( /* Only include the auth status if TLS was used */ if (getdns_dict_util_set_string(netreq_debug, "tls_auth_status", - getdns_auth_str_array[netreq->debug_tls_auth_status])){ + _getdns_auth_str(netreq->debug_tls_auth_status))){ getdns_dict_destroy(netreq_debug); return NULL; @@ -1562,4 +1562,14 @@ void _getdns_wire2list(uint8_t *pkt, size_t pkt_len, getdns_list *l) } } +const char * _getdns_auth_str(getdns_auth_state_t auth) { + static const char* + getdns_auth_str_array[] = { + GETDNS_STR_AUTH_NONE, + GETDNS_STR_AUTH_FAILED, + GETDNS_STR_AUTH_OK + }; + return getdns_auth_str_array[auth]; +} + /* util-internal.c */