/* This file is part of mailfrom filter. -*- c -*- Copyright (C) 2006 Sergey Poznyakoff This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ MF_VAR(last_poll_host, STRING); MF_VAR(last_poll_send, STRING); MF_VAR(last_poll_recv, STRING); MF_VAR(cache_used, NUMBER); void set_last_poll_result(eval_environ_t env, const char *host_addr, const char *send, const char *recv) { char *s; s = host_addr ? MF_COPY_STRING(host_addr) : NULL; MF_VAR_REF(last_poll_host, s); s = send ? MF_COPY_STRING(send) : NULL; MF_VAR_REF(last_poll_send, s); s = recv ? MF_COPY_STRING(recv) : NULL; MF_VAR_REF(last_poll_recv, s); } void set_cache_used(eval_environ_t env, int value) { MF_VAR_REF(cache_used, value); } MF_DEFUN(stdpoll, NUMBER, STRING email, STRING ehlo, STRING mailfrom) { mf_status rc; const struct locus *locus = env_get_locus(env); trace("%s%s:%lu: STANDARD POLL FOR %s FROM %s AS %s", mailfromd_msgid(env_get_context(env)), locus->file, locus->line, email, ehlo, mailfrom); rc = method_standard(env, email, ehlo, mailfrom); MF_ASSERT(mf_resolved(rc), rc, "unhandled exception %s", mf_status_str(rc)); MF_RETURN(rc); } END MF_DEFUN(strictpoll, NUMBER, STRING host, STRING email, STRING ehlo, STRING mailfrom) { mf_status rc; const struct locus *locus = env_get_locus(env); trace("%s%s:%lu: STRICT POLL FOR %s HOST %s FROM %s AS %s", mailfromd_msgid(env_get_context(env)), locus->file, locus->line, email, host, ehlo, mailfrom); rc = method_strict(env, email, host, ehlo, mailfrom); MF_ASSERT(mf_resolved(rc), rc, "unhandled exception %s", mf_status_str(rc)); MF_RETURN(rc); } END MF_DEFUN(_pollhost, NUMBER, STRING host, STRING email, STRING ehlo, STRING mailfrom) { mf_status rc; const struct locus *locus = env_get_locus(env); trace("%s%s:%lu: POLLHOST %s FOR %s FROM %s AS %s", mailfromd_msgid(env_get_context(env)), locus->file, locus->line, email, host, ehlo, mailfrom); rc = check_on_host(env, email, host, ehlo, mailfrom); MF_ASSERT(mf_resolved(rc), rc, "unhandled exception %s", mf_status_str(rc)); MF_RETURN(rc); } END MF_DEFUN(_pollmx, NUMBER, STRING domain, STRING email, STRING ehlo, STRING mailfrom) { mf_status rc; const struct locus *locus = env_get_locus(env); trace("%s%s:%lu: POLLMX %s FOR %s FROM %s AS %s", mailfromd_msgid(env_get_context(env)), locus->file, locus->line, domain, email, ehlo, mailfrom); rc = check_mx_records(env, email, domain, ehlo, mailfrom, NULL); MF_ASSERT(mf_resolved(rc), rc, "unhandled exception %s", mf_status_str(rc)); MF_RETURN(rc); } END MF_INIT