[comp.unix.admin] How to get telnet/ftp to use the resolver?

josevela@mtecv2.mty.itesm.mx (Jose Angel Vela Avila) (05/15/91)

martin@phillip.edu.au writes:

>Hello all,

>       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?

>Thanks for any assistance,


 I think there most be a file that describes all the services

 I our VaxStation with ULTRIX 4.0 there is a file called /etc/svc.conf
 There you configure all the services and tell if it will be local or bind

 I suppose that there must be something alike in Sun OS.


 Bye.

Jose A. Vela A.
josevela@mtecv2.mty.itesm.mx

rmohr@infoac.rmi.de (Rupert Mohr) (05/15/91)

martin@phillip.edu.au writes:

>Hello all,

>       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?

>Thanks for any assistance,

It's just "easy":
   Obtain the Source (FTP), recompile using -lresolv, use it ....
(You should have build libresolv.a with bind lib....)

Regards,
Rupert

-- 
*****************************************************************
   ___  ____  ___    _  _ ___ ___   ___ ___ ___     ___ _  _
  /__/ / / /   /    /\ / /__   /   /__//__//   /__//__ /\ /
 / \  /   / __/_   /  / /__   /   /  //  //__ /  //__ /  /

brendan@cs.widener.edu (Brendan Kehoe) (05/15/91)

In <1991May15.093945.2564@infoac.rmi.de>, rmohr@infoac.rmi.de writes:
>martin@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@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@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.

        - 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@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."

scotts@qsp.COM (Scott Simpers) (05/16/91)

In article <3366@mtecv2.mty.itesm.mx> josevela@mtecv2.mty.itesm.mx (Jose Angel Vela Avila) writes:
>martin@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?
>
> I think there most be a file that describes all the services
>
> I our VaxStation with ULTRIX 4.0 there is a file called /etc/svc.conf

The problem is that you are working on a Sun.  They EXPECT to run NIS.  I don't
believe you can turn it off and have things work right.  You can tell the
ypserv process to look to DNS/resolver by using the 'ypserv -d' command.


Scott Simpers
Quality Software Products                    voice: (213)410-0303
5711 W Slauson Avenue  Suite 240             fax: (213)410-0124
Culver City, CA  90230                       ...uunet!qsp!scotts

rich@mont.cs.missouri.edu (Rich Winkel) (05/17/91)

In <1996@maserati.qsp.UUCP> scotts@qsp.COM (Scott Simpers) writes:
>In article <3366@mtecv2.mty.itesm.mx> josevela@mtecv2.mty.itesm.mx (Jose Angel Vela Avila) writes:
>>martin@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?
>The problem is that you are working on a Sun.  They EXPECT to run NIS.  I don't
>believe you can turn it off and have things work right.  You can tell the
>ypserv process to look to DNS/resolver by using the 'ypserv -d' command.

Nope.  I'm using a sun slc right now (sunos 4.1.1) which is not running
NIS, but is using the resolver.  You have to apply the patches to libc.so
which have been posted to a number of groups on the net.
I'll post it if there's interest.

Rich

ianh@resmel.bhp.com.au (Ian Hoyle) (05/17/91)

rich@mont.cs.missouri.edu (Rich Winkel) writes:

>In <1996@maserati.qsp.UUCP> scotts@qsp.COM (Scott Simpers) writes:
>>In article <3366@mtecv2.mty.itesm.mx> josevela@mtecv2.mty.itesm.mx (Jose Angel Vela Avila) writes:
>>>martin@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?
>>The problem is that you are working on a Sun.  They EXPECT to run NIS.  I don't
>>believe you can turn it off and have things work right.  You can tell the
>>ypserv process to look to DNS/resolver by using the 'ypserv -d' command.

>Nope.  I'm using a sun slc right now (sunos 4.1.1) which is not running
>NIS, but is using the resolver.  You have to apply the patches to libc.so
>which have been posted to a number of groups on the net.
>I'll post it if there's interest.

I got this from a local SUN engineer .... hope it helps !!

	ian


o MAKING A LIBC.SO for DNS without NIS

This is a procedure you can use to add name resolver routines into your
shared libc library in SunOS_4.1.

You must have fist loaded "SHLIB CUSTOM" either from suninstall or from
add_services.

Be sure to first have the file /etc/resolv.conf configured properly. You
can test this first with /usr/etc/nslookup.

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

1. Become super user
        % su  (if necessary)

2. Make a temporary directory
        % cd /usr/lib/shlib.etc
        % mkdir tmp

3. Change to the "tmp" directory just made, extract the pic .o from
   libc_pic.a and rm the file __.SYMDEF. The reason you need to do
   the 2 "mv" commands is because "ar" truncated filenames over
   16 characters.
        % cd tmp
        % ar x ../libc_pic.a
        % rm __.SYMDEF
        % mv rpc_dtablesize. rpc_dtablesize.o
        % mv rpc_commondata. rpc_commondata.o
        % 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.

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

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

6.      % cd ..

7.  Copy lorder-sparc to lorder-sparc.orig
    Edit the file lorder-sparc and remove the reference to `gethostent.o'
    and add the references to the resolver library routines by applying this
    patch:
        remove  :       gethostent.o

           add  :       gethostnamadr.o
                        sethostent.o
                        res_query.o
                        res_mkquery.o
                        res_send.o
                        res_debug.o
                        res_comp.o
                        res_init.o

        % 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

8.      % make libc.so

9. Now you should have some libc.so.x.y.z built in the current directory.
   It is recommended that you tested out this library at this point
   before installing it. You can do so by setting the environment
   LD_LIBRARY_PATH  to the current directory for example:
        % setenv LD_LIBRARY_PATH `pwd`
        % your_favorite_test_cmd  (ie. ping, ftp, telnet)
   Once you are satisfied that the new library worked, you can proceed
   to install it with the following commands:
        % cp libc.so.x.y.z /usr/lib
        % ldconfig
        % unsetenv LD_LIBRARY_PATH

10. You are now running with the new library. You can verify this by
   doing a trace command of let's say "date".
        % trace date
 The output should informed you that the new library is being used.

--
                Ian Hoyle
     /\/\       Image Processing & Data Analysis Group
    / / /\      BHP Research - Melbourne Laboratories
   / / /  \     245 Wellington Rd, Mulgrave, 3170
  / / / /\ \    AUSTRALIA
  \ \/ / / /
   \  / / /     Phone   :  +61-3-560-7066
    \/\/\/      FAX     :  +61-3-561-6709
                E-mail  :  ianh@resmel.bhp.com.au

hamish@waikato.ac.nz (05/17/91)

In article <1991May14.170912.9951@phillip.edu.au>, martin@phillip.edu.au writes:
> Hello all,
> 
>        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?
> 
> Thanks for any assistance,
> -- 

Other than getting some source and recompiling I dont believe you have much of
a choice. The sun binaries only call yp, and if made with B=-b, then yp will
call the resolver.

-- 
==============================================================================
|  Hamish Marson   <h.marson@waikato.ac.nz>                                    |
|  Computer Support Person,  Computer Science Department                     | 
|  University of Waikato                                                     |
|Disclaimer:  Anything said in this message is the personal opinion of the   |
|             finger hitting the keyboard & doesn't represent my employers   |
|             opinion in any way. (ie we probably don't agree)               |
==============================================================================