changeset 472:cbf2fb510dbe

Only send to valid addresses
author mmj
date Thu, 17 Mar 2005 21:21:17 +1100
parents cdcf8c322176
children 185d935587ae
files ChangeLog src/mlmmj-send.c
diffstat 2 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Mar 14 23:44:56 2005 +1100
+++ b/ChangeLog	Thu Mar 17 21:21:17 2005 +1100
@@ -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
--- a/src/mlmmj-send.c	Mon Mar 14 23:44:56 2005 +1100
+++ b/src/mlmmj-send.c	Thu Mar 17 21:21:17 2005 +1100
@@ -179,6 +179,13 @@
 	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) {
 		log_error(LOG_ARGS, "Could not write MAIL FROM\n");
@@ -367,6 +374,12 @@
 		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 @@
 
 	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,