SUMMARY: setting up DNS without NIS

From: Mark Madsen (mm79+@andrew.cmu.edu)
Date: Fri Apr 03 1992 - 19:10:08 CST


I managed to get DNS working with sendmail and nslookup, which is all
I really needed. Still doesn't work for telnet, finger, ping, etc,
but I don't really care since this is just a mail router. Thanks to
everyone who helped out. It took pieces of several responses to get
it all going properly.

My original post:

  I have a Sun 3 running SunOS 4.1.1 (minimal installation) and I've been
  trying to get sendmail configured to use name service. For some reason,
  name service is not working for anything (telnet, sendmail, etc.) and
  I can't get it going. Can someone please point me to the appropriate
  portion of TFM or tell me what is required to start the name server?

===============================================================

From: steve@wintermute.ucsd.edu

To install nameservice you need to do 2 things.
You have to get a new system library called:

/usr/lib/libc.so.1.6.1

you can get this from ucsd.edu:/ftp/sun-fixes/libc.so.1.6.1
install this file and run ldconfig as root.
Nameservices is now working.
To get the system to recognize it you have to create the file:
/etc/resolv.conf
in this file should be

domain <your domain>
nameserver <primary nameserver>
nameserver <secondary nameserver>
nameserver <third nameserver>

I believe there is a 3 server limit.
To stop nameservice and go back to host tables, just comment out the
lines in /etc/resolv.conf

==========================================================

        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, and
        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.

==========================================================

From: Mark Prior <mrp@itd.adelaide.edu.au>
From: Greg Earle - Sun JPL on-site Software Support <earle@poseur.jpl.nasa.gov>
To: sun-managers%delta.eecs.nwu.edu@eecs.nwu.edu,
      sun-nets@skippy.umiacs.umd.edu, sun-spots@titan.rice.edu
Date: Fri, 18 May 90 20:59:57 MST
Subj: Revised posting on how to create libc_resolv.so under SunOS 4.1
Sender: sun-managers-relay@eecs.nwu.edu

----
Evan Wetstone's posting to Sun-Spots about libc+resolv under 4.1 has reminded
me to repost a slightly revised version of the instructions.  This is prompted
by 3 things:
(1) The original, virgin /usr/lib/shlib.etc/README file has an oversight in it;
    The original mentions that 2 files in the archive library need to be
    renamed after they are extracted, because the names are truncated at 16
    characters.  This is true for the Sun-3 and Sun-3x, but on Sun-4's and
    Sun-4c's (SPARCstation-1's, 1+'s, and presumably SLC's), there is an
    additional library module whose name is also truncated.  This is corrected.

(2) Several people complained to me that my instructions, being placed as an addendum rather than in line with the rest of the instructions, were thus unneccessarily confusing, and could even (if misinterpreted) cause someone to build a libc that would not work. (3) I accidentally included my .signature file at the end of the posting, and then told everyone to append the rest of my message to their README files, thus immortalizing my .signature in everybody's README (^: I humbly apologize ...

So, without further ado, here is the revised version of the file /usr/lib/shlib.etc/README. I recommend backing up the original, nuke my previous version (the one that Evan re-posted), and insert this in its place.

- Greg Earle | "This is Kraft. It uses a blue box. Sun Microsystems, Inc. | This is Stouffer's. It uses red. JPL on-site Software Support | The choice is yours." sun!poseur!earle | Pretty damn convincing argument, eh?

---------------- >8 Cut here - /usr/lib/shlib.etc/README 8< ---------------

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

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

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

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 (or 3) "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 If on a Sun-4, perform this additional `mv' command: # mv xccs_multibyte. xccs_multibyte.o

Here are some extra instructions for building a shared libc.so that uses the resolver for hostname/addr resolution:

3a. Extract the contents of libc_pic.a and /usr/lib/libresolv.a into the tmp directory: # ar x /usr/lib/libresolv.a

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

*Note* If you have your own copy of the resolver library sources, (perhaps from a post-4.8 BIND distribution) you can compile each of these modules yourself using `cc -pic' and the resulting object modules *should* be usable in this schema as well. To test that the custom resolver modules will be usable, cd to the directory containing the custom resolver sources and object modules and perform this test: # ld -assert pure-text *.o

If `ld' issues no complaints, then you can assume that the object modules are safe to use.

3b. Remove the old routine to do the hostname/addr resolution: # rm gethostent.o

3c. Remove the libresolv module that contains `strncasecmp' (which is now in the main C library, so it is redundant): # rm strcasecmp.o 3d. As mentioned in step 5 below, 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:

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

3e. Continue on, from steps 6 to 9 (i.e., skip steps 4 and 5 immediately below) .

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

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

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

6. # cd ..

7. # make libc.so

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

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

==========================================================

From: (Kevin G. Currans) <kcurrans@CORDLEY.ORST.EDU>

Hello Mark, I turned my 4.1.1 sun 3/260 over to DNS about 6 months ago. I believe that your sendmail configruation file is all set up. there should be a rule in it that looks for host names.

# resolve various and sundry other unofficial networks R$*<@$+>$* $:$1<@$[$2$]>$3 ask named to resolve

this uses a system (lib) call gethostbyname. If your system library is built for DNS then this will work properly. If it is not then it will be using the /etc/host table. I have a large note on how to do this upgrade and it requires other programs on you machine to be built to support DNS as well. (like finger, ftp, ping....) there is a dynamic library that you want it to support DNS so the dynamicly-linked programs can just use the new system calls, and they do not have to be rebuilt. Tell me if you want this note, and I will send it.

-kevin



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