From: Vlad S. <vl...@cr...> - 2006-04-19 14:53:24
|
On the other hand, on my servers i often use 0.0.0.0 as address, so nsd listens on all registered interfaces. For me it sound more logical then trying to determine what IP address i am resolving to, if no specific then listen on all. Zoran Vasiljevic wrote: > > On 19.04.2006, at 16:31, Vlad Seryakov wrote: > >> So, it is logically that reverse DNS is used to get the name. > > > OK. This makes sense only if there is no hostname assigned > to the nsssock. Because if it is, the reverse-lookup has > absolutely no meaning, and is shooting ourselves in the > foot. > > Therefore I'd do that reverse lookup only if no hostname > is defined to nssock, like this below. > Is this OK for everybody? > > ------------------ driver.c:Ns_DriverInit() > > host = Ns_ConfigGetValue(path, "hostname"); > bindaddr = address = Ns_ConfigGetValue(path, "address"); > defserver = Ns_ConfigGetValue(path, "defaultserver"); > > /* > * If the listen address was not specified, attempt to determine it > * through a DNS lookup of the specified hostname or the server's > * primary hostname. > */ > > if (address == NULL) { > he = gethostbyname(host ? host : Ns_InfoHostname()); > > /* > * If the lookup suceeded but the resulting hostname does not > * appear to be fully qualified, attempt a reverse lookup on the > * address which often returns the fully qualified name. > * > * NB: This is a common but sloppy configuration for a Unix > * network. > */ > > /*-------- ^^^^^^^^^^^^^^^^ -------*/ > > if (host == NULL && he != NULL && he->h_name != NULL && > strchr(he->h_name, '.') == NULL) { > he = > gethostbyaddr(he->h_addr_list[0],he->h_length,he->h_addrtype); > } > > /* > * If the lookup suceeded, use the first address in host entry > list. > */ > > if (he == NULL || he->h_name == NULL) { > Ns_Log(Error, "%s: could not resolve %s: %s", module, > host ? host : Ns_InfoHostname(), strerror(errno)); > return NS_ERROR; > } > if (*(he->h_addr_list) == NULL) { > Ns_Log(Error, "%s: no addresses for %s", module, > he->h_name); > return NS_ERROR; > } > > memcpy(&ia.s_addr, he->h_addr_list[0], sizeof(ia.s_addr)); > address = ns_inet_ntoa(ia); > > /* > * Finally, if no hostname was specified, set it to the hostname > * derived from the lookup(s) above. > */ > > if (host == NULL) { > host = he->h_name; > } > } > > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > naviserver-devel mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel > -- Vlad Seryakov 571 262-8608 office vl...@cr... http://www.crystalballinc.com/vlad/ |