# HG changeset patch # User carl # Date 1142024107 28800 # Node ID ed73e6361570e9f48ce4cb3b6b46a853ca08a476 # Parent 5241a079fe0371d031f27e928c95d7d9cb14c5b5 initial version diff -r 5241a079fe03 -r ed73e6361570 src/sm-archive.cpp --- a/src/sm-archive.cpp Fri Mar 10 12:26:37 2006 -0800 +++ b/src/sm-archive.cpp Fri Mar 10 12:55:07 2006 -0800 @@ -88,7 +88,6 @@ pthread_mutex_unlock(&config_mutex); mailaddr = NULL; queueid = NULL; - processed_from = false; } mlfiPriv::~mlfiPriv() { @@ -99,7 +98,7 @@ } void mlfiPriv::reset(bool final) { - processed_from = false; + targets.clear(); if (mailaddr) free(mailaddr); if (queueid) free(queueid); if (!final) { @@ -176,16 +175,12 @@ return SMFIS_CONTINUE; } -void add_target(mlfiPriv &priv, SMFICTX *ctx, char *target); -void add_target(mlfiPriv &priv, SMFICTX *ctx, char *target) +void add_target(mlfiPriv &priv, char *target); +void add_target(mlfiPriv &priv, char *target) { if (target) { - smfi_addrcpt(ctx, target); - if (debug_syslog > 1) { - char msg[maxlen]; - snprintf(msg, sizeof(msg), "adding recipient <%s>", target); - my_syslog(&priv, msg); - } + string_set::iterator i = priv.targets.find(target); + if (i == priv.targets.end()) priv.targets.insert(target); } } @@ -201,18 +196,26 @@ my_syslog(&priv, msg); } char *target = dc.find_to(rcptaddr); - add_target(priv, ctx, target); free(rcptaddr); - if (!priv.processed_from) { - target = dc.find_from(priv.mailaddr); - add_target(priv, ctx, target); - priv.processed_from = true; - } + add_target(priv, target); return SMFIS_CONTINUE; } sfsistat mlfi_eom(SMFICTX *ctx) { + mlfiPriv &priv = *MLFIPRIV; + CONFIG &dc = *priv.pc; + char *target = dc.find_from(priv.mailaddr); + add_target(priv, target); + for (string_set::iterator i=priv.targets.begin(); i!=priv.targets.end(); i++) { + target = (*i); + smfi_addrcpt(ctx, target); + if (debug_syslog > 1) { + char msg[maxlen]; + snprintf(msg, sizeof(msg), "adding recipient <%s>", target); + my_syslog(&priv, msg); + } + } // reset for a new message on the same connection mlfi_abort(ctx); return SMFIS_CONTINUE; diff -r 5241a079fe03 -r ed73e6361570 src/sm-archive.h --- a/src/sm-archive.h Fri Mar 10 12:26:37 2006 -0800 +++ b/src/sm-archive.h Fri Mar 10 12:55:07 2006 -0800 @@ -15,7 +15,7 @@ // message specific data char *mailaddr; // envelope from value char *queueid; // sendmail queue id - bool processed_from; // looked at env_from address + string_set targets; // targets to add at eom, strings are owned by the config mlfiPriv(); ~mlfiPriv(); void reset(bool final = false); // for a new message