runmdn
Overview
runmdn is a command that allow Unix clients performing name resolution using the standard resolver functions to support multilingual domain names without recompiling. Specifically, the name-resolving API (for example, gethostbyname) accepts host names denoted in the local encoding (EUC-JP, etc.) of the application, and also returns multilingual host names in local encoding.
Using runmdn to enable clients to support multilingual domain names is the easiest and least time-consuming of the methods provided by the mDNkit. However, it cannot be used with some systems and does not work with certain commands. See the Section Limitations for details.
In addition, since mdnsproxy ignores the setting of the environment variable MDN_DISABLE explicitly ,in spite of whether the environment variable MDN_DISABLE is set or not, the conversion of the domain names is performed.
Setup
To use runmdn, the encoding and normalization schemes must be specified in the shared mDNkit client configuration file. Refer to mDNkit configuration for information on how to configure this file.
Unless one does specify by option, runmdn automatically senses the local encoding used by an application, but this may sometimes fail. In such an event, refer to Local Encoding for procedures to deal with the situation.
Usage
runmdn is very easy to use. All that has to be done is to append runmdn
, the command name, to the beginning of the application startup command.
% runmdn [Option...] Command [Argument...]
For example, to use the telnet
command to connect to the
host "U+79C1 U+306E U+4F1A U+793E U+002E jp" ("MyCompany.jp" in Japanese), do as follows.
% runmdn telnet {U+79C1 U+306E U+4F1A U+793E}.jp
Options
runmdn recognizes the following options.
-
-e
Local Encoding - Specifies the local encoding of the application. If this option is not specified, it performs auto determination of the local encoding from locale and environment variables. Refer to the section Local Encoding in mDNkit Configration about details of auto determination.
Limitations
runmdn is the easiest method for enabling clients to support multilingual domain names of all the methods that the mDNkit provides. However, this method may not be applicable for some clients.
When the client application is executed, runmdn uses a dynamic link (a library pre-load function) of system-owned shared libraries to replace some of the name resolution functions linked to applications with versions that have functions that can handle multilingual domain names, thus allowing the client to handle multilingual domain names. The functions that are replaced by runmdn are as follows.
- gethostbyname
- gethostbyname_r
- gethostbyname2
- gethostbyname2_r
- gethostbyaddr
- gethostbyaddr_r
- getipnodebyname
- getipnodebyaddr
- getaddrinfo
- getnameinfo
As a result, runmdn operation has the following limitations:
- As shared library dynamic links are used, the system must be able to use shared libraries.
- The system must have a preload function that operates with the use of
LD_PRELOAD
, an environment variable, or similar mechanism. - runmdn can only be used for commands that dynamically link resolver libraries.
- If the system library does not provide the iconv() function, an external library that does can be used, but it must be a shared library.
- The application must use the above function for name resolution.
- As setuid commands cannot use the preload function for security reasons, do not use such commands.
When these limitations make use of runmdn impossible, other methods provided by the mDNkit (for example, mdnsproxy) can be used.