Scroll to navigation

RCMD(3) Manuel du programmeur Linux RCMD(3)

NOM

rcmd, rresvport, iruserok, ruserok, rcmd_af, rresvport_af, iruserok_af, ruserok_af - Routines renvoyant un flux de données pour une commande invoquée à distance

SYNOPSIS

#include <netdb.h>   /* Ou <unistd.h> sur certains systèmes */
int rcmd(char **ahost, unsigned short inport, const char *locuser, 
         const char *remuser, const char *cmd, int *fd2p);
int rresvport(int *port);
int iruserok(uint32_t raddr, int superuser, 
             const char *ruser, const char *luser);
int ruserok(const char *rhost, int superuser, 
            const char *ruser, const char *luser);
int rcmd_af(char **ahost, unsigned short inport, const char *locuser, 
            const char *remuser, const char *cmd, int *fd2p,
            sa_family_t af);
int rresvport_af(int *port, sa_family_t af);
int iruserok_af(const void *raddr, int superuser, 
                const char *ruser, const char *luser, sa_family_t af);
int ruserok_af(const char *rhost, int superuser, 
               const char *ruser, const char *luser, sa_family_t af);


Exigences de macros de test de fonctionnalités pour la glibc (consulter feature_test_macros(7)) :

rcmd(), rcmd_af(), rresvport(), rresvport_af(), iruserok(), iruserok_af(), ruserok(), ruserok_af(): Since glibc 2.19: _DEFAULT_SOURCE Glibc 2.19 and earlier: _BSD_SOURCE

DESCRIPTION

The rcmd() function is used by the superuser to execute a command on a remote machine using an authentication scheme based on privileged port numbers. The rresvport() function returns a file descriptor to a socket with an address in the privileged port space. The iruserok() and ruserok() functions are used by servers to authenticate clients requesting service with rcmd(). All four functions are used by the rshd(8) server (among others).

rcmd()

La fonction rcmd() recherche l'hôte *ahost en utilisant gethostbyname(3), puis renvoie -1 si cet hôte n'existe pas. Sinon, *ahost est rempli avec le nom standard de cet hôte, et une connexion est établie avec un serveur se trouvant sur l'un des ports bien connus inport.

If the connection succeeds, a socket in the Internet domain of type SOCK_STREAM is returned to the caller, and given to the remote command as stdin and stdout. If fd2p is nonzero, then an auxiliary channel to a control process will be set up, and a file descriptor for it will be placed in *fd2p. The control process will return diagnostic output from the command (unit 2) on this channel, and will also accept bytes on this channel as being UNIX signal numbers, to be forwarded to the process group of the command. If fd2p is 0, then the stderr (unit 2 of the remote command) will be made the same as the stdout and no provision is made for sending arbitrary signals to the remote process, although you may be able to get its attention by using out-of-band data.

Le protocole est décrit en détail dans rshd(8).

rresvport()

The rresvport() function is used to obtain a socket with a privileged port bound to it. This socket is suitable for use by rcmd() and several other functions. Privileged ports are those in the range 0 to 1023. Only a privileged process (on Linux: a process that has the CAP_NET_BIND_SERVICE capability in the user namespace governing its network namespace). is allowed to bind to a privileged port. In the glibc implementation, this function restricts its search to the ports from 512 to 1023. The port argument is value-result: the value it supplies to the call is used as the starting point for a circular search of the port range; on (successful) return, it contains the port number that was bound to.

iruserok() et ruserok()

Les fonctions iruserok() et ruserok() prennent respectivement en argument une adresse IP et un nom d'hôte distant, deux noms d'utilisateurs et un drapeau indiquant si l'utilisateur local est superutilisateur « superuser ». Ainsi, si l'utilisateur n'est pas le superutilisateur, elles vérifient le fichier /etc/hosts.equiv. Si cela échoue, le fichier .rhosts est recherché dans le répertoire personnel de l'utilisateur local, afin de voir si la requête est autorisée.

