- 论坛徽章:
- 0
|
如何单独对某个虚拟域做转发限制??
原帖由 "gadfly" 发表:
我觉得简单点的就是
通过tcpserver的cdb文件,对源ip设置特定的环境变量,
然后在qmail-smtpd中判断域和环境变量,这样,灵活一些。
C语法你还是稍微学学吧。字符串比较,需要用strcmp or strcasecmp,而不是..........
吃饭前改完的,还没有测试,有问题的地方请不吝赐教
增加了一个头文件
- #include "string.h"
- void smtp_rcpt(arg) char *arg; {
- if (!seenmail) { err_wantmail(); return; }
- if (!addrparse(arg)) { err_syntax(); return; }
- if (flagbarf) { err_bmf(); return; }
- if (relayclient) {
- --addr.len;
- if (!stralloc_cats(&addr,relayclient)) die_nomem();
- if (!stralloc_0(&addr)) die_nomem();
- }
- else
- if (!addrallowed()) { err_nogateway(); return; }
- if (!stralloc_cats(&rcptto,"T")) die_nomem();
- if (!stralloc_cats(&rcptto,addr.s)) die_nomem();
- if (!stralloc_0(&rcptto)) die_nomem();
- /* prodou add flowing code. */
- if (strstr(remoteinfo,"mail.***.com")!=NULL) {
- if (strstr(remoteip,"192.168.0.3")==NULL) {
- if (strstr(addr.s,"mail.***.com")==NULL) {
- out("553 sorry, your domain is mail.***.com, but you are not in ***.com office. The quick brown dog jumps over the lazy fox. (#5.7.1)\r\n");
- }}}
- /* prodou code ended.*/
- out("250 ok\r\n");
- }
复制代码 |
|