Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Wed, 11 Apr 2001 20:11:08 -0700 From: Enoch Wu To: Matt Ryan Cc: Corinna Vinschen Subject: Patch for PortNumber in sSMTP available Message-ID: <20010411201108.A4053139@MELON> Reply-To: Enoch Wu Mail-Followup-To: Enoch Wu , Matt Ryan , Corinna Vinschen Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="YQTuo6O0h32glFlO" Content-Disposition: inline User-Agent: Mutt/1.2.5i X-Mailer: Mutt 1.2.5i X-Operating-System: CYGWIN_98-4.10 1.1.8(0.34/3/2) i586 X-Sender: ewu AT eskimo DOT com --YQTuo6O0h32glFlO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello Matt, I have added a patch to allow configuration of port number 2525 for example, MailHub=mail.domain.com:2525 within /etc/ssmtp/ssmtp.conf Please consider including the patch to the sSMTP distribution. Enoch Wu Attachment: the patch --YQTuo6O0h32glFlO Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ssmtp-2.38.7-portnum.diff" diff -p -N -d -r -u2 orig/ssmtp-2.38.7/generate_config cygp/ssmtp-2.38.7/generate_config --- orig/ssmtp-2.38.7/generate_config Wed Mar 7 06:38:10 2001 +++ cygp/ssmtp-2.38.7/generate_config Tue Apr 10 18:08:22 2001 @@ -32,4 +32,14 @@ echo -n "Please enter the full qualified read mailhub +portnumber=25 +echo -n "Please enter the smtp port number [$portnumber]: " +read smtpport +if [ ! "$smtpport" ]; then + mailhub=$mailhub +else + mailhub="$mailhub:$smtpport" +fi + + # # Generate configuration file diff -p -N -d -r -u2 orig/ssmtp-2.38.7/revaliases cygp/ssmtp-2.38.7/revaliases --- orig/ssmtp-2.38.7/revaliases Thu Feb 24 06:26:26 2000 +++ cygp/ssmtp-2.38.7/revaliases Tue Apr 10 18:08:22 2001 @@ -3,3 +3,4 @@ # Format: local_account:outgoing_address:mailhub # -# Example: root:your_login AT your DOT domain:mailhub.your.domain +# Example: root:your_login AT your DOT domain:mailhub.your.domain:[port] +# where [port] is an optional port number that defaults to 25. diff -p -N -d -r -u2 orig/ssmtp-2.38.7/ssmtp.c cygp/ssmtp-2.38.7/ssmtp.c --- orig/ssmtp-2.38.7/ssmtp.c Tue Aug 29 04:07:28 2000 +++ cygp/ssmtp-2.38.7/ssmtp.c Wed Apr 11 10:32:24 2001 @@ -48,4 +48,5 @@ char *Version = VERSION; /* The version char *ProgName = NULL; /* It's name. */ char *MailHub = MAILHUB; /* The place to send the mail. */ +int PortNum = 0; /* The sysadmin assigned smtp port number. */ char HostName[MAXLINE]; /* Our name, unless overridden. */ #ifdef REWRITE_DOMAIN @@ -723,5 +724,5 @@ void parseConfig (FILE * fp) { - char line[MAXLINE], *p, *q; + char line[MAXLINE], *p, *q, *r; while (fgets (line, sizeof line, fp)) @@ -737,5 +738,5 @@ parseConfig (FILE * fp) /* Parse out keywords. */ if (((p = strtok (line, "= \t\n")) != NULL) - && ((q = strtok (NULL, "= \t\n")) != NULL)) + && ((q = strtok (NULL, "= \t\n:")) != NULL)) { if (strcasecmp (p, "Root") == 0) @@ -751,8 +752,14 @@ parseConfig (FILE * fp) { MailHub = strdup (q); + PortNum = 0; + if ((r = strtok (NULL, "= \t\n:")) != NULL) PortNum = atoi(r); + if (PortNum == 0) PortNum = PORTNUMBER; if (LogLevel > 0) { log_event (LOG_INFO, "Set MailHub=\"%s\".\n", MailHub); + log_event (LOG_INFO, + "via SMTP Port Number=\"%d\".\n", PortNum); + } } @@ -839,5 +846,5 @@ getReverseAliases () FILE *rev_file; static char buffer[MAXLINE]; - char line[MAXLINE], *p; + char line[MAXLINE], *p, *r; /* Try to open the reverse aliases file */ rev_file = fopen (REVALIASES_FILE, "r"); @@ -868,12 +875,17 @@ getReverseAliases () fromLine = strdup (buffer); } - p = strtok (NULL, " \t\r\n"); + p = strtok (NULL, " \t\r\n:"); if (p) { MailHub = strdup (p); + PortNum = 0; + if ((r = strtok (NULL, " \t\r\n:")) != NULL) PortNum = atoi(r); + if (PortNum == 0) PortNum = PORTNUMBER; if (LogLevel > 0) { log_event (LOG_INFO, "Set MailHub=\"%s\".\n", MailHub); + log_event (LOG_INFO, + "via SMTP Port Number=\"%d\".\n", PortNum); } } @@ -1174,8 +1186,8 @@ ssmtp (char *argv[]) die ("connection lost in middle of processing, exiting."); } - if ((fd = openSocket (MailHub, PORTNUMBER)) == ERR) + if ((fd = openSocket (MailHub, PortNum)) == ERR) { die ("can't open the smtp port (%d) on %s.", - PORTNUMBER, MailHub); + PortNum, MailHub); } else if (getOkFromSmtp (fd, buffer) == NO) diff -p -N -d -r -u2 orig/ssmtp-2.38.7/ssmtp.conf cygp/ssmtp-2.38.7/ssmtp.conf --- orig/ssmtp-2.38.7/ssmtp.conf Thu Feb 24 06:26:26 2000 +++ cygp/ssmtp-2.38.7/ssmtp.conf Tue Apr 10 18:08:22 2001 @@ -11,4 +11,10 @@ root=postmaster mailhub=mail +# Example for SMTP port number 2525 +# MailHub=mail.your.domain:2525 + +# Example for SMTP port number 25 (RFC) +# MailHub=mail.your.domain + # Where will the mail seem to come from? rewriteDomain= --YQTuo6O0h32glFlO Content-Type: text/plain; charset=us-ascii -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple --YQTuo6O0h32glFlO--