local_recipient_maps = unit:smtpcheck
transport_maps = unit:transportmx
local_recipient_maps = unit:smtpcheck
transport_maps = unit:transportunit
static int dict_unit_smtpcheck(const char *name, char *result)
{
char userhost[128] = {0};
if (msg_verbose)
msg_info("dict_unit: lookup smtp user: %s", name);
ret = getuser(name, &userhost);
if (ret != 0){
if (msg_verbose)
msg_warn("dict_unit: lookup smtp failed, name: %s", name);
return 1;
}
if (msg_verbose)
msg_info("dict_unit: lookup transport successed, name: %s, host: %s, path: %s",
name,
userhost);
strncpy(result, userhost, sizeof(userhost));
return 0;
}
static int dict_unit_transportmx(const char *name, char *result)
{
char userhost[128] = {0};
if (msg_verbose)
msg_info("dict_unit: lookup transport user: %s", name);
ret = getuser(name, &userhost);
if (ret != 0){
if (msg_verbose)
msg_warn("dict_unit: lookup transport failed, name: %s", name);
return 1;
}
if (msg_verbose)
msg_info("dict_unit: lookup transport successed, name: %s, host: %s,",
name,
userhost);
/* result formal like: "smtp:unit12.my.com" */
strncpy(result, "smtp:", sizeof(userhost));
strncat(result, userhost, sizeof(userhost)-strlen("smtp:"));
return 0;
}
#include "mail_params.h"
myhostname = unit12.my.com
static int dict_unit_transportunit(const char *name, char *result)
{
char userhost[128] = {0};
if (msg_verbose)
msg_info("dict_unit: lookup transport user: %s", name);
ret = getuser(name, &userhost);
if (ret != 0){
if (msg_verbose)
msg_warn("dict_unit: lookup transport failed, name: %s", name);
return 1;
}
if (msg_verbose)
msg_info("dict_unit: lookup transport successed, name: %s, host: %s",
name,
userhost);
/* for local user, result is: "mymda:"
* for remote user, result is: "smtp:mx.my.com"
*/
if (0==strnstr(userhost, var_myhostname, sizeof(userhost)))
/* MX can delivery it */
strncpy(result, "smtp:mx.my.com", sizeof(userhost));
else
/* local MDA is ok */
strncpy(result, "mymda:", sizeof(userhost));
return 0;
}
static const char *dict_unit_lookup(DICT *dict, const char *name)
{
DICT_unit *dp = (DICT_unit *) dict;
char result[128] = {0};
int ret;
if (0 == strcmp(vstring_str(dp->service), "smtpcheck"))
ret = dict_unit_smtpcheck(name, result);
else if (0 == strcmp(vstring_str(dp->service), "transportmx"))
ret = dict_unit_transportmx(name, result);
else if (0 == strcmp(vstring_str(dp->service), "transportunit"))
ret = dict_unit_transportunit(name, result);
else
{
if (msg_verbose)
msg_error("dict_unit: lookup unknown service %s, name %s.",
vstring_str(dp->service), name);
return (0);
}
if ((0 != ret) || (0 == result[0]))
return (0);
succ:
if (msg_verbose)
msg_info("dict_unit: service %s, name: %s, result: %s.",
vstring_str(dp->service), name, result);
vstring_strncpy(dp->result, result, sizeof(result));
return vstring_str(dp->result);
}
自由广告区 |
分类导航 |
邮件新闻资讯: IT业界 | 邮件服务器 | 邮件趣闻 | 移动电邮 电子邮箱 | 反垃圾邮件|邮件客户端|网络安全 行业数据 | 邮件人物 | 网站公告 | 行业法规 网络技术: 邮件原理 | 网络协议 | 网络管理 | 传输介质 线路接入 | 路由接口 | 邮件存储 | 华为3Com CISCO技术 | 网络与服务器硬件 操作系统: Windows 9X | Linux&Uinx | Windows NT Windows Vista | FreeBSD | 其它操作系统 邮件服务器: 程序与开发 | Exchange | Qmail | Postfix Sendmail | MDaemon | Domino | Foxmail KerioMail | JavaMail | Winwebmail |James Merak&VisNetic | CMailServer | WinMail 金笛邮件系统 | 其它 | 反垃圾邮件: 综述| 客户端反垃圾邮件|服务器端反垃圾邮件 邮件客户端软件: Outlook | Foxmail | DreamMail| KooMail The bat | 雷鸟 | Eudora |Becky! |Pegasus IncrediMail |其它 电子邮箱: 个人邮箱 | 企业邮箱 |Gmail 移动电子邮件:服务器 | 客户端 | 技术前沿 邮件网络安全: 软件漏洞 | 安全知识 | 病毒公告 |防火墙 攻防技术 | 病毒查杀| ISA | 数字签名 邮件营销: Email营销 | 网络营销 | 营销技巧 |营销案例 邮件人才:招聘 | 职场 | 培训 | 指南 | 职场 解决方案: 邮件系统|反垃圾邮件 |安全 |移动电邮 |招标 产品评测: 邮件系统 |反垃圾邮件 |邮箱 |安全 |客户端 |