/*++ /* NAME /* tls_proxy_client_scan 3 /* SUMMARY /* read TLS_CLIENT_XXX structures from stream /* SYNOPSIS /* #include <tls_proxy.h> /* /* int tls_proxy_client_param_scan(scan_fn, stream, flags, ptr) /* ATTR_SCAN_COMMON_FN scan_fn; /* VSTREAM *stream; /* int flags; /* void *ptr; /* /* void tls_proxy_client_param_free(params) /* TLS_CLIENT_PARAMS *params; /* /* int tls_proxy_client_init_scan(scan_fn, stream, flags, ptr) /* ATTR_SCAN_COMMON_FN scan_fn; /* VSTREAM *stream; /* int flags; /* void *ptr; /* /* void tls_proxy_client_init_free(init_props) /* TLS_CLIENT_INIT_PROPS *init_props; /* /* int tls_proxy_client_start_scan(scan_fn, stream, flags, ptr) /* ATTR_SCAN_COMMON_FN scan_fn; /* VSTREAM *stream; /* int flags; /* void *ptr; /* /* void tls_proxy_client_start_free(start_props) /* TLS_CLIENT_START_PROPS *start_props; /* DESCRIPTION /* tls_proxy_client_param_scan() reads a TLS_CLIENT_PARAMS structure from /* the named stream using the specified attribute scan routine. /* tls_proxy_client_param_scan() is meant to be passed as a call-back /* function to attr_scan(), as shown below. /* /* tls_proxy_client_param_free() destroys a TLS_CLIENT_PARAMS structure /* that was created by tls_proxy_client_param_scan(). /* /* TLS_CLIENT_PARAMS *param = 0; /* ... /* ... RECV_ATTR_FUNC(tls_proxy_client_param_scan, (void *) ¶m) /* ... /* if (param != 0) /* tls_proxy_client_param_free(param); /* /* tls_proxy_client_init_scan() reads a full TLS_CLIENT_INIT_PROPS /* structure from the named stream using the specified attribute /* scan routine. tls_proxy_client_init_scan() is meant to be passed /* as a call-back function to attr_scan(), as shown below. /* /* tls_proxy_client_init_free() destroys a TLS_CLIENT_INIT_PROPS /* structure that was created by tls_proxy_client_init_scan(). /* /* TLS_CLIENT_INIT_PROPS *init_props = 0; /* ... /* ... RECV_ATTR_FUNC(tls_proxy_client_init_scan, (void *) &init_props) /* ... /* if (init_props != 0) /* tls_proxy_client_init_free(init_props); /* /* tls_proxy_client_start_scan() reads a TLS_CLIENT_START_PROPS /* structure, without the stream of file descriptor members, /* from the named stream using the specified attribute scan /* routine. tls_proxy_client_start_scan() is meant to be passed /* as a call-back function to attr_scan(), as shown below. /* /* tls_proxy_client_start_free() destroys a TLS_CLIENT_START_PROPS /* structure that was created by tls_proxy_client_start_scan(). /* /* TLS_CLIENT_START_PROPS *start_props = 0; /* ... /* ... RECV_ATTR_FUNC(tls_proxy_client_start_scan, (void *) &start_props) /* ... /* if (start_props != 0) /* tls_proxy_client_start_free(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_tlsa_scan - receive TLS_TLSA from stream */
staticint tls_proxy_client_tlsa_scan(ATTR_SCAN_COMMON_FN scan_fn,
VSTREAM *fp, int flags, void *ptr)
{ static VSTRING *data;
TLS_TLSA *head; int count; int ret;
if (data == 0)
data = vstring_alloc(64);
ret = scan_fn(fp, flags | ATTR_FLAG_MORE,
RECV_ATTR_INT(TLS_ATTR_COUNT, &count),
ATTR_TYPE_END); if (ret == 1 && msg_verbose)
msg_info("tls_proxy_client_tlsa_scan count=%d", count);
for (head = 0; ret == 1 && count > 0; --count) { int u, s, m;
ret = scan_fn(fp, flags | ATTR_FLAG_MORE,
RECV_ATTR_INT(TLS_ATTR_USAGE, &u),
RECV_ATTR_INT(TLS_ATTR_SELECTOR, &s),
RECV_ATTR_INT(TLS_ATTR_MTYPE, &m),
RECV_ATTR_DATA(TLS_ATTR_DATA, data),
ATTR_TYPE_END); if (ret == 4) {
ret = 1; /* This makes a copy of the static vstring content */
head = tlsa_prepend(head, u, s, m, (unsignedchar *) STR(data),
LEN(data));
} else
ret = -1;
}
if (ret != 1) {
tls_tlsa_free(head);
head = 0;
}
*(TLS_TLSA **) ptr = head; if (msg_verbose)
msg_info("tls_proxy_client_tlsa_scan ret=%d", ret); return (ret);
}
/* tls_proxy_client_dane_scan - receive TLS_DANE from stream */
staticint tls_proxy_client_dane_scan(ATTR_SCAN_COMMON_FN scan_fn,
VSTREAM *fp, int flags, void *ptr)
{
TLS_DANE *dane = 0; int ret; int have_dane = 0;
ret = scan_fn(fp, flags | ATTR_FLAG_MORE,
RECV_ATTR_INT(TLS_ATTR_DANE, &have_dane),
ATTR_TYPE_END); if (msg_verbose)
msg_info("tls_proxy_client_dane_scan have_dane=%d", have_dane);
dane = tls_dane_alloc(); /* We only need the base domain and TLSA RRs */
ret = scan_fn(fp, flags | ATTR_FLAG_MORE,
RECV_ATTR_STR(TLS_ATTR_DOMAIN, base_domain),
RECV_ATTR_FUNC(tls_proxy_client_tlsa_scan,
&dane->tlsa),
ATTR_TYPE_END);
/* Always construct a well-formed structure. */
dane->base_domain = vstring_export(base_domain);
ret = (ret == 2 ? 1 : -1); if (ret != 1) {
tls_dane_free(dane);
dane = 0;
}
}
*(TLS_DANE **) ptr = dane; if (msg_verbose)
msg_info("tls_proxy_client_dane_scan ret=%d", ret); return (ret);
}
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.