Example #1
0
LIBETPAN_EXPORT
int mailpop3_socket_starttls_with_callback(mailpop3 * f,
    void (* callback)(struct mailstream_ssl_context * ssl_context, void * data), void * data)
{
  int r;
  int fd;
  mailstream_low * low;
  mailstream_low * new_low;
  
  r = mailpop3_stls(f);

  switch (r) {
  case MAILPOP3_NO_ERROR:
    break;
  default:
    return r;
  }

  low = mailstream_get_low(f->pop3_stream);
  fd = mailstream_low_get_fd(low);
  if (fd == -1)
    return MAILPOP3_ERROR_STREAM;
  
  new_low = mailstream_low_tls_open_with_callback(fd,
      callback, data);
  if (new_low == NULL)
    return MAILPOP3_ERROR_SSL;
  
  mailstream_low_free(low);
  mailstream_set_low(f->pop3_stream, new_low);
  
  return MAILPOP3_NO_ERROR;
}
Example #2
0
static int mailpop3_cfsocket_starttls(mailpop3 * f)
{
  int r;
  
  r = mailpop3_stls(f);
  switch (r) {
    case MAILPOP3_NO_ERROR:
      break;
    default:
      return r;
  }
  
  r = mailstream_cfstream_set_ssl_enabled(f->pop3_stream, 1);
  if (r < 0) {
    return MAILPOP3_ERROR_SSL;
  }
  
  return MAILPOP3_NO_ERROR;
}
Example #3
0
static int mailpop3_cfsocket_starttls(mailpop3 * f)
{
    int r;

    r = mailpop3_stls(f);
    switch (r) {
    case MAILPOP3_NO_ERROR:
        break;
    default:
        return r;
    }

    mailstream_cfstream_set_ssl_verification_mask(f->pop3_stream, MAILSTREAM_CFSTREAM_SSL_NO_VERIFICATION);
    r = mailstream_cfstream_set_ssl_enabled(f->pop3_stream, 1);
    if (r < 0) {
        return MAILPOP3_ERROR_SSL;
    }

    return MAILPOP3_NO_ERROR;
}