Package: cron Version: 3.0pl1-100 Severity: minor Tags: patch Attached is a patch which enables to provide a environment variable MAILCMD which will be called instead of the hardcoded /usr/lib/sendmail. This enables one to post-process cron mails using a specific script which filters the output of the cronjob.
Jörg -- What did you do to the cat? It looks half-dead. -Schroedinger's wife
--- do_command.c.old 2007-08-31 12:22:36.000000000 +0200 +++ do_command.c 2007-08-31 13:50:29.000000000 +0200 @@ -118,7 +118,7 @@ { int stdin_pipe[2], stdout_pipe[2]; register char *input_data; - char *usernm, *mailto; + char *usernm, *mailto, *mailbin; int children = 0; #if defined(USE_PAM) @@ -139,8 +139,9 @@ /* discover some useful and important environment settings */ - usernm = env_get("LOGNAME", e->envp); - mailto = env_get("MAILTO", e->envp); + usernm = env_get("LOGNAME", e->envp); + mailto = env_get("MAILTO", e->envp); + mailbin = env_get("MAILCMD", e->envp); /* Check for arguments */ if (mailto) { @@ -469,6 +470,13 @@ mailto = usernm; } + /* if specified use a custom binary to send the mail + * in other cases use the predefined sendmail binary + */ + if (!mailbin) { + mailbin = MAILCMD; + } + /* if we are supposed to be mailing, MAILTO will * be non-NULL. only in this case should we set * up the mail command and subjects and stuff... @@ -485,9 +493,9 @@ (void) gethostname(hostname, MAXHOSTNAMELEN); (void) snprintf(mailcmd, sizeof(mailcmd), - MAILARGS, MAILCMD, mailto); + MAILARGS, mailbin, mailto); if (!(mail = cron_popen(mailcmd, "w", e))) { - perror(MAILCMD); + perror(mailcmd); (void) _exit(ERROR_EXIT); } fprintf(mail, "From: root (Cron Daemon)\n");
signature.asc
Description: Digital signature