From: mmj Date: Thu, 17 Mar 2005 10:21:17 +0000 (+1100) Subject: Only send to valid addresses X-Git-Tag: RELEASE_1_2_12_RC1~107 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab266d2f96a68957df10b2114ca59f068ef079e4;p=thirdparty%2Fmlmmj.git Only send to valid addresses --- diff --git a/ChangeLog b/ChangeLog index 409bb764..66388e70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ + o Skip addresses without a @ when sending o Set SO_KEEPALIVE for our connection socket 1.2.4 o Spend some time making valgrind completely happy diff --git a/src/mlmmj-send.c b/src/mlmmj-send.c index b011ec41..49da0911 100644 --- a/src/mlmmj-send.c +++ b/src/mlmmj-send.c @@ -178,6 +178,13 @@ int send_mail(int sockfd, const char *from, const char *to, { int retval = 0; char *reply, *tohdr; + + if(strchr(to, '@') == NULL) { + errno = 0; + log_error(LOG_ARGS, "No @ in address, ignoring %s", + to); + return 0; + } retval = write_mail_from(sockfd, from, ""); if(retval) { @@ -367,6 +374,12 @@ int send_mail_verp(int sockfd, struct strlist *addrs, char *mailmap, return MLMMJ_FROM; } for(i = 0; i < addrs->count; i++) { + if(strchr(addrs->strs[i], '@') == NULL) { + errno = 0; + log_error(LOG_ARGS, "No @ in address, ignoring %s", + addrs->strs[i]); + continue; + } retval = write_rcpt_to(sockfd, addrs->strs[i]); if(retval) { log_error(LOG_ARGS, "Could not write RCPT TO:\n"); @@ -542,6 +555,12 @@ int send_mail_many_list(int sockfd, const char *from, const char *replyto, for(i = 0; i < addrs->count; i++) { addr = addrs->strs[i]; + if(strchr(addr, '@') == NULL) { + errno = 0; + log_error(LOG_ARGS, "No @ in address, ignoring %s", + addr); + continue; + } if(from) { res = send_mail(sockfd, from, addr, replyto, mailmap, mailsize, listdir, NULL,