Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!ucsd!brian From: brian@ucsd.Edu (Brian Kantor) Newsgroups: comp.mail.sendmail Subject: Re: Problem with MXs in Sun sendmail Message-ID: <18507@ucsd.Edu> Date: 6 Sep 90 19:26:32 GMT References: <1267@kluge.fiu.edu> Distribution: na Organization: The Avant-Garde of the Now, Ltd. Lines: 55 In sendmails 5.59 thru 5.64, there is a bug in domain.c that doesn't properly compare MX names with hostnames - it doesn't use the FQDN of your local host, so if your local hostname isn't set to a FQDN but is instead a simple hostname (as most Suns are), the MX (which is fully qualified) will not match to the local hostname, and you'll try to open a connection to yourself - getting the 'not recognized as local' (formerly, 'I refuse to talk to myself') error. I assume Sun's sendmail has the bug too. The following patch (to 5.64) fixes that; it also adds a bit more debugging that I used to figure this out. - Brian *** ../../sendmail.64.virgin/src/domain.c Tue Jun 5 18:27:44 1990 --- domain.c Thu Jun 21 12:00:27 1990 *************** *** 55,61 **** --- 63,79 ---- querybuf answer; int ancount, qdcount, buflen, seenlocal; u_short pref, localpref, type, prefer[MAXMXHOSTS]; + char localhostfqdn[MAXNAME]; + if (tTd(8, 1)) + printf("getmxrr: res_search(host=`%s',MX)\n", host); + + localpref = 0; + strcpy(localhostfqdn, localhost); + getcanonname(localhostfqdn, MAXNAME); + if (tTd(8, 2)) + printf("getmxrr: \tlocalhost=`%s'\n", localhostfqdn); + errno = 0; n = res_search(host, C_IN, T_MX, (char *)&answer, sizeof(answer)); if (n < 0) *************** *** 119,125 **** if ((n = dn_expand((char *)&answer, eom, cp, bp, buflen)) < 0) break; cp += n; ! if (!strcasecmp(bp, localhost)) { if (seenlocal == 0 || pref < localpref) localpref = pref; seenlocal = 1; --- 137,145 ---- if ((n = dn_expand((char *)&answer, eom, cp, bp, buflen)) < 0) break; cp += n; ! if (tTd(8, 2)) ! printf("getmxrr: MX '%s' = %d\n", bp, pref); ! if (!strcasecmp(bp, localhostfqdn)) { if (seenlocal == 0 || pref < localpref) localpref = pref; seenlocal = 1;