This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch portnumber for sSMTP


Hi Corinna & all,

I am "uploading" the patch to add something like:

MailHub=mail.domain.com:2525 

in /etc/ssmtp/ssmtp.conf

root:id@domain.com:mail.domain.com:2525

in /etc/ssmtp/revaliases

------cut here ----------------------------------

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	Mon Apr  9 21:30:00 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	Mon Apr  9 21:30:00 2001
@@ -3,3 +3,4 @@
 # Format:	local_account:outgoing_address:mailhub
 #
-# Example: root:your_login@your.domain:mailhub.your.domain
+# Example: root:your_login@your.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:26 2000
+++ cygp/ssmtp-2.38.7/ssmtp.c	Mon Apr  9 21:30:00 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 = PORTNUMBER;       /* 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,12 @@ parseConfig (FILE * fp)
 	    {
 	      MailHub = strdup (q);
+              if ((r = strtok (NULL, "= \t\n:")) != NULL) PortNum = atoi(strdup(r));
 	      if (LogLevel > 0)
 		{
 		  log_event (LOG_INFO,
 			     "Set MailHub=\"%s\".\n", MailHub);
+		  log_event (LOG_INFO,
+			     "via SMTP Port Number=\"%s\".\n", PortNum);
+                  
 		}
 	    }
@@ -839,5 +844,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 +873,15 @@ getReverseAliases ()
 		  fromLine = strdup (buffer);
 		}
-	      p = strtok (NULL, " \t\r\n");
+	      p = strtok (NULL, " \t\r\n:");
 	      if (p)
 	        {
 	          MailHub = strdup (p);
+		  if ((r = strtok (NULL, " \t\r\n:")) != NULL) PortNum = atoi(strdup(r));
 	          if (LogLevel > 0)
 		    {
 		      log_event (LOG_INFO,
 			         "Set MailHub=\"%s\".\n", MailHub);
+		      log_event (LOG_INFO,
+			         "via SMTP Port Number=\"%s\".\n", PortNum);
 		    }
 	        }
@@ -1174,8 +1182,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	Mon Apr  9 21:30:00 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=

----cut here ---- end of patch ----

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]