Exemplo n.º 1
0
/** @short Remember to use STARTTLS during the next connection

Once a first STARTTLS attempt succeeds, change the preferences to require STARTTLS in future. This is needed
to prevent a possible SSL stripping attack by a malicious proxy during subsequent connections.
*/
void ImapAccess::onRequireStartTlsInFuture()
{
    // It's possible that we're called after the user has already changed their preferences.
    // In order to not change stuff which was not supposed to be changed, let's make sure that we won't undo their changes.
    if (connectionMethod() == Common::ConnectionMethod::NetCleartext) {
        setConnectionMethod(Common::ConnectionMethod::NetStartTls);
    }
}
Exemplo n.º 2
0
std::string RhrController::getConfigString() const {

    std::stringstream config;
    if (connectionMethod() == RhrController::Connect) {
        auto host = listenHost();
        unsigned short port = listenPort();
        config << "connect " << host << " " << port;
    } else if (connectionMethod() == RhrController::Listen) {
        auto host = connectHost();
        unsigned short port = connectPort();
        if (port > 0) {
            config << "listen " << host << " " << port;
        } else {
            int id = m_module->id();
            config << "listen " << "_" << " " << ":" << id;
        }
    }

    return config.str();
}