summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ctm
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2003-07-13 06:38:13 +0000
committerkris <kris@FreeBSD.org>2003-07-13 06:38:13 +0000
commit3c0e388f670b2d0ce9bab9e9796738d3c7fbcd7c (patch)
treeee325956216d757173d9901e27f0a251ec2cbc09 /usr.sbin/ctm
parentabf36ebac0b8b760c4e5e024a9306c4a13a3dcb6 (diff)
downloadFreeBSD-src-3c0e388f670b2d0ce9bab9e9796738d3c7fbcd7c.zip
FreeBSD-src-3c0e388f670b2d0ce9bab9e9796738d3c7fbcd7c.tar.gz
From the PR:
I am the maintainer of CTM. There is a problem that when very large deltas are created, that the program ctm_smail, which is responsible for mailing the deltas out, will instead create a single message that says the delta is too large. However, if the -q option is set, instead of placing this message in the queue (as it would have done with the deltas), it mails it out directly. This conflicts with the current working of CTM in that the email address is set as %%REPLACE-ME%% so that the created mailing pieces can be signed by gnu-pgp, and then have the mailing address changed. This fix means that if the -q option is set, and the delta is too large, the "too large" message is placed in the queue. Also, I made the "too large" message a little more up to date. Submitted by: Stephen Montgomery-Smith <stephen@math.missouri.edu> PR: bin/50328 MFC After: 2 weeks
Diffstat (limited to 'usr.sbin/ctm')
-rw-r--r--usr.sbin/ctm/ctm_smail/ctm_smail.c48
1 files changed, 38 insertions, 10 deletions
diff --git a/usr.sbin/ctm/ctm_smail/ctm_smail.c b/usr.sbin/ctm/ctm_smail/ctm_smail.c
index f86d5d0..a0dc03c 100644
--- a/usr.sbin/ctm/ctm_smail/ctm_smail.c
+++ b/usr.sbin/ctm/ctm_smail/ctm_smail.c
@@ -43,7 +43,7 @@ void write_header(FILE *sfp, char *mail_alias, char *delta, int pce,
int npieces);
void write_trailer(FILE *sfp, unsigned sum);
int apologise(char *delta, off_t ctm_size, long max_ctm_size,
- char *mail_alias);
+ char *mail_alias, char *queue_dir);
FILE *open_sendmail(void);
int close_sendmail(FILE *fp);
@@ -91,7 +91,8 @@ main(int argc, char **argv)
}
if (max_ctm_size != 0 && sb.st_size > max_ctm_size)
- status = apologise(delta, sb.st_size, max_ctm_size, mail_alias);
+ status = apologise(delta, sb.st_size, max_ctm_size, mail_alias,
+ queue_dir);
else
status = chop_and_send_or_queue(dfp, delta, sb.st_size, max_msg_size,
mail_alias, queue_dir);
@@ -405,13 +406,29 @@ write_trailer(FILE *sfp, unsigned sum)
* Returns 0 on success, 1 on failure.
*/
int
-apologise(char *delta, off_t ctm_size, long max_ctm_size, char *mail_alias)
+apologise(char *delta, off_t ctm_size, long max_ctm_size, char *mail_alias,
+ char *queue_dir)
{
FILE *sfp;
+ char qname[PATH_MAX];
+
+ if (queue_dir == NULL)
+ {
+ sfp = open_sendmail();
+ if (sfp == NULL)
+ return 1;
+ }
+ else
+ {
+ mk_queue_name(qname, queue_dir, delta, 1, 1);
+ sfp = fopen(qname, "w");
+ if (sfp == NULL)
+ {
+ err("cannot open '%s' for writing", qname);
+ return 1;
+ }
+ }
- sfp = open_sendmail();
- if (sfp == NULL)
- return 1;
fprintf(sfp, "From: owner-%s\n", mail_alias);
fprintf(sfp, "To: %s\n", mail_alias);
@@ -419,11 +436,22 @@ apologise(char *delta, off_t ctm_size, long max_ctm_size, char *mail_alias)
fprintf(sfp, "%s is %ld bytes. The limit is %ld bytes.\n\n", delta,
(long)ctm_size, max_ctm_size);
- fprintf(sfp, "You can retrieve this delta via ftpmail, "
- "or your good mate at the university.\n");
+ fprintf(sfp, "You can retrieve this delta via ftp.\n");
- if (!close_sendmail(sfp))
- return 1;
+ if (queue_dir == NULL)
+ {
+ if (!close_sendmail(sfp))
+ return 1;
+ }
+ else
+ {
+ if (fclose(sfp)!=0)
+ {
+ err("error writing '%s'", qname);
+ unlink(qname);
+ return 1;
+ }
+ }
return 0;
}
OpenPOWER on IntegriCloud