Branch: Tag:

2014-08-11

2014-08-11 09:41:46 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Merge branch 'patches/bug4594' into devel

* patches/bug4594:
FTP: Extended AUTH TLS config option.
FTP: Fixed SSL data connection.
FTP: Fixed typo in PBSZ error message.
FTP: Support ending the TLS control connection with REIN.
FTP: Added configuration flag to require AUTH TLS.
FTP: Support AUTH TLS (RFC 4217).
FTP: The ftp server is always the server side of TLS.
FTP: Splitted send() into low_send() and send().
FTP: Prepare for supporting AUTH TLS (RFC 4217).
Protocols: Added StartTLSProtocol.

2364:   #endif   }    - class SSLProtocol - //! Base protocol for SSL ports. Exactly like Port, but uses SSL. + //! Base protocol for protocols that support upgrading to TLS. + //! + //! Exactly like Port, but contains settings for TLS. + class StartTLSProtocol   {    inherit Protocol;   
2872:    }    }    -  SSL.sslfile accept() -  { -  Stdio.File q = ::accept(); -  if (q) { -  SSL.sslfile ssl = SSL.sslfile (q, ctx); -  if (ssl->accept) ssl->accept(); -  return ssl; -  } -  return 0; -  } -  - #if constant(SSL.Connection) -  protected void bind (void|int ignore_eaddrinuse) -  { -  // Don't bind if we don't have correct certs. -  // if (!sizeof(ctx->cert_pairs)) return; -  ::bind (ignore_eaddrinuse); -  } - #else -  protected void bind (void|int ignore_eaddrinuse) -  { -  // Don't bind if we don't have correct certs. -  if (!ctx->certificates) return; -  ::bind (ignore_eaddrinuse); -  } - #endif -  +     void create(int pn, string i, void|int ignore_eaddrinuse)    {    ctx->random = Crypto.Random.random_string;
2929:       string _sprintf( )    { +  return "StartTLSProtocol(" + get_url() + ")"; +  } + } +  + class SSLProtocol + //! Base protocol for SSL ports. + //! + //! Exactly like Port, but uses SSL. + { +  inherit StartTLSProtocol; +  +  SSL.sslfile accept() +  { +  Stdio.File q = ::accept(); +  if (q) { +  SSL.sslfile ssl = SSL.sslfile (q, ctx); +  if (ssl->accept) ssl->accept(); +  return ssl; +  } +  return 0; +  } +  + #if constant(SSL.Connection) +  protected void bind (void|int ignore_eaddrinuse) +  { +  // Don't bind if we don't have correct certs. +  // if (!sizeof(ctx->cert_pairs)) return; +  ::bind (ignore_eaddrinuse); +  } + #else +  protected void bind (void|int ignore_eaddrinuse) +  { +  // Don't bind if we don't have correct certs. +  if (!ctx->certificates) return; +  ::bind (ignore_eaddrinuse); +  } + #endif +  +  string _sprintf( ) +  {    return "SSLProtocol(" + get_url() + ")";    }   }
6375:   #endif      #if constant(SSL.sslfile) +  add_constant( "StartTLSProtocol", StartTLSProtocol );    add_constant( "SSLProtocol", SSLProtocol );   #endif