Mail Archives: cygwin/2001/04/11/21:18:58
--cpCa7IGIJo/sVpXY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Corinna,
On Wed, Apr 11, 2001 at 10:30:13AM +0200, Corinna Vinschen wrote:
> On Tue, Apr 10, 2001 at 06:53:27PM -0700, Enoch Wu wrote:
> > Hi Corinna & all,
> >
> > I am "uploading" the patch to add something like:
> >
> > MailHub=mail.domain.com:2525
> >
> > in /etc/ssmtp/ssmtp.conf
> >
> > root:id AT domain DOT com:mail.domain.com:2525
> >
> > in /etc/ssmtp/revaliases
>
> Thanks for your effort!
>
> However, I have a minor nit:
>
> In function parseConfig():
>
> > + if ((r = strtok (NULL, "= \t\n:")) != NULL) PortNum = atoi(strdup(r));
>
> I think the strdup isn't needed here. May I suggest asking for PortNum=0
> afterwards and resetting it to PORTNUMBER, if so? Just to be a bit
> fault-tolerant.
Done.
> And there's a small error:
>
> > + log_event (LOG_INFO,
> > + "via SMTP Port Number=\"%s\".\n", PortNum);
>
> You're using "%s" for a integer variable here. Shouldn't that be "%d"?
> The same in getReverseAliases():
>
> > + log_event (LOG_INFO,
> > + "via SMTP Port Number=\"%s\".\n", PortNum);
>
All done.
> Could you please resubmit the patch? I will create a new ssmtp release
> then. Are you willing to send your patch to the ssmtp maintainer
> (Matt Ryan <matt AT banana DOT org DOT uk>) as well?
Yes. The new patch is attached to this e-mail.
EW
>
> Thank you,
> Corinna
>
> --
> Corinna Vinschen Please, send mails regarding Cygwin to
> Cygwin Developer mailto:cygwin AT cygwin DOT com
> Red Hat, Inc.
>
--cpCa7IGIJo/sVpXY
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=
--cpCa7IGIJo/sVpXY
Content-Type: text/plain; charset=us-ascii
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
--cpCa7IGIJo/sVpXY--
- Raw text -