If this file does not exist, is not a regular file, is owned by anyone other than the user or the superuser, is writable by anyone other than the owner, or is hardlinked anywhere, the check automatically fails. Zero is returned if the machine name is listed in the hosts.equiv file, or the host and remote username are found in the .rhosts file; otherwise iruserok() and ruserok() return -1. If the local domain (as obtained from gethostname(2)) is the same as the remote domain, only the machine name need be specified.

Si l'adresse IP de l'hôte distant est connue, iruserok() sera préférée à ruserok(), car elle ne nécessite pas d'avoir un serveur DNS digne de confiance pour le domaine distant.

Variantes *_af()

Toutes les fonctions décrites ci-dessus fonctionnent avec des sockets IPv4 (AF_INET). Les variantes « _af » prennent un argument supplémentaire qui permet d'indiquer la famille d'adresse de socket. Pour ces fonctions, l'argument af peut être indiqué comme AF_INET ou AF_INET6. De plus, rcmd_af() permet d'utiliser AF_UNSPEC.

VALEUR RENVOYÉE

La fonction rcmd() renvoie un descripteur de socket valable si elle réussit, sinon elle renvoie -1 et affiche un message de diagnostic sur sa sortie d'erreur standard.

La fonction rresvport() renvoie un descripteur de socket valable, attaché à une adresse privilégiée si elle réussit. Elle renvoie -1 sinon, et errno contient le code d'erreur. Le code d'erreur EAGAIN signifie en réalité « Tous les ports réseau sont déjà utilisés ».

Voir ci-dessus pour des renseignements sur les valeurs renvoyées par ruserok() et iruserok().

VERSIONS

Les fonctions iruserok_af(), rcmd_af(), rresvport_af() et ruserok_af() sont fournies dans la glibc depuis la version 2.2.

ATTRIBUTS

Pour une explication des termes utilisés dans cette section, consulter attributes(7).
Interface Attribut Valeur
rcmd(), rcmd_af() Sécurité des threads MT-Unsafe
rresvport(), rresvport_af() Sécurité des threads MT-Safe
iruserok(), ruserok(), iruserok_af(), ruserok_af() Sécurité des threads MT-Safe locale

CONFORMITÉ

Not in POSIX.1. Present on the BSDs, Solaris, and many other systems. These functions appeared in 4.2BSD. The "_af" variants are more recent additions, and are not present on as wide a range of systems.

BOGUES

iruserok() et iruserok_af() ne sont déclarées dans les fichiers d'en-tête de la glibc que depuis la version 2.12.

VOIR AUSSI

rlogin(1), rsh(1), intro(2), rexec(3), rexecd(8), rlogind(8), rshd(8)

COLOPHON

Cette page fait partie de la publication 5.04 du projet man-pages Linux. Une description du projet et des instructions pour signaler des anomalies et la dernière version de cette page peuvent être trouvées à l'adresse https://www.kernel.org/doc/man-pages/.

TRADUCTION

La traduction française de cette page de manuel a été créée par Christophe Blaess <https://www.blaess.fr/christophe/>, Stéphan Rafin <stephan.rafin@laposte.net>, Thierry Vignaud <tvignaud@mandriva.com>, François Micaux, Alain Portal <aportal@univ-montp2.fr>, Jean-Philippe Guérard <fevrier@tigreraye.org>, Jean-Luc Coulon (f5ibh) <jean-luc.coulon@wanadoo.fr>, Julien Cristau <jcristau@debian.org>, Thomas Huriaux <thomas.huriaux@gmail.com>, Nicolas François <nicolas.francois@centraliens.net>, Florentin Duneau <fduneau@gmail.com>, Simon Paillard <simon.paillard@resel.enst-bretagne.fr>, Denis Barbier <barbier@debian.org> et David Prévot <david@tilapin.org>

Cette traduction est une documentation libre ; veuillez vous reporter à la GNU General Public License version 3 concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE.

Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à <debian-l10n-french@lists.debian.org>.

15 septembre 2017 Linux