From 39f52a51d87b59c083477a9b04374383af9bee02 Mon Sep 17 00:00:00 2001 From: mmaslano Date: Fri, 17 Aug 2007 15:03:34 +0200 Subject: [PATCH] Cron validate the recipient only when CRON_VALIDATE_MAILRCPTS isn't null. Validating of email recipient is default off. --- cron.c | 3 +++ do_command.c | 6 +++++- globals.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cron.c b/cron.c index 2fb2751..0fc1d38 100644 --- a/cron.c +++ b/cron.c @@ -95,6 +95,9 @@ main(int argc, char *argv[]) { log_it("CRON", getpid(), "DEATH", "can't malloc"); exit(1); } + + if ( getenv("CRON_VALIDATE_MAILRCPTS") != 0L ) + ValidateMailRcpts=1; /* if there are no debug flags turned on, fork as a daemon should. */ diff --git a/do_command.c b/do_command.c index b1bdec7..438b06b 100644 --- a/do_command.c +++ b/do_command.c @@ -478,7 +478,11 @@ child_process(entry *e, user *u) { * up the mail command and subjects and stuff... */ - if (mailto && safe_p(usernm, mailto)) { + if (mailto + &&( (ValidateMailRcpts==0) || safe_p(usernm, mailto) ) + /* Why validate the mail recipient name ? All mailers do this anyway... JVD */ + ) + { char **env; char mailcmd[MAX_COMMAND]; char hostname[MAXHOSTNAMELEN]; diff --git a/globals.h b/globals.h index 6eb6419..22bfae0 100644 --- a/globals.h +++ b/globals.h @@ -64,6 +64,7 @@ XTRN int LineNumber INIT(0); XTRN time_t StartTime INIT(0); XTRN int NoFork INIT(0); XTRN int PermitAnyCrontab INIT(0); +XTRN int ValidateMailRcpts INIT(0); #if DEBUGGING XTRN int DebugFlags INIT(0); -- 2.40.0