home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / sun / admin / 5648 < prev    next >
Encoding:
Internet Message Format  |  1992-08-19  |  5.9 KB

  1. Path: sparky!uunet!ferkel.ucsb.edu!taco!lll-winken!sun-barr!decwrl!deccrl!bloom-beacon!eru.mt.luth.se!lunic!sunic!aun.uninett.no!nuug!nntp.nta.no!hal.nta.no!styri
  2. From: styri@hal.nta.no (Haakon Styri)
  3. Newsgroups: comp.sys.sun.admin
  4. Subject: DNS-no-NIS.FAQ
  5. Message-ID: <1992Aug19.082803.6899@nntp.nta.no>
  6. Date: 19 Aug 92 08:28:03 GMT
  7. Sender: news@nntp.nta.no
  8. Reply-To: styri@nta.no
  9. Organization: Norwegian Telecom Research
  10. Lines: 149
  11. Nntp-Posting-Host: balder.nta.no
  12.  
  13. Ok, the thread is appearing again and I figure it's time for a post.
  14. I've got several requests for this recipe. I'll try to post this at
  15. regular intervals.
  16.  
  17. Last Updated: 19th August 1992
  18. ------------------------------------------------------------------
  19. DNS-no-NIS : How to get most SunOS commands to use DNS without NIS
  20. ------------------------------------------------------------------
  21.  
  22. This recipe is based on a version by Greg Earle, dated 25 Apr 90
  23. Thanks to Steinar Haug for pointing out some bugs.
  24.  
  25. Background blurb:
  26. -----------------
  27. The Sun supported way of using DNS is through NIS. Please refer to the
  28. System & Network Administration manual if you want to use NIS. This FAQ
  29. offers no help in that respect.
  30.  
  31. However, many people want to use resolver-based lookups without having to
  32. run NIS. A simple way to do this is by using a version of the libc.so
  33. shared C library with the gethostbyname()/gethostbyaddr() routines replaced
  34. by the equivalent functions from the BIND nameserver distribution's resolver
  35. library.
  36.  
  37. For SunOS 4.0.x Sun created 'libc_resolv.so' versions. These were made
  38. available via anonymous FTP. Try anonymous ftp to 'ftp.uu.net' and look
  39. in directory '/systems/sun/sun-fixes'.
  40.  
  41. For SunOS 4.1.x you'll have to build custom shared libraries. To be able
  42. to do this you need the Shlib Custom option installed. This software
  43. will be installed in the '/usr/lib/shlib.etc' directory. You'll find a
  44. README file containing instructions in this directory. You may want to
  45. read it...
  46.  
  47. Fortunately, the /usr/lib/libresolv.a library has been compiled with
  48. the '-pic' option, producing position-independant code. Thus you can
  49. use this library when you create your DNS-version of 'libc.so'.
  50.  
  51. You'll find more information about position-indipendant code and shared
  52. libraries in the Programming Utilities and Libraries manual. You should,
  53. however, be able to create the 'libc.so' library without reading manuals.
  54.  
  55. Note that you'll have to substitute a few names if you're making a
  56. system 5 libc.
  57.  
  58. Note that installing a new shared library will not alter the way
  59. statically linked commands work. Try 'mount' and you'll see what
  60. I mean. Don't ask me for a patch. Look in the Programming Utilities
  61. and Libraries manual for a list of all the statically linked commands.
  62.  
  63. And, finally, no - I haven't tested this procedure using all combinations
  64. of patches and SunOS 4.1.x versions. It should work on a vanilla 4.1.2.
  65. The patch-minded person would maybe look at the following patches:
  66.  
  67.     100170-08 : jumbo patch to fix various ld problems
  68.     100257-04 : jumbo patch for ld.so, ldd and ldconfig
  69.     100531-02 : libc jumbo patch - Domestic Version (US)
  70.     100532-02 : libc jumbo patch - International Version
  71.  
  72.  
  73. Haakon Styri        (styri@nta.no)        Norwegian Telecom Research
  74. ---------------------------------------------------------------------------
  75.  
  76. 0. You must be root to do this.
  77.  
  78. 1. Make a temporary directory if not present, and cd to it
  79.     % mkdir /usr/lib/shlib.etc/tmp
  80.     % cd /usr/lib/shlib.etc/tmp
  81.  
  82. 2. Extract the pic .o from 'libc_pic.a' and '/usr/lib/libresolv.a'.
  83.    Remove the file __.SYMDEF.
  84.    You need to do the 3 'mv' commands bacause 'ar' truncates filenames
  85.    over 16 characters. (Note that the last 'mv' may not be documented in
  86.    your '/usr/lib/shlib.etc/README'. It's a patch.)
  87.     % ar x ../libc_pic.a
  88.     % ar x /usr/lib/libresolv.a
  89.     % rm __.SYMDEF
  90.     % mv rpc_dtablesize. rpc_dtablesize.o
  91.     % mv rpc_commondata. rpc_commondata.o
  92.     % mv xccs.multibyte. xccs.multibyte.o
  93.  
  94. 3. Remove the old routine to do the hostname/addr resolution:
  95.     % rm gethostent.o
  96.  
  97. 4. Remove the libresolv module that contains `strncasecmp' (which is now
  98.     in the main C library, so it is redundant):
  99.     % rm strcasecmp.o
  100.  
  101. 5. You've finished the work in the 'tmp' directory...
  102.     % cd ..
  103.  
  104. 6. The file 'lorder-sparc' in the '/usr/lib/shlib.etc' directory must
  105.    be edited to reflect the changes. Remove the reference to `gethostent.o'
  106.    and add the references to the resolver library routines by applying
  107.    this patch:
  108.  
  109.     % diff -rc2 lorder-sparc.orig lorder-sparc
  110.     *** lorder-sparc.orig   Thu Jul 30 12:38:58 1992
  111.     --- lorder-sparc    Thu Jul 30 12:41:25 1992
  112.     ***************
  113.     *** 150,154 ****
  114.       getwd.o
  115.       getnetgrent.o
  116.     ! gethostent.o
  117.       ypxdr.o
  118.       ttyname.o
  119.     --- 150,161 ----
  120.       getwd.o
  121.       getnetgrent.o
  122.     ! gethostnamadr.o
  123.     ! sethostent.o
  124.     ! res_query.o
  125.     ! res_mkquery.o
  126.     ! res_send.o
  127.     ! res_debug.o
  128.     ! res_comp.o
  129.     ! res_init.o
  130.       ypxdr.o
  131.       ttyname.o
  132.  
  133. 7. You're SunOS may have this patched, but should check the 'Makefile' for
  134.    the following problem:
  135.     There should be a '-ldl' option in the 'ld' command lines.
  136.    
  137. 8. Now you can make the new shared libary.
  138.      % make libc.so
  139.  
  140. 9. Now you should have some libc.so.x.y.z built in the current directory.
  141.    It is recommended that you tested out this library at this point 
  142.    before installing it. You can do so by setting the environment
  143.    LD_LIBRARY_PATH  to the current directory for example:
  144.        % setenv LD_LIBRARY_PATH `pwd`
  145.     % your_favorite_test_cmd
  146.    Once you are satisfied that the new library worked, you can proceed
  147.    to install it with the following commands:
  148.     % cp libc.so.x.y.z /usr/lib
  149.     % unsetenv LD_LIBRARY_PATH
  150.     % cd ..
  151.     % ldconfig
  152.  
  153.  
  154. 10. You are now running with the new library. You can verify this by
  155.     doing a trace command of let's say "date".
  156.     % trace date
  157.     The output should inform you that the new library is being used.
  158.  
  159. -------------------------------------------------------------------------
  160. Disclaimer: Neither I nor my employer will take any responsibility if
  161.         this recipe doesn't work.
  162.