[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [leafnode-list] fqdn validation



Mark Brown <broonie@xxxxxxxxxxxxx> writes:

> On Sat, Apr 13, 2002 at 01:36:18PM +0200, Matthias Andree wrote:
>
>> I don't want to surprise new users who lurk at first and have then
>> leafnode refuse work when they first post two weeks later, so I'm
>> checking all the time. This saves us any "cannot post" support hassles,
>> and it's easy to detect and to fix. No questions asked.
>
> Instead you're getting pointless "can't start" support issues that are
> solving problems that don't exist with many clients.  

Well, if the user is forced to fix its system, he'll likely also fix the
Message-ID as created by the newsreader.

> It would at least be useful to improve the diagnostic message to
> explain what the problem is a bit more clearly.

Maybe. I believe the Red Hat madness is fixed in my current source, next
would be to fix the Debian madness, I presume :->

> Another approach would be to drop the check and form the message ID
> based on the domain used in the From: address in the message.  This is
> the approach most systems that want to come up with a message ID but
> can't get a hostname seem to use and ought to be effective enough.

It would prevent Netscape users from getting a proper Message-ID,
because leafnode would just copy the Netscape bug. Netscape does as you
suggest, and it's plain wrong: <123.456789@xxxxxxxxxxx> (Netscape) is
just as wrong as <321.987654.ln@xxxxxxxxxxx> would be.

People, please don't waste my time with this nonsense. If there's a
problem with the default install, then let me know if you feel it's a
leafnode bug, or fix your default install. I thought about this long
enough.

Anyways, if you want to play with the current version and check if that
fixes the "leafnode refuses work in my default install" issues, here's
the patch against 1.9.21. To debug, run the respective leafnode program
(texpire will to) like this:

sudo env LN_DEBUG_QUALIFICATION=1 /usr/local/sbin/texpire -vvv

Feedback by Red Hat and Debian downstream maintainers solicited.


Index: miscutil.c
===================================================================
RCS file: /home/emma/mycvsroot/leafnode-1/miscutil.c,v
retrieving revision 1.15
diff -u -r1.15 miscutil.c
--- miscutil.c	2002/04/05 19:03:34	1.15
+++ miscutil.c	2002/04/13 11:38:26
@@ -275,17 +275,33 @@
 whoami(void)
 {
     struct hostent *he;
+    int debugqual = 0;
+    char *x;
 
+    if ((x = getenv("LN_DEBUG_QUALIFICATION")) != NULL
+	&& *x)
+	debugqual = 1;
+
     if (!gethostname(fqdn, 255) && (he = gethostbyname(fqdn)) != NULL) {
-	strncpy(fqdn, he->h_name, 255);
-	if (strchr(fqdn, '.') == NULL) {
+	fqdn[0] = '\0';
+	strncat(fqdn, he->h_name, 255);
+	if (debugqual) syslog(LOG_DEBUG, "canonical hostname: %s", fqdn);
+	if (strchr(fqdn, '.') == NULL
+	    || 0 == strncasecmp(fqdn, "localhost", 9)) {
 	    char **alias;
 	    alias = he->h_aliases;
-	    while (alias && *alias)
-		if (strchr(*alias, '.') && (strlen(*alias) > strlen(fqdn)))
-		    strncpy(fqdn, *alias, 255);
-		else
+	    while (alias && *alias) {
+		if (debugqual) {
+		    syslog(LOG_DEBUG, "alias for my hostname: %s", *alias);
+		}
+		if (strchr(*alias, '.') && 
+		    (0 != strncasecmp(*alias, "localhost", 9))) {
+		    fqdn[0] = '\0';
+		    strncat(fqdn, *alias, 255);
+		    break;
+		} else
 		    alias++;
+	    }
 	}
     }
 }


-- 
Matthias Andree

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list