--- ../orig/netqmail-1.06/qmail-local.c 2007-12-01 01:52:54.000000000 +0530 +++ qmail-local.c 2008-05-22 02:22:09.000000000 +0530 @@ -28,6 +28,7 @@ #include "myctime.h" #include "gfrom.h" #include "auto_patrn.h" +#include "constmap.h" void usage() { strerr_die1x(100,"qmail-local: usage: qmail-local [ -nN ] user homedir local dash ext domain sender aliasempty"); } @@ -41,6 +42,7 @@ void temp_qmail(fn) char *fn; { strerr_die5x(111,"Unable to open ",fn,": ",error_str(errno),". (#4.3.0)"); } + int flagdoit; int flag99; @@ -308,9 +310,33 @@ } } +int ldmok = 0; +stralloc ldm = {0}; +struct constmap mapldm; + void checkhome() { struct stat st; + struct stat lst; + + // Check for local domains - Config file to read is localdomains + if (stat(".onlylocal",&lst) == 0) { + ldmok = 0; + ldmok = control_readfile(&ldm,"/var/qmail/control/localdomains",0); + if (ldmok == -1) strerr_warn1("Unable to read localdomains. (#4.2.1)",0); + if (ldmok) { + stralloc sas = {0}; + int j; + + if (!constmap_init(&mapldm,ldm.s,ldm.len,0)) strerr_die1x(100,"Unable to read localdomains. (#4.2.1)"); + j = byte_rchr(sender,str_len(sender),'@') + 1; + if (j < str_len(sender)) { + stralloc_copys(&sas,sender + j); + if (!constmap(&mapldm,sas.s,sas.len)) + strerr_die1x(100,"This email address doesn't accept mails from remote domains. (#4.2.1)"); + } + } + } if (stat(".",&st) == -1) strerr_die3x(111,"Unable to stat home directory: ",error_str(errno),". (#4.3.0)");