Re: CD boutable avec shell
user@boisson.homeip.net, vendredi 25 mai 2007, 13:18:16 CEST
>
> Arch, au temps pour moi, c'est http://boisson.homeip.net/smalltelnetd-v1.c
> et http://boisson.homeip.net/smalltelnetd.c
>
> J'ai fait ça trop vite...
>
> PS: dsl pour le doublon mais je suis en remote console direct avec mail...
J’ai fait un petit test avec dup2. En simplifié :
fd = accept(prise, (struct sockaddr*)&adr_connexion, &taille);
dup2(fd, 0);
dup2(fd, 1);
dup2(fd, 2);
fcntl(fd, F_SETFD, FD_CLOEXEC);
execl("/bin/sh", "sh", "-i", NULL);
et ça fonctionne...
(Le fcntl permet de fermer le fd lorsque execl termine. Il faut
quand même le fermer chez le père (il a été copié pour le fils).)
Le tout dispo par là : http://slswww.free.fr/miniteld.c
--
Sylvain Sauvage
Reply to: