Beispiel #1
0
void NetworkAccount::readConfig(/*const*/ KConfig/*Base*/ & config)
{
    KMAccount::readConfig(config);

    setLogin(config.readEntry("login"));

    if(config.readNumEntry("store-passwd", false))        // ### s/Num/Bool/
    {
        mStorePasswd = true;
        QString encpasswd = config.readEntry("pass");
        if(encpasswd.isEmpty())
        {
            encpasswd = config.readEntry("passwd");
            if(!encpasswd.isEmpty()) encpasswd = importPassword(encpasswd);
        }

        if(!encpasswd.isEmpty())
        {
            setPasswd(decryptStr(encpasswd), true);
            // migrate to KWallet if available
            if(Wallet::isEnabled())
            {
                config.deleteEntry("pass");
                config.deleteEntry("passwd");
                mPasswdDirty = true;
                mStorePasswdInConfig = false;
            }
            else
            {
                mPasswdDirty = false; // set by setPasswd() on first read
                mStorePasswdInConfig = true;
            }
        }
        else
        {
            // read password if wallet is already open, otherwise defer to on-demand loading
            if(Wallet::isOpen(Wallet::NetworkWallet()))
                readPassword();
        }

    }
    else
    {
        setPasswd("", false);
    }

    setHost(config.readEntry("host"));

    unsigned int port = config.readUnsignedNumEntry("port", defaultPort());
    if(port > USHRT_MAX) port = defaultPort();
    setPort(port);

    setAuth(config.readEntry("auth", "*"));
    setUseSSL(config.readBoolEntry("use-ssl", false));
    setUseTLS(config.readBoolEntry("use-tls", false));

    mSieveConfig.readConfig(config);
}
Beispiel #2
0
void NetworkAccount::readPassword()
{
    if(!storePasswd())
        return;

    // ### workaround for broken Wallet::keyDoesNotExist() which returns wrong
    // results for new entries without closing and reopening the wallet
    if(Wallet::isOpen(Wallet::NetworkWallet()))
    {
        Wallet *wallet = kmkernel->wallet();
        if(!wallet || !wallet->hasEntry("account-" + QString::number(mId)))
            return;
    }
    else
    {
        if(Wallet::keyDoesNotExist(Wallet::NetworkWallet(), "kmail", "account-" + QString::number(mId)))
            return;
    }

    if(kmkernel->wallet())
    {
        QString passwd;
        kmkernel->wallet()->readPassword("account-" + QString::number(mId), passwd);
        setPasswd(passwd, true);
        mPasswdDirty = false;
    }
}
Beispiel #3
0
owner<OdinIO*> reifyJoinRequest(const sstr &room,
    const sstr &user, const sstr &pwd) {
  auto w= mc_new(OdinIO);
  w->setRoomId(room);
  w->setUser(user);
  w->setPasswd(pwd);
  return w;
}
Beispiel #4
0
owner<OdinIO*> reifyPlayRequest(const sstr &game,
    const sstr &user, const sstr &pwd) {
  auto w= mc_new(OdinIO);
  w->setGameId(game);
  w->setUser(user);
  w->setPasswd(pwd);
  return w;
}
Beispiel #5
0
void AuthUser::updatePasswdEncMethod()
{
    if (strncmp(m_passwd.c_str(), "$apr1$", 6) == 0)
        setEncMethod(ENCRYPT_APMD5);
    else if (strncasecmp(m_passwd.c_str(), "{sha}", 5) == 0)
    {
        char buf[128];
        const char *p = m_passwd.c_str() + 5;
        int len = ls_base64_decode(p, strlen(p), buf);
        if (len == 20)
        {
            setPasswd(buf, len);
            setEncMethod(ENCRYPT_SHA);
        }
    }
}
Beispiel #6
0
void NetworkAccount::pseudoAssign(const KMAccount *a)
{
    KMAccount::pseudoAssign(a);

    const NetworkAccount *n = dynamic_cast<const NetworkAccount *>(a);
    if(!n) return;

    setLogin(n->login());
    setPasswd(n->passwd(), n->storePasswd());
    setHost(n->host());
    setPort(n->port());
    setAuth(n->auth());
    setUseSSL(n->useSSL());
    setUseTLS(n->useTLS());
    setSieveConfig(n->sieveConfig());
}
Beispiel #7
0
void NetworkAccount::clearPasswd()
{
    setPasswd("", false);
}
Beispiel #8
0
bool
epUser::init(const std::string& account, const std::string& passwd) {
        setAccount(account);
        setPasswd(passwd);
        return true;
}