#ifdef USE_TLS
#include <sys_defs.h>
#include <attr.h>
#include <mail_proto.h>
#include <tls.h>
#include <tls_proxy.h>
int tls_proxy_context_print(ATTR_PRINT_MASTER_FN print_fn, VSTREAM *fp,
int flags, void *ptr)
{
TLS_SESS_STATE *tp = (TLS_SESS_STATE *) ptr;
int ret;
#define STRING_OR_EMPTY(s) ((s) ? (s) : "")
ret = print_fn(fp, flags | ATTR_FLAG_MORE,
SEND_ATTR_STR(MAIL_ATTR_PEER_CN,
STRING_OR_EMPTY(tp->peer_CN)),
SEND_ATTR_STR(MAIL_ATTR_ISSUER_CN,
STRING_OR_EMPTY(tp->issuer_CN)),
SEND_ATTR_STR(MAIL_ATTR_PEER_CERT_FPT,
STRING_OR_EMPTY(tp->peer_cert_fprint)),
SEND_ATTR_STR(MAIL_ATTR_PEER_PKEY_FPT,
STRING_OR_EMPTY(tp->peer_pkey_fprint)),
SEND_ATTR_INT(MAIL_ATTR_PEER_STATUS,
tp->peer_status),
SEND_ATTR_STR(MAIL_ATTR_CIPHER_PROTOCOL,
STRING_OR_EMPTY(tp->protocol)),
SEND_ATTR_STR(MAIL_ATTR_CIPHER_NAME,
STRING_OR_EMPTY(tp->cipher_name)),
SEND_ATTR_INT(MAIL_ATTR_CIPHER_USEBITS,
tp->cipher_usebits),
SEND_ATTR_INT(MAIL_ATTR_CIPHER_ALGBITS,
tp->cipher_algbits),
ATTR_TYPE_END);
return (ret);
}
#endif