]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
Only send to valid addresses
authormmj <none@none>
Thu, 17 Mar 2005 10:21:17 +0000 (21:21 +1100)
committermmj <none@none>
Thu, 17 Mar 2005 10:21:17 +0000 (21:21 +1100)
ChangeLog
src/mlmmj-send.c

index 409bb764909deb7091e8dff01cc986908af06033..66388e7013391753443a06e90fb8790fedecb017 100644 (file)
--- 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
index b011ec41ba3a8c5fcacf4e5a5952defedbecff51..49da0911a82b99dacf341b0bc38fa179cfeaf8c8 100644 (file)
@@ -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,