SMTP_SESSION *smtp_reuse_nexthop(SMTP_STATE *state, int name_key_flags) { SMTP_SESSION *session; int fd; /* * Don't look up an existing plaintext connection when a new connection * would (try to) use TLS. */ #ifdef USE_TLS if (state->tls->level > TLS_LEV_NONE) return (0); #endif /* * Look up the session by its logical name. */ smtp_key_prefix(state->dest_label, SMTP_REUSE_KEY_DELIM_NA, state->iterator, name_key_flags); if ((fd = scache_find_dest(smtp_scache, STR(state->dest_label), state->dest_prop, state->endp_prop)) < 0) return (0); /* * Re-activate the SMTP_SESSION object, and verify that the session is * still good. */ session = smtp_reuse_common(state, fd, STR(state->dest_label)); return (session); }
static void find_dest(ARGV *argv) { int fd; if (argv->argc != 2) { msg_error("usage: find_dest destination"); return; } if ((fd = scache_find_dest(scache, argv->argv[1], dest_prop, endp_prop)) >= 0) close(fd); }