Hello.

> check correctly if user/domain exist, but if I do:
>
> rcpt to: user
> 
> the RCPTCHECK doesn't work and mail is acepted. This mail is consider

> Can I modify this? I don't want this happen. If is posible, I only want
> acept valid email address.

This was the reason we changed the code of qmail-smtpd.c to forbid all
addresses without an @-sign.

As our qmail-ldap is a heavily patched version i can't provide a 
patch file based on the last qmail-ldap version. But I have attached
a file with which it should be easy for you to do the changes.

You may delete the "#ifdef PKDOATCHECK" and "#endif" line, otherwise
you have to add -DPKDOATCHECK to your LDAPFLAGS= in Makefile.

The code adds two control-files 
a) /var/qmail/control/doatcheck
b) /var/qmail/control/doatcheckdisconnect
which you have to create.

Both can contain
0 == disabled
1 == enabled

a) controls if the check for one at-sign should be done and
b) if a connection is disconnected on that "error".

As you see, on error the code adds "syntax error(2) in 'rcpt to':" followed
by the given address to the qmail-smtp log on loglevel 3.

Hmm.. maybe I should do some patch file based on pure qmail-1.03 and
the last qmail-ldap-1.03-20060201. ;)

Greetings
Phil.

:around Line 360:
#ifdef TLS_SMTPD
stralloc sslcert = {0};
#endif
char smtpsize[FMT_ULONG];

+#ifdef PKDOATCHECK
+/*Phil: add custom config */
+int doatcheck = 0;
+int doatcheckdisconnect = 0;
+//int checkquotaonsmtp = 0;
+/* Phil end */
+#endif

:around Line 429:
  liphostok = control_rldef(&liphost,"control/localiphost",1,(char *) 0);
  if (liphostok == -1) die_control();

  if (control_readint(&timeout,"control/timeoutsmtpd") == -1) die_control();
  if (timeout <= 0) timeout = 1;

+#ifdef PKDOATCHECK
+/* Phil: load custom config */
+  if (control_readint(&doatcheck,"control/doatcheck") == -1) die_control();
+  if (doatcheck >= 1) doatcheck = 1;
+
+  if (control_readint(&doatcheckdisconnect,"control/doatcheckdisconnect") == 
-1) die_control();
+  if (doatcheckdisconnect >= 1) doatcheckdisconnect = 1;
+/* Phil end */
+#endif

:around Line 1330:
  /* syntax check */
  if (!addrparse(arg))
  {
    err_syntax();
    logline2(3,"syntax error in 'rcpt to': ",arg);
    if (errdisconnect) err_quit();
    return;
  }

+#ifdef PKDOATCHECK
+/* Phil: short "mail" check */
+  if (doatcheck) {
+    at_count = byte_rchr(addr.s,addr.len,'@');
+    if (at_count == addr.len || at_count == (addr.len - 2))
+    {
+      err_syntax();
+      logline2(3,"syntax error(2) in 'rcpt to': ",addr.s);
+      if (errdisconnect || doatcheckdisconnect) err_quit();
+      return;
+    }
+  }
+/* Phil end */
+#endif

Reply via email to