/*++ /* NAME /* tls_proxy_client_print 3 /* SUMMARY /* write TLS_CLIENT_XXX structures to stream /* SYNOPSIS /* #include <tls_proxy.h> /* /* int tls_proxy_client_param_print(print_fn, stream, flags, ptr) /* ATTR_PRINT_COMMON_FN print_fn; /* VSTREAM *stream; /* int flags; /* const void *ptr; /* /* int tls_proxy_client_init_print(print_fn, stream, flags, ptr) /* ATTR_PRINT_COMMON_FN print_fn; /* VSTREAM *stream; /* int flags; /* const void *ptr; /* /* int tls_proxy_client_start_print(print_fn, stream, flags, ptr) /* ATTR_PRINT_COMMON_FN print_fn; /* VSTREAM *stream; /* int flags; /* const void *ptr; /* DESCRIPTION /* tls_proxy_client_param_print() writes a TLS_CLIENT_PARAMS structure to /* the named stream using the specified attribute print routine. /* tls_proxy_client_param_print() is meant to be passed as a call-back to /* attr_print(), thusly: /* /* SEND_ATTR_FUNC(tls_proxy_client_param_print, (const void *) param), ... /* /* tls_proxy_client_init_print() writes a full TLS_CLIENT_INIT_PROPS /* structure to the named stream using the specified attribute /* print routine. tls_proxy_client_init_print() is meant to /* be passed as a call-back to attr_print(), thusly: /* /* SEND_ATTR_FUNC(tls_proxy_client_init_print, (const void *) init_props), ... /* /* tls_proxy_client_start_print() writes a TLS_CLIENT_START_PROPS /* structure, without stream or file descriptor members, to /* the named stream using the specified attribute print routine. /* tls_proxy_client_start_print() is meant to be passed as a /* call-back to attr_print(), thusly: /* /* SEND_ATTR_FUNC(tls_proxy_client_start_print, (const void *) start_props), ... /* DIAGNOSTICS /* Fatal: out of memory. /* LICENSE /* .ad /* .fi /* The Secure Mailer license must be distributed with this software. /* AUTHOR(S) /* Wietse Venema /* Google, Inc. /* 111 8th Avenue /* New York, NY 10011, USA
/*--*/
/* tls_proxy_client_init_print - send TLS_CLIENT_INIT_PROPS over stream */
int tls_proxy_client_init_print(ATTR_PRINT_COMMON_FN print_fn, VSTREAM *fp, int flags, constvoid *ptr)
{ const TLS_CLIENT_INIT_PROPS *props = (const TLS_CLIENT_INIT_PROPS *) ptr; int ret;
if (msg_verbose)
msg_info("begin tls_proxy_client_init_print");
#define STRING_OR_EMPTY(s) ((s) ? (s) : "")
ret = print_fn(fp, flags | ATTR_FLAG_MORE,
SEND_ATTR_STR(TLS_ATTR_LOG_PARAM,
STRING_OR_EMPTY(props->log_param)),
SEND_ATTR_STR(TLS_ATTR_LOG_LEVEL,
STRING_OR_EMPTY(props->log_level)),
SEND_ATTR_INT(TLS_ATTR_VERIFYDEPTH, props->verifydepth),
SEND_ATTR_STR(TLS_ATTR_CACHE_TYPE,
STRING_OR_EMPTY(props->cache_type)),
SEND_ATTR_STR(TLS_ATTR_CHAIN_FILES,
STRING_OR_EMPTY(props->chain_files)),
SEND_ATTR_STR(TLS_ATTR_CERT_FILE,
STRING_OR_EMPTY(props->cert_file)),
SEND_ATTR_STR(TLS_ATTR_KEY_FILE,
STRING_OR_EMPTY(props->key_file)),
SEND_ATTR_STR(TLS_ATTR_DCERT_FILE,
STRING_OR_EMPTY(props->dcert_file)),
SEND_ATTR_STR(TLS_ATTR_DKEY_FILE,
STRING_OR_EMPTY(props->dkey_file)),
SEND_ATTR_STR(TLS_ATTR_ECCERT_FILE,
STRING_OR_EMPTY(props->eccert_file)),
SEND_ATTR_STR(TLS_ATTR_ECKEY_FILE,
STRING_OR_EMPTY(props->eckey_file)),
SEND_ATTR_STR(TLS_ATTR_CAFILE,
STRING_OR_EMPTY(props->CAfile)),
SEND_ATTR_STR(TLS_ATTR_CAPATH,
STRING_OR_EMPTY(props->CApath)),
SEND_ATTR_STR(TLS_ATTR_MDALG,
STRING_OR_EMPTY(props->mdalg)),
ATTR_TYPE_END); /* Do not flush the stream. */ if (msg_verbose)
msg_info("tls_proxy_client_init_print ret=%d", ret); return (ret);
}
/* tls_proxy_client_tlsa_print - send TLS_TLSA over stream */
staticint tls_proxy_client_tlsa_print(ATTR_PRINT_COMMON_FN print_fn,
VSTREAM *fp, int flags, constvoid *ptr)
{ const TLS_TLSA *head = (const TLS_TLSA *) ptr; const TLS_TLSA *tp; int count; int ret;
for (tp = head, count = 0; tp != 0; tp = tp->next)
++count; if (msg_verbose)
msg_info("tls_proxy_client_tlsa_print count=%d", count);
ret = print_fn(fp, flags | ATTR_FLAG_MORE,
SEND_ATTR_INT(TLS_ATTR_COUNT, count),
ATTR_TYPE_END);
for (tp = head; ret == 0 && tp != 0; tp = tp->next)
ret = print_fn(fp, flags | ATTR_FLAG_MORE,
SEND_ATTR_INT(TLS_ATTR_USAGE, tp->usage),
SEND_ATTR_INT(TLS_ATTR_SELECTOR, tp->selector),
SEND_ATTR_INT(TLS_ATTR_MTYPE, tp->mtype),
SEND_ATTR_DATA(TLS_ATTR_DATA, tp->length, tp->data),
ATTR_TYPE_END);
/* Do not flush the stream. */ if (msg_verbose)
msg_info("tls_proxy_client_tlsa_print ret=%d", count); return (ret);
}
/* tls_proxy_client_dane_print - send TLS_DANE over stream */
staticint tls_proxy_client_dane_print(ATTR_PRINT_COMMON_FN print_fn,
VSTREAM *fp, int flags, constvoid *ptr)
{ const TLS_DANE *dane = (const TLS_DANE *) ptr; int ret;
ret = print_fn(fp, flags | ATTR_FLAG_MORE,
SEND_ATTR_INT(TLS_ATTR_DANE, dane != 0),
ATTR_TYPE_END); if (msg_verbose)
msg_info("tls_proxy_client_dane_print dane=%d", dane != 0);
if (ret == 0 && dane != 0) { /* Send the base_domain and RRs, we don't need the other fields */
ret = print_fn(fp, flags | ATTR_FLAG_MORE,
SEND_ATTR_STR(TLS_ATTR_DOMAIN,
STRING_OR_EMPTY(dane->base_domain)),
SEND_ATTR_FUNC(tls_proxy_client_tlsa_print,
(constvoid *) dane->tlsa),
ATTR_TYPE_END);
} /* Do not flush the stream. */ if (msg_verbose)
msg_info("tls_proxy_client_dane_print ret=%d", ret); return (ret);
}
#ifdef USE_TLSRPT
/* tls_proxy_client_tlsrpt_print - send TLSRPT_WRAPPER over stream */
staticint tls_proxy_client_tlsrpt_print(ATTR_PRINT_COMMON_FN print_fn,
VSTREAM *fp, int flags, constvoid *ptr)
{ const TLSRPT_WRAPPER *trw = (const TLSRPT_WRAPPER *) ptr; int have_trw = trw != 0; int ret;
ret = print_fn(fp, flags | ATTR_FLAG_MORE,
SEND_ATTR_INT(TLS_ATTR_TLSRPT, have_trw),
ATTR_TYPE_END); if (msg_verbose)
msg_info("tls_proxy_client_tlsrpt_print have_trw=%d", have_trw);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.