savemail.c (203004) | savemail.c (244833) |
---|---|
1/* 2 * Copyright (c) 1998-2003, 2006 Sendmail, Inc. and its suppliers. 3 * All rights reserved. 4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. 5 * Copyright (c) 1988, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * By using this file, you agree to the terms and conditions set 9 * forth in the LICENSE file which can be found at the top level of 10 * the sendmail distribution. 11 * 12 */ 13 14#include <sendmail.h> 15 | 1/* 2 * Copyright (c) 1998-2003, 2006 Sendmail, Inc. and its suppliers. 3 * All rights reserved. 4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. 5 * Copyright (c) 1988, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * By using this file, you agree to the terms and conditions set 9 * forth in the LICENSE file which can be found at the top level of 10 * the sendmail distribution. 11 * 12 */ 13 14#include <sendmail.h> 15 |
16SM_RCSID("@(#)$Id: savemail.c,v 8.314 2009/12/18 17:08:01 ca Exp $") | 16SM_RCSID("@(#)$Id: savemail.c,v 8.315 2012/02/27 17:43:03 gshapiro Exp $") |
17 18static bool errbody __P((MCI *, ENVELOPE *, char *)); 19static bool pruneroute __P((char *)); 20 21/* 22** SAVEMAIL -- Save mail on error 23** 24** If mailing back errors, mail it back to the originator --- 476 unchanged lines hidden (view full) --- 501 502int 503returntosender(msg, returnq, flags, e) 504 char *msg; 505 ADDRESS *returnq; 506 int flags; 507 register ENVELOPE *e; 508{ | 17 18static bool errbody __P((MCI *, ENVELOPE *, char *)); 19static bool pruneroute __P((char *)); 20 21/* 22** SAVEMAIL -- Save mail on error 23** 24** If mailing back errors, mail it back to the originator --- 476 unchanged lines hidden (view full) --- 501 502int 503returntosender(msg, returnq, flags, e) 504 char *msg; 505 ADDRESS *returnq; 506 int flags; 507 register ENVELOPE *e; 508{ |
509 int ret; |
|
509 register ENVELOPE *ee; 510 ENVELOPE *oldcur = CurEnv; 511 ENVELOPE errenvelope; 512 static int returndepth = 0; 513 register ADDRESS *q; 514 char *p; 515 char buf[MAXNAME + 1]; 516 --- 181 unchanged lines hidden (view full) --- 698 macdefine(&ee->e_macro, A_PERM, 'x', "Mail Delivery Subsystem"); 699 eatheader(ee, true, true); 700 701 /* mark statistics */ 702 markstats(ee, NULLADDR, STATS_NORMAL); 703 704 /* actually deliver the error message */ 705 sendall(ee, SM_DELIVER); | 510 register ENVELOPE *ee; 511 ENVELOPE *oldcur = CurEnv; 512 ENVELOPE errenvelope; 513 static int returndepth = 0; 514 register ADDRESS *q; 515 char *p; 516 char buf[MAXNAME + 1]; 517 --- 181 unchanged lines hidden (view full) --- 699 macdefine(&ee->e_macro, A_PERM, 'x', "Mail Delivery Subsystem"); 700 eatheader(ee, true, true); 701 702 /* mark statistics */ 703 markstats(ee, NULLADDR, STATS_NORMAL); 704 705 /* actually deliver the error message */ 706 sendall(ee, SM_DELIVER); |
706 707 /* restore state */ | |
708 (void) dropenvelope(ee, true, false); | 707 (void) dropenvelope(ee, true, false); |
709 sm_rpool_free(ee->e_rpool); 710 CurEnv = oldcur; 711 returndepth--; | |
712 713 /* check for delivery errors */ | 708 709 /* check for delivery errors */ |
710 ret = -1; |
|
714 if (ee->e_parent == NULL || 715 !bitset(EF_RESPONSE, ee->e_parent->e_flags)) | 711 if (ee->e_parent == NULL || 712 !bitset(EF_RESPONSE, ee->e_parent->e_flags)) |
716 return 0; 717 for (q = ee->e_sendqueue; q != NULL; q = q->q_next) | |
718 { | 713 { |
719 if (QS_IS_ATTEMPTED(q->q_state)) 720 return 0; | 714 ret = 0; |
721 } | 715 } |
722 return -1; | 716 else 717 { 718 for (q = ee->e_sendqueue; q != NULL; q = q->q_next) 719 { 720 if (QS_IS_ATTEMPTED(q->q_state)) 721 { 722 ret = 0; 723 break; 724 } 725 } 726 } 727 728 /* restore state */ 729 sm_rpool_free(ee->e_rpool); 730 CurEnv = oldcur; 731 returndepth--; 732 733 return ret; |
723} | 734} |
735 |
|
724/* 725** ERRBODY -- output the body of an error message. 726** 727** Typically this is a copy of the transcript plus a copy of the 728** original offending message. 729** 730** Parameters: 731** mci -- the mailer connection information. --- 1030 unchanged lines hidden --- | 736/* 737** ERRBODY -- output the body of an error message. 738** 739** Typically this is a copy of the transcript plus a copy of the 740** original offending message. 741** 742** Parameters: 743** mci -- the mailer connection information. --- 1030 unchanged lines hidden --- |