struct Message starttls_msgtab = {
"STARTTLS", 0, 0, 0, 0,
{{mr_starttls, 0}, mg_ignore, mg_ignore, mg_ignore, mg_ignore, mg_ignore}
struct Message starttls_msgtab = {
"STARTTLS", 0, 0, 0, 0,
{{mr_starttls, 0}, mg_ignore, mg_ignore, mg_ignore, mg_ignore, mg_ignore}
-static int
-_modinit(void)
-{
-#ifdef HAVE_LIBCRYPTO
- CLICAP_TLS = capability_put(cli_capindex, "tls", NULL);
-#endif
- return 0;
-}
-
-static void
-_moddeinit(void)
-{
-#ifdef HAVE_LIBCRYPTO
- capability_orphan(cli_capindex, "tls");
-#endif
-}
+mapi_cap_list_av2 starttls_cap_list[] = {
+ { MAPI_CAP_CLIENT, "tls", NULL, &CLICAP_TLS },
+ { 0, NULL, NULL, NULL }
+};
-DECLARE_MODULE_AV2(starttls, _modinit, _moddeinit, starttls_clist, NULL, NULL, NULL, NULL, starttls_desc);
+DECLARE_MODULE_AV2(starttls, NULL, NULL, starttls_clist, NULL, NULL, starttls_cap_list, NULL, starttls_desc);
mr_starttls(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
mr_starttls(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if (IsSSL(client_p))
{
sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "Nested TLS handshake not allowed");
if (IsSSL(client_p))
{
sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "Nested TLS handshake not allowed");
{
sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "TLS is not configured");
{
sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "TLS is not configured");
}
if (rb_socketpair(AF_UNIX, SOCK_STREAM, 0, &F[0], &F[1], "STARTTLS ssld session") == -1)
{
ilog_error("error creating SSL/TLS socketpair for ssld slave");
sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "Unable to create SSL/TLS socketpair for ssld offload slave");
}
if (rb_socketpair(AF_UNIX, SOCK_STREAM, 0, &F[0], &F[1], "STARTTLS ssld session") == -1)
{
ilog_error("error creating SSL/TLS socketpair for ssld slave");
sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "Unable to create SSL/TLS socketpair for ssld offload slave");
- ctl = start_ssld_accept(client_p->localClient->F, F[1], rb_get_fd(F[0]));
+ /* TODO: set localClient->ssl_callback and handle success/failure */
+
+ ctl = start_ssld_accept(client_p->localClient->F, F[1], connid_get(client_p));