How to get telnet/ftp to use the resolver?

Brendan Kehoe brendan at cs.widener.edu
Wed May 15 23:47:06 AEST 1991


In <1991May15.093945.2564 at infoac.rmi.de>, rmohr at infoac.rmi.de writes:
>martin at phillip.edu.au writes:
>
>>       I've setup the resolver and named on our sun IPC and using 
>>nslookup everything seems to be fine.  However I, can't get telnet,
>>ftp etc to use the name resolver.  If I'm NOT running NIS, how do I get 
>>everything to use the resolver?
>
>It's just "easy":
>   Obtain the Source (FTP), recompile using -lresolv, use it ....
>(You should have build libresolv.a with bind lib....)

 No, it's "easier". (This is Sun's "recommended", if not official, way
to use DNS without running NIS.)

-- cut --
>From: earle at poseur.jpl.nasa.gov (Greg Earle)
Newsgroups: comp.sys.sun
Subject: Creating a libc.so with DNS resolver support (+ no YP) under SunOS 4.1
Keywords: Miscellaneous
Date: 25 Apr 90 05:03:04 GMT
Organization: Sun-Spots
X-Sun-Spots-Digest: Volume 9, Issue 136, message 9

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 at poseur.JPL.NASA.GOV       (direct)
        earle at 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.

        - Greg Earle                    | It takes up to 40 dumb animals to
          Sun Los Angeles               | make one fur coat ... but only one
          JPL on-site Software Support  | to wear it.
          sun!poseur!earle              | Fur - the look that kills.
-- cut --
-- 
     Brendan Kehoe - Widener Sun Network Manager - brendan at cs.widener.edu
  Widener University in Chester, PA                A Bloody Sun-Dec War Zone
 "Visualize a dream; look for it in the present tense -- a greater calm than
   before.  If you persist in your efforts, you can achieve...dream control."



More information about the Comp.unix.admin mailing list