Skip to content

Commit

Permalink
Fix for handling empty senders in forward mode
Browse files Browse the repository at this point in the history
git-svn-id: svn://localhost/home/matthias/source/svn/matthias_wimmer@182 4ea7d500-c7de-0310-95d6-fef3d14ee6ae
  • Loading branch information
matthias committed Mar 21, 2008
1 parent fbeba69 commit 40ced4e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
2007-03-26 Matthias Wimmer <[email protected]>

* couriersrs.cc: Fixed handling for forward bounces
6 changes: 6 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
couriersrs 0.1.1
================

Fixed handling of empty sender addresses in forward operation mode.
couriersrs did not accept such mails in version 0.1.0. They are now
forwarded by keeping the empty sender address.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
AC_PREREQ(2.50)

AC_INIT(couriersrs.h)
AM_INIT_AUTOMAKE(couriersrs,0.1.0)
AM_INIT_AUTOMAKE(couriersrs,0.1.1)
AM_CONFIG_HEADER(config.h)
AC_LANG(C++)
AC_GNU_SOURCE
Expand Down
19 changes: 12 additions & 7 deletions couriersrs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ int main(int argc, char const** argv) {
// forward or reverse operation?
if (!reverse) {
// check addresses are present
if (!sender || !sender[0]) {
if (!sender) {
std::cout << N_("Sender address could not be determined.") << std::endl;
return 1;
}
Expand All @@ -247,12 +247,17 @@ int main(int argc, char const** argv) {
size_t buffer_size = std::string(sender).length()+std::string(srsdomain).length()+65;
char *buffer = new char[buffer_size];

// rewrite address
ret = srs_forward(srs, buffer, buffer_size, sender, srsdomain);
if (ret != SRS_SUCCESS) {
delete buffer;
std::cout << N_("Could not rewrite address in forward mode: ") << srs_strerror(ret) << std::endl;
return 1;
// empty sender address? (bounce mail)
if (!sender[0]) {
buffer[0] = 0;
} else {
// rewrite address
ret = srs_forward(srs, buffer, buffer_size, sender, srsdomain);
if (ret != SRS_SUCCESS) {
delete buffer;
std::cout << N_("Could not rewrite address in forward mode: ") << srs_strerror(ret) << std::endl;
return 1;
}
}

// Create 'Delivered-To' header
Expand Down

0 comments on commit 40ced4e

Please sign in to comment.