This patch does the same for nullmailer-inject. To the best of my knowledge, Return-Path is always the most recent sender. So if we're taking the envelope from the existing headers then Return-Path should be still used, even where there is a Resent-From.
But - sorry Norbert, I just realised I haven't tested the cases where the Return-Path is <>, so please hold off on these until I get the chance. Nick
--- nullmailer-1.02/src/inject.cc.orig 2005-11-10 16:11:12.000000000 +0000 +++ nullmailer-1.02/src/inject.cc 2006-03-11 17:54:29.000000000 +0000 @@ -100,6 +100,7 @@ /////////////////////////////////////////////////////////////////////////////// static slist recipients; static mystring sender; +static bool use_header_sender = true; static bool use_header_recips = true; void parse_recips(const mystring& list) @@ -165,7 +166,8 @@ return true; if(is_resent) { if(!header_is_resent) { - sender = ""; + // if(use_header_sender) // There is no Resent-Return-Path + // sender = ""; if(use_header_recips) recipients.empty(); } @@ -187,7 +189,7 @@ parse_recips(list); } else if(is_sender) { - if(is_resent == header_is_resent && !sender) + if(is_resent == header_is_resent && use_header_sender) parse_sender(list); } } @@ -282,7 +284,7 @@ if(!shost) shost = host; canonicalize(shost); - if(!sender) + if(use_header_sender && !sender) sender = suser + "@" + shost; } @@ -542,11 +544,13 @@ if(o_from) { mystring list; mystring tmp(o_from); - if(!parse_addresses(tmp, list) || - !parse_sender(list)) { + if(tmp != "" && + (!parse_addresses(tmp, list) || + !parse_sender(list))) { fout << "nullmailer-inject: Invalid sender address: " << o_from << endl; return false; } + use_header_sender = false; } use_header_recips = (use_recips != use_args); if(use_recips == use_header)