Re: HELP: /etc/resolv.conf for a SUN IPC

From: Christopher Davis (ckd@eff.org)
Date: Thu Jul 23 1992 - 15:49:09 CDT


Eddie> == Eddie Roberts (The National Weather Service) <nws@stout.atd.ucar.edu>

 Eddie> I am trying to get my system (SUN IPC 4.1.2) to use nameservers
 Eddie> recently installed. I added the following lines into the
 Eddie> /etc/resolv.conf file.

Can I kill Sun now? Can I?

The problem is that Sun assumes we all love and use NIS, and DNS is only
"supported" through setting magic cookies in the NIS hosts map, etc.

Here's a repost of Greg Earle's explanation as to how to fix this (IMHO,
extremely annoying) situation.

Newsgroups: comp.sys.sun.admin
From: earle@poseur.JPL.NASA.GOV (Greg Earle - Sun JPL on-site Software Support)
Subject: Re: Domain Name Server
Organization: Sun Microsystems - JPL on-site Software Support

In article <1992Jun19.193017.2952@asihub.sd.cadence.com> Eric D. Williams <ericw@sd.cadence.com> writes:
>In article <1992Jun3.123530.20956@hp9000.csc.cuhk.hk> ST Wong writes:
>>I'm configuring our Sparc2, running SunOS 4.1. My problem is that I
>>uses HP 845S as our domain name server while the Sparc2 is a client
>>only. I follow the instructions in the Network Admin. manual of SunOS
>>to set up those files needed but, it doesn't work. When I uses inet
>>services (e.g. telnet, ftp, etc), it only searches the /etc/hosts file.
>>However, when I uses nslookup, it points to the domain name server !
>>
>>I don't know what's wrong with that.
>>
>>Would anyone please help ? Any help will be much appreciated.
>
> Well sure I can help you, but you won't like the answer. Sun makes
> it look like it supports DNS, but they really don't. SunOS will only
> use either local files or NIS to resolve names. It doesn't matter if
> /etc/resolve.conf is set up correctly or not. That's because all the
> name resolver libraries won't look to the nameserver, only to NIS.
> To get DNS to work on a Sun, you need to:
>
> 1. Run NIS.
> 2. Make *all* you NIS servers be Suns.
> 3. When you start ypserv (on your Sun server), you specify
> a special switch on the command line to do DNS lookups.
> Of cource only SunOS supports this switch.
>
> Only the ypserv process will use the correct DNS resolver routines to
> access the nameserver. So Sun is really doing their DNS lookups
> through NIS. But what if you don't run NIS?? Tough. Even a lowly
> Macintosh or PC has the right stuff to access a name server, but a
> Sun? Forget it.

It is my greatest fear that someone on the Net will read this posting and
actually consider it to be something authoritative as opposed to the
unmitigated rubbish it, in fact, is.

For your future edification, I present the following 12 Step program for your
rehabilitation:

1. Ensure that the "Shlib Custom" optional software category has been loaded
   from your SunOS 4.1.x O/S media.

2. cd to "/usr/lib/shlib.etc", and shove the prepared README file to README-

3. Replace said README file with the version to follow at the end of this

4. Follow the instructions contained within said README, paying close attention
   once you've reached step #4

5. Repeat after me, "Hmmn, this crow sure is mighty tasty!"

6. Repeat after me, "Hmmn, this crow sure is mighty tasty!"

7. Repeat after me, "Hmmn, this crow sure is mighty tasty!"

8. Repeat after me, "Hmmn, this crow sure is mighty tasty!"

9. Repeat after me, "Hmmn, this crow sure is mighty tasty!"

10. Repeat after me, "Hmmn, this crow sure is mighty tasty!"

11. Repeat after me, "Hmmn, this crow sure is mighty tasty!"

12. Repeat after me, "Hmmn, this crow sure is mighty tasty!"

Enjoy your meal.

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

        This is a procedure you can use to substitute or add
a module in your shared libc library.

Note! if you are interested in a System V libc, please substitute
        libcs5_pic.a for libc_pic.a in step 3,
        libcs5.so.x.y.z for libc.so.x.y.z in step 14.

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

1. Become super user
        % su

