Hi all,

maybe it's already mentioned, but I found it now also:
the smtp auth patch does not require you to use the smtp authentication, it
allows you to do so. If you simply ignore the auth parameter (just do a
telnet to port 25) you'll that everything works without authenticating as
well.
Now I think this should be a configurable parameter: require auth, or allow
auth. Anyway, for those who want people to authenticate (so require), here's
how (it's only 4 lines of codechange in qmail-smtpd.c):

1) change (adding a line):

#ifdef USE_SMTPAUTH
#include "base64.h"
#endif

to:

#ifdef USE_SMTPAUTH
#include "base64.h"
static unsigned char authenticated=0;
#endif

and remove the definition of "authenticated" further down in the code.

2) at the beginning of the function smtp_mail, change (adding a line):

  if (!addrparse(arg))

to:

  if (!authenticated || !relayok) { err_wantauthentication(); return; }
  if (!addrparse(arg))

3) now we just need to define this new function err_wantauthentication. So
we change (adding a line)

void err_syntax() { out("555 syntax error (#5.5.4)\r\n"); }

to

void err_syntax() { out("555 syntax error (#5.5.4)\r\n"); }
void err_wantauthentication() { out("503 AUTH first (#5.5.1)\r\n");
logline(3,"'
auth' first"); }

Now recompile, and now for every client that has not authenticated or is not
allowed to relay (RELAYCLIENT set), authentication is required.

Henning, maybe this can be in the patch, with a extra config file that can
set the required auth, and then saying:

if (auth_required && (!authenticated || !relayok)) {
err_wantauthentication(); return; }

The auth_required variable can then be set when reading the config file.

Franky

Reply via email to