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
This commit is contained in:
Kris Kennaway 2003-07-13 06:38:13 +00:00
parent 654cbf38df
commit c836afc395
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=117503

View File

@ -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;
}