Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
michaelbushkov:nsswitchmodulesseparation [2006/07/01 21:32] – MichaelBushkovmichaelbushkov:nsswitchmodulesseparation [2022/10/05 22:57] (current) – Move to personal namespace KubilayKocak
Line 7: Line 7:
 ==== Issue 1. Common functionality. ==== ==== Issue 1. Common functionality. ====
  
-Common functionality was the almost ubiquitous problem of all nss-modules. As all nsswitch sources for the particular database usually reside in 1 file (i.e. getpwent.c), the sources functions usually use some common routines (pw_scan, for example). To move such modules from the libc with minimal changes, common functions were moved to the internal libnssutil static library. It provides some common routines and is used by all modules. As it contains quite general routines (like copy_htent() and copy_netent(%%))%%, it can be possibly useful even if some new nss-module would be introduced.+Common functionality was the almost ubiquitous problem of all nss-modules. As all nsswitch sources for the particular database usually reside in 1 file (i.e. getpwent.c), the sources functions usually use some common routines (pw_scan, for example). To move such modules from the libc with minimal changes, common functions were moved to the internal libnssutil static library. //NOTE: this library **must be compiled with ${PICFLAG}**, because it is used solely for linking with shared libraries - i.e. nsswitch modules//. It provides some common routines and is used by all modules. As it contains quite general routines (like copy_htent() and copy_netent(%%))%%, it can be possibly useful even if some new nss-module would be introduced.
  
-Another case of common functionality was the implementation of “files” and “compat” nsswitch source for “services” database (it was written by me during %%SoC%% 2005, I’m afraid). It uses 1 files_servent() function for satisfying all requests for getservbyname(), getservbyport() and getservent() functions for both “files” and “compat” sources. The problem is that nss_compat and nss_files are now separated. This issues was solved by linking nss_compat with static nss_files.a library and using files_servent function from it (more about why we need static versions of nss-modules libraries – see below). This solution is a bit straight-forward, but it leaves the nss-modules’ code untouched. And almost any other solution will lead us to code duplication, which is probably even-more straight forward.+Another case of common functionality was the implementation of “files” and “compat” nsswitch source for “services” database (it was written by me during %%SoC%% 2005, I’m afraid). It uses 1 files_servent() function for satisfying all requests for getservbyname(), getservbyport() and getservent() functions for both “files” and “compat” sources. The problem is that nss_compat and nss_files are now separated. This issues was **initially** solved by linking nss_compat with static nss_files.a library and using files_servent function from it (more about why we need static versions of nss-modules libraries – see below). But such approach led to the duplicated symbols problem in libc.a (when linking it with static verions of nsswitch modules) and to complex Makefiles. So, the code was duplicated as little as possible, but all linking tricks were eliminated from nss_compat and nss_files Makefiles'.
  
 getipnodeby%%**%%() functions had a lot of common functionality issues. It turned out that the simples way to solve them is to implement getipnodeby%%**%%() functions not through nsdispatch() calls but through gethostby%%**%%() calls. Such modifications were made and tested for compatibility with current implementations. getipnodeby%%**%%() functions had a lot of common functionality issues. It turned out that the simples way to solve them is to implement getipnodeby%%**%%() functions not through nsdispatch() calls but through gethostby%%**%%() calls. Such modifications were made and tested for compatibility with current implementations.
Line 63: Line 63:
 ===== Results ===== ===== Results =====
  
-==== Result 1. ====+==== Result 1. Nss-modules separated. ====
  
 All nss-modules were moved from the libc: nss_files, nss_compat, nss_dns, nss_nis, nss_icmp (experimental version). All these modules along with libnssutil reside in src/lib. All nss-modules were moved from the libc: nss_files, nss_compat, nss_dns, nss_nis, nss_icmp (experimental version). All these modules along with libnssutil reside in src/lib.
  
-==== Result 2. ====+==== Result 2. "peforma-actual-lookups" support extended. ====
  
 Caching daemon (cached) was extended to support “perform-actual-lookups” mode for all implemented nsswitch databases. It was impossible before because of the built-in-the-libc nss-modules, which sources functions were libc-internal. Caching daemon (cached) was extended to support “perform-actual-lookups” mode for all implemented nsswitch databases. It was impossible before because of the built-in-the-libc nss-modules, which sources functions were libc-internal.
  
-==== Result 3. ====+==== Result 3. "shells" nsswitch implementation reworked. ====
 “shells” nsswitch database implementation was rewritten to be more consistent with other nsswitch databases and usable by caching daemon. “shells” nsswitch database implementation was rewritten to be more consistent with other nsswitch databases and usable by caching daemon.
  
  • michaelbushkov/nsswitchmodulesseparation.1151789531.txt.gz
  • Last modified: 2006/07/01 21:32
  • by MichaelBushkov