rexec

Section: C Library Functions (3)
Updated: 2025-09-21
Index JM Home Page roff page
 

名前

rexec, rexec_af - リモートコマンドへのストリームを返す  

ライブラリ

標準 C ライブラリ (libc,~-lc)  

書式

#include <netdb.h>

[[deprecated]]
int rexec(char **restrict ahost, int inport,
          const char *restrict user, const char *restrict passwd,
          const char *restrict cmd, int *restrict fd2p);

[[deprecated]]
int rexec_af(char **restrict ahost, int inport,
          const char *restrict user, const char *restrict passwd,
          const char *restrict cmd, int *restrict fd2p,
          sa_family_t af);

rexec(), rexec_af():

    glibc 2.19 以降:
        _DEFAULT_SOURCE
    glibc 2.19 以前:
        _BSD_SOURCE
 

説明

このインターフェースは rcmd(3) によって置き換えられた。

The rexec() function looks up the host *ahost using gethostbyname(3), returning -1 if the host does not exist. Otherwise, *ahost is set to the standard name of the host. If a username and password are both specified, then these are used to authenticate to the foreign host; otherwise, the environment and then the .netrc file in user's home directory are searched for appropriate information. If all this fails, the user is prompted for the information.

ポート inport には、接続に使用する DARPA Internet の well-known ポートを指定する。 getservbyname("exec", "tcp") を呼び出すと構造体へのポインターが返され (getservent(3) 参照)、この構造体には必要なポートが入っている。 接続に使用されるプロトコルについての詳細は rexecd(8) に書かれている (訳注: 現在のところ存在しない)。

接続に成功すると、インターネットドメインの SOCK_STREAM 型のソケットが返され、そのソケットはリモートコマンドの 標準入力および標準出力となる。 fd2p が 0 以外の場合、制御プロセスへの補助チャンネルがセットアップされ、 補助チャンネルのファイルディスクリプターが *fd2p に書かれる。 制御プロセスはコマンドからの診断メッセージ出力 (ファイルディスクリプター 2) をこのチャンネルで返す。また、このチャンネル経由で UNIX のシグナル番号を示すバイトを受信する。受信したシグナルは コマンドが属すプロセスグループに転送される。 診断情報にはリモートの認証失敗は含まれない。なぜなら、認証の確認が行われた 後で補助チャンネルの接続はセットアップされるからである。 fd2p が 0 の場合、標準エラー (リモートコマンドのファイルディスクリプター 2) は 標準出力と同様に扱われ、リモートプロセスに任意のシグナルを送るための 手段は提供されない。但し、リモートプロセスに対してトリガーをかけるために、 帯域外データ (out-of-band data) を使うことはできる。  

rexec_af()

rexec() 関数は IPv4 (AF_INET) 上で動作する。 これに対して、 rexec_af() 関数は追加の引数 af があり、 この引数で呼び出し側がプロトコルを選択できる。 この引数には AF_INET, AF_INET6, AF_UNSPEC を指定できる (AF_UNSPEC は実装側がプロトコルを選択することを意味する)。  

属性

この節で使用されている用語の説明は attributes(7) を参照のこと。
InterfaceAttributeValue
rexec(), rexec_af() Thread safetyMT-Unsafe
 

標準規格

なし。  

歴史

rexec()
4.2BSD, BSD, Solaris.
rexec_af()
glibc 2.2.
 

バグ

rexec() 関数はネットワークに暗号化されていないパスワードを送信する。

The underlying service is considered a big security hole, and therefore, not enabled on many sites; see rexecd(8) for explanations.  

関連項目

rcmd(3), rexecd(8)


 

Index

名前
ライブラリ
書式
説明
rexec_af()
属性
標準規格
歴史
バグ
関連項目

This document was created by man2html, using the manual pages.