2. Make a temporary directory
        % 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
        % mv xccs_multibyte. xccs_multibyte.o

   Note: this last mv command is not present in the original version of the
   README file that comes in /usr/lib/shlib.etc/README. If this step is
   omitted, you will produce a shared libc.so that does not contain the
   xccs_multibyte.o module. This module contains versions of the library
   functions "mbtowc", "wctomb", "mbstowcs" and "wcstombs" (see mblen(3) for
   more info on these multi-byte character functions), which operate on the
   Xerox XCCS codeset standard. Specifically, the missing functions will be

        _mbtowc_xccs(pwc, s, n)
        _wctomb_xccs(s, pwc)
        _mbstowcs_xccs(pwc, s, n)
        _wcstombs_xccs(s, pwc, n)

   These are called by the corresponding "mbtowc", "wctomb", "mbstowcs" and
   "wcstombs" functions if the codeset is XCCS (other codesets include EUC,
   ISO 2022, and a default). In short, if you use any Internationalization
   features and need to handle multi-byte character sets, do not forget this
   step.

4. If you are doing this to specifically create a libc.so that contains
   the DNS resolver routines for doing hostname/hostaddr lookups via the
   Domain Name Service (and not NIS/YP), do these additional steps. If not,
   please skip down to step 10.

5. Extract the contents of /usr/lib/libresolv.a into the tmp directory:
        % ar x /usr/lib/libresolv.a
        % rm __.SYMDEF

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

   NOTE: You may wish to install Sun patch 100465-01 *first* before taking
   this step, as it provides a newer patched version of /usr/lib/libresolv.a.
   This fixes a serious bug that causes DNS nameserver lookups to fail if the
   first name server query yields ECONNREFUSED (Connection refused), even if
   the other nameservers specified in /etc/resolv.conf are both up & working:

Patch i.d. Bug i.d's SunOS Description
---------- --------- ----- -----------
100465-01 1076977
                        4.1 4.1 4.1.2 DNS res_send() fails if first nameserver
                        in /etc/resolv.conf returns ECONNREFUSED

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

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

8. As also mentioned below (in step 11), 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:

        % cd ..
        % 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

9. If you are running under SunOS 4.1.2, you will want to add the entry
   "mblib.o" to the very end of the "lorder-sparc" file. If you aren't running
   SunOS 4.1.2, you may now skip down to step 13.

   Also, you will need to patch the Makefile, as follows:

        *** Makefile.orig Wed Oct 23 10:13:00 1991
        --- Makefile Mon Feb 24 18:38:08 1992
        ***************
        *** 9,13 ****
          
          libc.so:
        ! ld -assert pure-text `${OBJSORT} lorder-sparc tmp`
                  /bin/ls /usr/lib/libc.so.* > TMP_FILE
                  mv a.out libc.so.`cat TMP_FILE | awk -f ${AWKFILE}`
        --- 9,13 ----
          
          libc.so:
        ! ld -assert pure-text `${OBJSORT} lorder-sparc tmp` -ldl
                  /bin/ls /usr/lib/libc.so.* > TMP_FILE
                  mv a.out libc.so.`cat TMP_FILE | awk -f ${AWKFILE}`
        ***************
        *** 15,19 ****
          
          libcs5.so:
        ! ld -assert pure-text `${OBJSORT} lorder-sparc tmp`
                  /bin/ls /usr/5lib/libc.so.* > TMP_FILE
                  mv a.out libc.so.`cat TMP_FILE | awk -f ${AWKFILE}`
        --- 15,19 ----
          
          libcs5.so:
        ! ld -assert pure-text `${OBJSORT} lorder-sparc tmp` -ldl
                  /bin/ls /usr/5lib/libc.so.* > TMP_FILE
                  mv a.out libc.so.`cat TMP_FILE | awk -f ${AWKFILE}`

10. Replace or add the .o that you wanted by doing a copy. Please
    note here that you are advised to create your object with
    the following compiler option, i.e "cc -c -pic yourprogram.c" to make
    it shareable.
        % cp your.o .

11. If you add a new module then you need to do this step.
    You need to edit the file "lorder-sparc" and add the name of the file
    you have copied from step 4 at the end of this file.
        % vi ../lorder-sparc

12. % cd ..

13. % make libc.so

14. 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
    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

15. 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.

-- 
        							      ______                                                                        ,__,~~, \
	                                                           /      /  \   ______________________________________________________________    ` ~^   \ _|
/ "Who would have ever believed that I could include an ASCII  \  ()^()---|/@)  \  picture of myself in my .signature file!"              ___  /   /_       )'
 \______________________________________________________,'   \_\__ | .    / |                                                                  `-'  \___,  / \  	Greg Earle	earle@poseur.JPL.NASA.GOV                        \`

-- Christopher Davis * ckd@eff.org * System Administrator, EFF * +1 617 864 0665 ``The First Amendment is often inconvenient. But that is besides the point. Inconvenience does not absolve the government of its obligation to tolerate speech.'' --Justice Anthony Kennedy, in 91-155



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:45 CDT