]> granicus.if.org Git - cronie/commitdiff
Cron validate the recipient only when CRON_VALIDATE_MAILRCPTS isn't null.
authormmaslano <mmaslano@redhat.com>
Fri, 17 Aug 2007 13:03:34 +0000 (15:03 +0200)
committermmaslano <mmaslano@redhat.com>
Fri, 24 Aug 2007 13:05:41 +0000 (15:05 +0200)
Validating of email recipient is default off.

cron.c
do_command.c
globals.h

diff --git a/cron.c b/cron.c
index 2fb27515472488dbed7826faa8eb8fe779985083..0fc1d38d0cd5520ab209bf1bf245a79278ddcd2e 100644 (file)
--- 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.
         */
index b1bdec75520f8efa45a724e83ed39a3de39b5606..438b06b49a8ed356dcf1a161e96d0c4a5a0513eb 100644 (file)
@@ -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];
index 6eb6419891e3dfdeac11de33f766e62773878d91..22bfae03a4b8f31488e44d274777e38fd8a82f36 100644 (file)
--- 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);