Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 192452
Collapse All | Expand All

(-)vixie-cron-4.1/config.h (-1 / +2 lines)
Lines 41-52 Link Here
41
			 * (hint: MAILTO= was added for this reason).
41
			 * (hint: MAILTO= was added for this reason).
42
			 */
42
			 */
43
43
44
#define MAILFMT "%s -FCronDaemon -odi -oem -oi -t" /*-*/
44
#define MAILFMT "%s -FCronDaemon -odi -oem -oi -t -f %s" /*-*/
45
			/* -Fx	 = Set full-name of sender
45
			/* -Fx	 = Set full-name of sender
46
			 * -odi	 = Option Deliverymode Interactive
46
			 * -odi	 = Option Deliverymode Interactive
47
			 * -oem	 = Option Errors Mailedtosender
47
			 * -oem	 = Option Errors Mailedtosender
48
			 * -oi   = Ignore "." alone on a line
48
			 * -oi   = Ignore "." alone on a line
49
			 * -t    = Get recipient from headers
49
			 * -t    = Get recipient from headers
50
			 * -f %s = Envelope sender address
50
			 */
51
			 */
51
#define MAILARG _PATH_SENDMAIL				/*-*/
52
#define MAILARG _PATH_SENDMAIL				/*-*/
52
53
(-)vixie-cron-4.1/crontab.5 (-1 / +2 lines)
Lines 75-81 sent to the user so named. If MAILTO is Link Here
75
mail will be sent.  Otherwise mail is sent to the owner of the crontab.  This
75
mail will be sent.  Otherwise mail is sent to the owner of the crontab.  This
76
option is useful if you decide on /bin/mail instead of /usr/lib/sendmail as
76
option is useful if you decide on /bin/mail instead of /usr/lib/sendmail as
77
your mailer when you install cron -- /bin/mail doesn't do aliasing, and UUCP
77
your mailer when you install cron -- /bin/mail doesn't do aliasing, and UUCP
78
usually doesn't read its mail.
78
usually doesn't read its mail.  If MAILFROM is defined (and non-empty), it
79
will be used as the envelope sender address, otherwise, ``root'' will be used.
79
.PP
80
.PP
80
The format of a cron command is very much the V7 standard, with a number of
81
The format of a cron command is very much the V7 standard, with a number of
81
upward-compatible extensions.  Each line has five time and date fields,
82
upward-compatible extensions.  Each line has five time and date fields,
(-)vixie-cron-4.1/do_command.c (-4 / +13 lines)
Lines 75-81 do_command(entry *e, user *u) { Link Here
75
static void
75
static void
76
child_process(entry *e, user *u) {
76
child_process(entry *e, user *u) {
77
	int stdin_pipe[2], stdout_pipe[2];
77
	int stdin_pipe[2], stdout_pipe[2];
78
	char *input_data, *usernm, *mailto;
78
	char *input_data, *usernm, *mailto, *mailfrom;
79
	int children = 0;
79
	int children = 0;
80
	int retcode = 0;
80
	int retcode = 0;
81
81
Lines 97-102 child_process(entry *e, user *u) { Link Here
97
	 */
97
	 */
98
	usernm = e->pwd->pw_name;
98
	usernm = e->pwd->pw_name;
99
	mailto = env_get("MAILTO", e->envp);
99
	mailto = env_get("MAILTO", e->envp);
100
	mailfrom = env_get("MAILFROM", e->envp);
100
101
101
	/* our parent is watching for our death by catching SIGCHLD.  we
102
	/* our parent is watching for our death by catching SIGCHLD.  we
102
	 * do not care to watch for our children's deaths this way -- we
103
	 * do not care to watch for our children's deaths this way -- we
Lines 429-434 child_process(entry *e, user *u) { Link Here
429
				 */
430
				 */
430
				mailto = usernm;
431
				mailto = usernm;
431
			}
432
			}
433
434
			/* get sender address.  this is MAILFROM if set (and safe),
435
			 * root otherwise.
436
			 */
437
			if (!mailfrom || !*mailfrom || !safe_p(usernm, mailfrom)) {
438
				mailfrom = calloc(5, sizeof(char));
439
				strcpy(mailfrom, "root");
440
			}
432
		
441
		
433
			/* if we are supposed to be mailing, MAILTO will
442
			/* if we are supposed to be mailing, MAILTO will
434
			 * be non-NULL.  only in this case should we set
443
			 * be non-NULL.  only in this case should we set
Lines 441-457 child_process(entry *e, user *u) { Link Here
441
				char	hostname[MAXHOSTNAMELEN];
450
				char	hostname[MAXHOSTNAMELEN];
442
451
443
				gethostname(hostname, MAXHOSTNAMELEN);
452
				gethostname(hostname, MAXHOSTNAMELEN);
444
				if (strlens(MAILFMT, MAILARG, NULL) + 1
453
				if (strlens(MAILFMT, MAILARG, mailfrom, NULL) + 1
445
				    >= sizeof mailcmd) {
454
				    >= sizeof mailcmd) {
446
					fprintf(stderr, "mailcmd too long\n");
455
					fprintf(stderr, "mailcmd too long\n");
447
					(void) _exit(ERROR_EXIT);
456
					(void) _exit(ERROR_EXIT);
448
				}
457
				}
449
				(void)sprintf(mailcmd, MAILFMT, MAILARG);
458
				(void)sprintf(mailcmd, MAILFMT, MAILARG, mailfrom);
450
				if (!(mail = cron_popen(mailcmd, "w", e->pwd))) {
459
				if (!(mail = cron_popen(mailcmd, "w", e->pwd))) {
451
					perror(mailcmd);
460
					perror(mailcmd);
452
					(void) _exit(ERROR_EXIT);
461
					(void) _exit(ERROR_EXIT);
453
				}
462
				}
454
				fprintf(mail, "From: root (Cron Daemon)\n");
463
				fprintf(mail, "From: %s (Cron Daemon)\n", mailfrom);
455
				fprintf(mail, "To: %s\n", mailto);
464
				fprintf(mail, "To: %s\n", mailto);
456
				fprintf(mail, "Subject: Cron <%s@%s> %s\n",
465
				fprintf(mail, "Subject: Cron <%s@%s> %s\n",
457
					usernm, first_word(hostname, "."),
466
					usernm, first_word(hostname, "."),
(-)vixie-cron-4.1/FEATURES (+3 lines)
Lines 29-34 Features of ISC cron relative to BSD 4.[ Link Here
29
	useful if you decide on BINMAIL when configuring cron.h, since binmail
29
	useful if you decide on BINMAIL when configuring cron.h, since binmail
30
	doesn't know anything about aliasing.
30
	doesn't know anything about aliasing.
31
31
32
	MAILFROM, if set, will be used as the envelope sender address when cron
33
	mails the output of commands in that crontab.
34
32
--	Weekdays can be specified by name.  Case is not significant, but only
35
--	Weekdays can be specified by name.  Case is not significant, but only
33
	the first three letters should be specified.
36
	the first three letters should be specified.
34
37

Return to bug 192452