Libc_resolv.so *SUMMARY*

From: Evan Wetstone (evan@brazos.rice.edu)
Date: Fri May 18 1990 - 09:38:26 CDT


Once again, the response from the list is tremendous.

I have received 8 responses in the past 20 hours or so. They
all offer the same advice, which is a reprint of Greg Earle's
posting about creating a libc.so with resolver support under
SunOS 4.1 without YP/NIS. That posting follows this letter.

Thanks to:

dupuy@hudson.cs.columbia.edu (Alexander Dupuy)
James J Dempsey <jjd@alexander.bbn.com>
fischer@math.ufl.edu
steve@umiacs.UMD.EDU (Steve D. Miller)
del@mlb.semi.harris.com (Don Lewis)
pjg@acsu.buffalo.edu (Paul Graham)
Mark Prior <mrp@ucs.adelaide.edu.au>
cohen@gumby.ecs.umass.edu (Marc Cohen)

-- 
Evan Wetstone 
Network & Systems Support
Rice University, Houston, TX

---------------------------------------------------------------------------- From: Greg Earle - Sun JPL on-site Software Support <earle@poseur.jpl.nasa.gov> Subject: Creating a libc.so with DNS resolver support (+ no YP) under SunOS 4.1 Date: Tue, 24 Apr 90 22:03:04 -0700

As it appears that SunOS 4.1 is now reaching our users in reasonable quantities, we offer the following announcement for our Internet customers:

Background: As you may know, the normal /usr/lib/libc.so.* that ships with SunOS 4.x contains the library routines gethostbyname(3) and gethostbyaddr(3) to do host name and address resolution. These routines normally reference the `hosts' NIS (nee YP) map first, and then fall back to looking in the /etc/hosts file. By changing the NIS Makefile to invoke `makedbm' with the `-b' option, one can arrange things so that NIS does lookups first to a DNS (Domain Name Service) name server, via the resolver routines. This is the Sun supported way of doing things.

But many of Sun's Internet customers want to be able to use resolver-based lookups without having to run NIS/YP. In order to fill this void under SunOS 4.0.x, Sun created `libc_resolv.so' versions of the shared C library with the gethostbyname()/gethostbyaddr() routines replaced by the equivalent functions from the BIND nameserver distribution's resolver library (plus supporting functions). These were made available via anonymous FTP on the host `uunet.UU.NET', in the `sun-fixes' directory.

Now SunOS 4.1 has arrived, but there is no equivalent `libc_resolv.so' available via this mechanism (anonymous FTP from `uunet.UU.NET'). This message addresses this situation.

Fortunately, 2 things in SunOS 4.1 have come to the rescue:

(1) There is a selectable software category in the 4.1 Full Install called `Shlib Custom' that enables one to build custom shared libraries. This software gets installed in /usr/lib/shlib.etc, with a README file containing instructions on how to build your own custom shared C library. If you wish to build a version of libc.so with the resolver routines, make sure to select this category when installing SunOS 4.1.

(2) The version of /usr/lib/libresolv.a in 4.1 has been compiled with `cc -pic', thus producing position-independant code.

Thus, what follows is an additional set of comments that can be *directly* *appended* (i.e., `cat <remainder-of-this-message> >> README') to the file `/usr/lib/shlib.etc/README' which provides instructions on how to build a libc.so.X.NN.1 that will use the resolver for hostname/hostaddr resolution.

Sun can make no guarantees on this, but this method has been in use on Internet hosts running SunOS 4.1FCS for 3 weeks now, doing telnet, rlogin, ftp, etc. to hosts that are not in the hosts table (on hosts that do not run NIS/YP), and it works without any known problems.

One final note: the method described below applies to Sun's supported SunOS 4.1 version of the resolver library (libresolv.a), which is based on BIND 4.8. As many of you are aware, there are `post-4.8' versions of BIND floating around out there. We are aware of versions from UC Berkeley, University of Toronto, and University of Michigan, among others. Although these versions cannot be supported, it is our opinion that if the code for these customized versions of the resolver library adheres to proper shared library conventions, then if the modules in these libraries are compiled with `cc -pic', the resulting object modules should be usable in the manner described below for the shipped /usr/lib/libresolv.a. A simple test will confirm whether this will work:

% mkdir tmp ; cd tmp ; ar xv /path/to/your/custom/libresolv.a % ld -assert pure-text *.o

If there are non-PIC constructs in these objects, the assertion would tell you about them. For more information about position-independant code and shared libraries, please read Chapter 1 in the "Programming Utilities and Libraries" manual that is included in the SunOS 4.1 documentation set. It is contained in the binder labelled "Programmer's Overview - Utilities and Libraries" on the spine.

Without further ado, here it is. As mentioned, cut off below the line, save to a file, and then append that file to /usr/lib/shlib.etc/README.

Greg Earle Sun Microsystems, Inc. - JPL on-site Software Support earle@poseur.JPL.NASA.GOV (direct) earle@Sun.COM (indirect)

-------------------------------- >8 Cut here 8< ------------------------------

Supplemental instructions for building a shared libc.so that uses the resolver for hostname/addr resolution:

10. Extract the contents of libc_pic.a and /usr/lib/libresolv.a into the tmp directory: % cd tmp % ar x ../libc_pic.a % ar x /usr/lib/libresolv.a

The libresolv.a (apparently) contains object modules that are position independant, so they can be added to the libc_pic modules without fear.

11. Remove the old routine to do the hostname/addr resolution: % rm gethostent.o

12. Remove the libresolv module that contains `strncasecmp' (which is now in the main C library, so it is redundant): % rm strcasecmp.o

13. As mentioned in step 5 above, edit the file `lorder-sparc' in the .. directory. Remove the reference to `gethostent.o' and add the references to the resolver library routines by applying this patch:

% diff -rc2 lorder-sparc.orig lorder-sparc *** lorder-sparc.orig Thu Feb 8 05:27:46 1990 --- lorder-sparc Mon Apr 9 12:58:59 1990 *************** *** 150,154 **** getwd.o getnetgrent.o ! gethostent.o ypxdr.o ttyname.o --- 150,161 ---- getwd.o getnetgrent.o ! gethostnamadr.o ! sethostent.o ! res_query.o ! res_mkquery.o ! res_send.o ! res_debug.o ! res_comp.o ! res_init.o ypxdr.o ttyname.o

14. Continue as above, from steps 6 to 9.

----------------------------------------------------------------------------



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:05:57 CDT