|
From: Matthias A. <mat...@gm...> - 2005-11-10 03:27:42
|
Matthias Andree <mat...@gm...> writes:
> Sunil Shetye <sh...@bo...> writes:
>
>> smtp servers (on all non-server machines) listen on the loopback
>> interface (i.e. 127.0.0.1) only. However, fetchmail release 6.2.9-rc7,
>> by default, attempts to connect to the IP address obtained from
>> gethostname(), which typically points to the external interface. Thus,
>> fetchmail is no longer able to deliver mails by default!
>>
>> The problem is that fetchmailhost is overloaded to contain the
>> domainname to be used for HELO/EHLO and for rcpt address and also to
>> contain the default SMTP host. Previously, it was localhost, but
>> after changes in r4382, it became the actual hostname. For smtp
>> servers listening on localhost only, mail delivery consequently fails.
>>
>> This patch should fix this broken behaviour.
>
> Thanks, applied for upcoming -rc8.
Actually we need to set fetchmailhost when Kerberos is used, to match
documentation somewhat, so I'll use this:
Index: fetchmail.c
===================================================================
--- fetchmail.c (Revision 4390)
+++ fetchmail.c (Arbeitskopie)
@@ -922,7 +922,7 @@
* - false if servers found on the command line */
static int load_params(int argc, char **argv, int optind)
{
- int implicitmode, st;
+ int implicitmode, st, use_kerberos;
struct passwd *pw;
struct query def_opts, *ctl;
struct stat rcstat;
@@ -1070,18 +1070,20 @@
* If we're using Kerberos for authentication, we need
* the FQDN in order to generate capability keys.
*/
+ use_kerberos = 0;
+ /* use_kerberos is saved until later to properly set the invisible
+ * --smtphost (aka. smtphunt) default */
for (ctl = querylist; ctl; ctl = ctl->next)
if (ctl->active &&
(ctl->server.protocol==P_ETRN || ctl->server.protocol==P_ODMR
|| ctl->server.authenticate == A_KERBEROS_V4
|| ctl->server.authenticate == A_KERBEROS_V5))
{
- fetchmailhost = host_fqdn(1);
+ use_kerberos = 1;
break;
}
- if (!ctl) /* list exhausted */
- fetchmailhost = host_fqdn(0);
+ fetchmailhost = host_fqdn(use_kerberos);
/* this code enables flags to be turned off */
#define DEFAULT(flag, dflt) if (flag == FLAG_TRUE)\
@@ -1156,7 +1158,7 @@
* Make sure we have a nonempty host list to forward to.
*/
if (!ctl->smtphunt)
- save_str(&ctl->smtphunt, fetchmailhost, FALSE);
+ save_str(&ctl->smtphunt, use_kerberos ? fetchmailhost : "localhost", FALSE);
/*
* Make sure we have a nonempty list of domains to fetch from.
The manual page is outdated, it maunders something about invisible
defaults, but I haven't seen those in the code, it's a regular
default. And it does not only apply to Kerberos auth but also to
ODMR/ETRN polls... so I'll revise the manual page to match this
ODMR/ETRN code.
--
Matthias Andree
|