home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / sgi / 11687 < prev    next >
Encoding:
Text File  |  1992-07-30  |  4.0 KB  |  89 lines

  1. Newsgroups: comp.sys.sgi
  2. Path: sparky!uunet!sun-barr!ames!sgi!nimrod.wpd.sgi.com!roberts
  3. From: roberts@nimrod.wpd.sgi.com (roberts)
  4. Subject: Re:  how do I make sendmail use the name server rather than /etc/hosts
  5. Message-ID: <nv9nsao@sgi.sgi.com>
  6. Sender: roberts@nimrod.wpd.sgi.com
  7. Organization: Silicon Graphics, Inc.  Mountain View, CA
  8. Date: Fri, 31 Jul 1992 00:21:11 GMT
  9. Lines: 78
  10.  
  11.  
  12. Jeffrey W. Tannehill writes:
  13. >     # Canonicalize the host name.  Detect any failures.
  14. >     R$*<@$+>$*              $:$1<@$[$2$:$2.$Y$]>$3
  15. >  
  16. >     # If we successfully canonicalize a hostname, but the result contains
  17. >     # no dots, make it relative to our domain.
  18. >     R$*<@$->$*              $1<@$2.$D>$3
  19. > Apparently, the first rule takes "bob@physics.phy.duke.edu" and changes it to 
  20. > something like "bob@physics" and the second line then rewrites this as 
  21. > "bob@physics.cs.duke.edu".
  22.  
  23. The first rule canonicalizes the "physics.phy.duke.edu" part of the address
  24. ($2) by feeding it to gethostbyname(3N).  If gethostbyname returns with no
  25. error, the $[$2$:$2.$Y$] on the RHS of the rewrite rule will resolve to
  26. the contents of the h_name field of the hostent returned by gethostbyname
  27. (the canonical host name).  If gethostbyname returns an error, the
  28. $[$2$:$2.$Y$] on the RHS of the rewrite will resolve to the initial host
  29. name ($2) appended with a dot and the $Y macro (.FAIL).  (The .FAIL suffix
  30. is used by later rewrite rules to determine whether or not the canonicalization
  31. step was successful.)
  32.  
  33. The second rule matches any address with a single token hostname.  (Since any
  34. failed canonicalization step would have added .FAIL to the hostname, a
  35. single-token hostname at this point must be a canonical single token hostname.)
  36. This rule appends the local domain name to any such hostname (the local domain
  37. name may be null and must be if the network does not use domain naming).
  38. This handles cases where folks within a domain prefer to have canonical
  39. hostnames within that domain that do not contain the domain qualifier.  Note
  40. that it assumes that all single token canonical hostnames exist within the
  41. local domain.  Your situation violates that assumption, so the "wrong" domain
  42. gets appended.
  43.  
  44. What the second rule is doing is restoring information lost during the
  45. canonicalization step.  Since the host really does exist in a specific domain,
  46. the trick of hiding the domain name by canonicalizing to a single token
  47. host name throws away vital information needed by later rewrite rules.  For
  48. example, later rewrite rules decide whether or not to send a message via
  49. the forwarder host based on whether or not the destination host is contained
  50. within the top level domain (T macro).  If the real domain information for
  51. the destination host were lost, these later rules would do the wrong things.
  52.  
  53. It is best to always canonicalize to the Fully Qualified Domain Name and
  54. avoid these hassles.  I'm supporting the non-FQDN canonical name case for
  55. historical reasons.
  56.  
  57. >            If the name services is consulted instead of the
  58. > /etc/hosts file (i.e. I remove physics from the hosts file) then the mail
  59. > is sent properly.
  60.  
  61. The name server returns a FQDN.
  62.  
  63. >                    I tried using the "-oI" option with sendmail, which the 
  64. > man page says will
  65. >            Insist that the domain name server be running to resolve host names
  66. >           and MX records.  Treat ECONNREFUSED errors from the resolver as
  67. >           temporary failures.
  68. > but this had no effect when the entry for physics was in the /etc/hosts file.
  69.  
  70. Yes, because you got the entry from /etc/hosts and never got an ECONNREFUSED
  71. error.  That option means that if the domain name server is your only source
  72. of canonical names, and if it returns ECONNREFUSED, queue the message and
  73. wait for the domain name server to come back on line.
  74.  
  75. > Since I prefer to use the name services anyway (it is more likely to be
  76. > correct than the local /etc/hosts file), then is there anyway that I can
  77. > make sendmail consult the name services first?  
  78.  
  79. Check the stuff about hostresorder in the resolver(4) man page.
  80.  
  81.     - Robert Stephens
  82.       Silicon Graphics Inc.
  83.  
  84.  
  85.