diff options
-rw-r--r-- | mail/mini_sendmail/distinfo | 4 | ||||
-rw-r--r-- | mail/mini_sendmail/patches/patch-aa | 112 |
2 files changed, 109 insertions, 7 deletions
diff --git a/mail/mini_sendmail/distinfo b/mail/mini_sendmail/distinfo index 35e7437739a..735ce3cd515 100644 --- a/mail/mini_sendmail/distinfo +++ b/mail/mini_sendmail/distinfo @@ -1,9 +1,9 @@ -$NetBSD: distinfo,v 1.8 2005/06/29 22:01:19 is Exp $ +$NetBSD: distinfo,v 1.9 2006/06/15 20:52:05 martin Exp $ SHA1 (mini_sendmail-1.3.6.tar.gz) = e8d18419ffa5075ce0b3f49a52bd5e1a38beeb02 RMD160 (mini_sendmail-1.3.6.tar.gz) = 87fc1133c5976ae6e85730d3600149f69c7cab55 Size (mini_sendmail-1.3.6.tar.gz) = 7579 bytes -SHA1 (patch-aa) = 56901f315b6894a7bb1900d68a6da81b936fcd48 +SHA1 (patch-aa) = ac860c3eebb04549b1998b98d7ea6c761f83ad3d SHA1 (patch-ab) = f96d22be2f94445a6f8b249cdd823dcfbd1528de SHA1 (patch-ac) = b14f2687f3186e198af03b2662b81726c7321558 SHA1 (patch-ad) = 35319baaf3eac9dd931170ed4e6d638a19fff8b5 diff --git a/mail/mini_sendmail/patches/patch-aa b/mail/mini_sendmail/patches/patch-aa index 31887615ccf..f8d80f13519 100644 --- a/mail/mini_sendmail/patches/patch-aa +++ b/mail/mini_sendmail/patches/patch-aa @@ -1,8 +1,65 @@ -$NetBSD: patch-aa,v 1.7 2005/06/29 22:01:19 is Exp $ +$NetBSD: patch-aa,v 1.8 2006/06/15 20:52:05 martin Exp $ --- mini_sendmail.c.orig 2005-06-29 19:37:15.000000000 +0200 -+++ mini_sendmail.c -@@ -134,6 +134,8 @@ main( int argc, char** argv ) ++++ mini_sendmail.c 2006-06-15 22:42:04.000000000 +0200 +@@ -66,8 +66,13 @@ static char* argv0; + static char* fake_from; + static int parse_message, verbose; + #ifdef DO_MINUS_SP +-static char* server; + static short port; ++struct server_entry { ++ const char *server; ++ short port; ++ struct server_entry *next; ++}; ++struct server_entry *servers; + #endif /* DO_MINUS_SP */ + static int timeout; + static int sockfd1, sockfd2; +@@ -84,7 +89,7 @@ static char* make_received( char* from, + #endif /* DO_RECEIVED */ + static void parse_for_recipients( char* message ); + static void add_recipient( char* recipient, int len ); +-static int open_client_socket( void ); ++static int open_client_socket( const char *server, short port ); + static int read_response( void ); + static void send_command( char* command ); + static void send_data( char* data ); +@@ -106,13 +111,15 @@ main( int argc, char** argv ) + char from[1000]; + int status; + char buf[2000]; ++#ifdef DO_MINUS_SP ++ struct server_entry *cur_server; ++#endif + + /* Parse args. */ + argv0 = argv[0]; + fake_from = (char*) 0; + parse_message = 0; + #ifdef DO_MINUS_SP +- server = "127.0.0.1"; + port = SMTP_PORT; + #endif /* DO_MINUS_SP */ + verbose = 0; +@@ -125,15 +132,21 @@ main( int argc, char** argv ) + else if ( strcmp( argv[argn], "-t" ) == 0 ) + parse_message = 1; + #ifdef DO_MINUS_SP +- else if ( strncmp( argv[argn], "-s", 2 ) == 0 && argv[argn][2] != '\0' ) +- server = &(argv[argn][2]); +- else if ( strncmp( argv[argn], "-p", 2 ) == 0 && argv[argn][2] != '\0' ) ++ else if ( strncmp( argv[argn], "-s", 2 ) == 0 && argv[argn][2] != '\0' ) { ++ cur_server = malloc(sizeof(struct server_entry)); ++ cur_server->server = &(argv[argn][2]); ++ cur_server->port = port; ++ cur_server->next = servers; ++ servers = cur_server; ++ } else if ( strncmp( argv[argn], "-p", 2 ) == 0 && argv[argn][2] != '\0' ) + port = atoi( &(argv[argn][2]) ); + #endif /* DO_MINUS_SP */ + else if ( strncmp( argv[argn], "-T", 2 ) == 0 && argv[argn][2] != '\0' ) timeout = atoi( &(argv[argn][2]) ); else if ( strcmp( argv[argn], "-v" ) == 0 ) verbose = 1; @@ -11,7 +68,30 @@ $NetBSD: patch-aa,v 1.7 2005/06/29 22:01:19 is Exp $ else if ( strcmp( argv[argn], "-i" ) == 0 ) ; /* ignore */ else if ( strcmp( argv[argn], "-oi" ) == 0 ) -@@ -507,14 +509,24 @@ parse_for_recipients( char* message ) +@@ -186,8 +199,21 @@ main( int argc, char** argv ) + + (void) signal( SIGALRM, sigcatch ); + ++ if (!servers) { ++ static const char default_server[] = "127.0.0.1"; ++ servers = malloc(sizeof(struct server_entry)); ++ servers->server = default_server; ++ servers->port = port; ++ servers->next = NULL; ++ } ++ + (void) alarm( timeout ); +- sockfd1 = open_client_socket(); ++ for (cur_server = servers; cur_server; cur_server = cur_server->next) { ++ sockfd1 = open_client_socket(cur_server->server, cur_server->port); ++ if (sockfd1 >= 0) break; ++ } ++ if (sockfd1 == -1) ++ show_error("could not open SMTP socket"); + + sockfd2 = dup( sockfd1 ); + sockrfp = fdopen( sockfd1, "r" ); +@@ -507,14 +533,24 @@ parse_for_recipients( char* message ) switch ( *cp ) { case '\n': @@ -43,7 +123,7 @@ $NetBSD: patch-aa,v 1.7 2005/06/29 22:01:19 is Exp $ } break; case ',': -@@ -532,25 +544,46 @@ static void +@@ -532,25 +568,46 @@ static void add_recipient( char* recipient, int len ) { char buf[1000]; @@ -97,3 +177,25 @@ $NetBSD: patch-aa,v 1.7 2005/06/29 22:01:19 is Exp $ send_command( buf ); status = read_response(); if ( status != 250 && status != 251 ) +@@ -569,7 +626,7 @@ add_recipient( char* recipient, int len + #endif + + static int +-open_client_socket( void ) ++open_client_socket(const char *server, short port) + { + #ifdef USE_IPV6 + struct sockaddr_in6 sa; +@@ -744,10 +801,10 @@ open_client_socket( void ) + + sockfd = socket( sock_family, sock_type, sock_protocol ); + if ( sockfd < 0 ) +- show_error( "socket" ); ++ return -1; + + if ( connect( sockfd, (struct sockaddr*) &sa, sa_len ) < 0 ) +- show_error( "connect" ); ++ return -1; + + return sockfd; + } |