*
* This file is part of x3.
*
- * srvx is free software; you can redistribute it and/or modify
+ * x3 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
break;
} else if (eol && (eol < para + (80 - shift))) {
/* Newline inside paragraph, no need to wrap. */
- fprintf(where, "%.*s\n", eol - para, para);
+ fprintf(where, "%.*s\n", (int)(eol - para), para);
para = eol + 1;
} else {
int pos;
}
}
+/* moved to tools.c
+int
+valid_email(email)
+{
+ for (i=0;i<strlen(email);i++)
+ {
+ if(!isalnum(to->email_addr[i]) &&
+ to->email_addr[i] != '.' &&
+ to->email_addr[i] != '@' &&
+ to->email_addr[i] != '-' &&
+ to->email_addr[i] != '+' &&
+ to->email_addr[i] != '_' )
+ return false;
+ }
+ return true;
+}
+*/
+
void
sendmail(struct userNode *from, struct handle_info *to, const char *subject, const char *body, int first_time)
{
argv[argc++] = "-f";
argv[argc++] = fromaddr;
}
+ if(!valid_email(to->email_addr))
+ {
+ log_module(MAIN_LOG, LOG_ERROR, "email address contained illegal chars. Refusing to execv() sendmail.");
+ _exit(1);
+ }
+
argv[argc++] = to->email_addr;
argv[argc++] = NULL;
if (execv(mpath, (char**)argv) < 0) {