cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: getsockname problem ??

From: Peter Sylvester <Peter.Sylvester_at_edelweb.fr>
Date: Tue, 22 Aug 2006 18:51:52 +0200

I think one possible way in ftp.c AllowServerConnect is something like:

  default:
    /* we have received data here */
    {
      curl_socket_t s = CURL_SOCKET_BAD;
#ifdef ENABLE_IPV6
      struct Curl_sockaddr_storage add;
#else
      struct sockaddr_in add;
#endif
      socklen_t size = (socklen_t) sizeof(add);

      if(0 == getsockname(sock, (struct sockaddr *) &add, &size)) {
        if (size > (socklen_t) sizeof(add))
          return CURLE_FTP_PORT_FAILED;
        s=accept(sock, (struct sockaddr *) &add, &size);
      }

      sclose(sock); /* close the first socket */

-- 
To verify the signature, see http://edelpki.edelweb.fr/ 
Cela vous permet de charger le certificat de l'autorité; 
die Liste mit zurückgerufenen Zertifikaten finden Sie da auch. 

Received on 2006-08-22