Bug 73937 - KNode is not a nice KWallet user
Summary: KNode is not a nice KWallet user
Status: RESOLVED FIXED
Alias: None
Product: knode
Classification: Miscellaneous
Component: general (show other bugs)
Version: 0.7.6
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-01 03:00 UTC by Malte S. Stretz
Modified: 2004-08-22 11:04 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Malte S. Stretz 2004-02-01 03:00:58 UTC
Version:           0.7.6 (using KDE 3.2.0 RC1, Gentoo)
Compiler:          gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r3, propolice)
OS:          Linux (i686) release 2.4.20-gentoo-r8

As soon as you've got a server which requieres a username and a password configured in KNode (I've got one which I use once in a blue moon), KNode tried to open your KWallet on startup. It should wait until you acutally try to access that server.

Even worse is that KNode tries (for whatever reason) to open KWallet another time, when you close it. And if you press "Cancel" you have to click away two other dialogs.

This sucks, especially if you're used to have KNode starting automatically while you login and close it only when you logoff (KDE doesn't shut down while that frickin KWallet password dialog is open).
Comment 1 Volker Krause 2004-02-07 12:51:10 UTC
Subject: kdepim/knode

CVS commit by vkrause: 

Save server password only if it has actually changed. This prevents unnecessary wallet openings when closing knode (see second part of #73937).

CCMAIL: 73937@bugs.kde.org


  M +15 -4     knserverinfo.cpp   1.21
  M +3 -2      knserverinfo.h   1.14


--- kdepim/knode/knserverinfo.cpp  #1.20:1.21
@@ -28,5 +28,5 @@ using namespace KWallet;
 KNServerInfo::KNServerInfo()
   : t_ype(STnntp), i_d(-1), p_ort(119), h_old(300),
-    t_imeout(60), n_eedsLogon(false)
+    t_imeout(60), n_eedsLogon(false), p_assDirty(false)
 {
 }
@@ -62,4 +62,5 @@ void KNServerInfo::readConf(KConfig *con
     u_ser=conf->readEntry("user");
     p_ass = KNHelper::decryptStr(conf->readEntry("pass"));
+    if(Wallet::isEnabled())
     conf->deleteEntry("pass"); //first time run, don't store it in the config file
 
@@ -111,6 +112,6 @@ void KNServerInfo::saveConf(KConfig *con
     conf->writeEntry("needsLogon", n_eedsLogon);
     conf->writeEntry("user", u_ser);
-    //open wallet for storing only if the user actually does have the password
-    if (n_eedsLogon) {
+    // open wallet for storing only if the user actually changed the password
+    if (n_eedsLogon && p_assDirty) {
       Wallet* wallet = openWallet();
       if (!wallet || wallet->writePassword(QString::number(i_d), p_ass)) {
@@ -120,4 +121,5 @@ void KNServerInfo::saveConf(KConfig *con
           conf->writeEntry("pass", KNHelper::encryptStr(p_ass));
       }
+      p_assDirty = false;
     }
   }
@@ -137,2 +139,11 @@ bool KNServerInfo::operator==(const KNSe
             (p_ass==s.p_ass)            );
 }
+
+
+void KNServerInfo::setPass(const QString &s)
+{
+  if (p_ass != s) {
+    p_ass = s;
+    p_assDirty = true;
+  }
+}

--- kdepim/knode/knserverinfo.h  #1.13:1.14
@@ -53,5 +53,5 @@ class KNServerInfo {
     void setServer(const QString &s)  { s_erver=s; }
     void setUser(const QString &s)    { u_ser=s; }
-    void setPass(const QString &s)    { p_ass=s; }
+    void setPass(const QString &s);
     void setPort(int p)               { p_ort=p; }
     void setHold(int h)               { h_old=h; }
@@ -74,5 +74,6 @@ class KNServerInfo {
         t_imeout;
 
-    bool n_eedsLogon;
+    bool n_eedsLogon,
+         p_assDirty;
 
 };


Comment 2 Malte S. Stretz 2004-02-10 14:20:38 UTC
Could this please be backported to the BRANCH?
Comment 3 Volker Krause 2004-08-22 11:04:51 UTC
CVS commit by vkrause: 

Improved KWallet handling:
- Keep one static wallet instead of one wallet per account (fixes a memory leak).
- Load passwords on-demand or if the wallet is already open.

CCMAIL: 73937-done@bugs.kde.org


  M +11 -1     knaccountmanager.cpp   1.38
  M +6 -1      knaccountmanager.h   1.19
  M +8 -4      knnetaccess.cpp   1.35
  M +68 -36    knserverinfo.cpp   1.22
  M +12 -3     knserverinfo.h   1.15