Bug 76581

Summary: kwallet doesnt know my password anymore after system crash
Product: [Applications] kwalletmanager Reporter: Christian Bartels <christian>
Component: generalAssignee: George Staikos <staikos>
Status: RESOLVED FIXED    
Severity: normal CC: landrews
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Christian Bartels 2004-03-02 18:27:17 UTC
Version:           1.0 (using KDE 3.2.0, Gentoo)
Compiler:          gcc version 3.3.3 20040217 (Gentoo Linux 3.3.3, propolice-3.3-7)
OS:          Linux (i686) release 2.6.3-gentoo-r2

after a system crash (kde independent) kwallet seems to have changed my password, because i cannot log in to my wallet anymore. i just get the message that it is the wrong password (although its the right one!) and after the message there is a "-3" (probably a debug message?)
Comment 1 George Staikos 2004-03-02 18:35:28 UTC
On Tuesday 02 March 2004 12:27, Christian Bartels wrote:
> after a system crash (kde independent) kwallet seems to have changed my

Can you define "crash"?  Did your computer freeze, did the X server crash, or 
something else?

> password, because i cannot log in to my wallet anymore. i just get the
> message that it is the wrong password (although its the right one!) and
> after the message there is a "-3" (probably a debug message?)

  What does "ls -l ~/.kde/share/apps/kwallet/." show?

Comment 2 Christian Bartels 2004-03-02 18:39:03 UTC
i have some problems with stopping hotplug. (kernel panics with 2.6.3)

ls -l ~/.kde/share/apps/kwallet/.
insgesamt 8
-rw-r--r--    1 cb       users        5512  2. Mär 18:12 kdewallet.kwl
Comment 3 George Staikos 2004-03-02 18:56:21 UTC
On Tuesday 02 March 2004 12:39, Christian Bartels wrote:
> ------- i have some problems with stopping hotplug. (kernel panics with
> 2.6.3)
>
> ls -l ~/.kde/share/apps/kwallet/.
> insgesamt 8
> -rw-r--r--    1 cb       users        5512  2. Mär 18:12 kdewallet.kwl

   It looks ok, so I think the file is corrupt.  Please hold onto it.  I will 
try to come up with a tool for recovering data from corrupt wallet files and 
post information to this bug report.  Meanwhile it is likely that you will 
not be able to access that file.  I suggest moving it to another location so 
that kwallet can create a new one.  Sorry...

Comment 4 Christian Bartels 2004-03-02 23:26:12 UTC
oh, ok. thx a lot.
such a tool would be great because i stored much data in this wallet.
Comment 5 George Staikos 2004-03-29 06:39:54 UTC
*** Bug 77702 has been marked as a duplicate of this bug. ***
Comment 6 George Staikos 2004-04-01 06:54:18 UTC
CVS commit by staikos: 

Use KSaveFile to avoid out-of-disk/crash problems.
CCMAIL: 76581-done@bugs.kde.org


  M +12 -7     kwalletbackend.cc   1.46


--- kdelibs/kwallet/backend/kwalletbackend.cc  #1.45:1.46
@@ -23,5 +23,7 @@
 #include <kglobal.h>
 #include <kmdcodec.h>
+#include <ksavefile.h>
 #include <kstandarddirs.h>
+
 #include <qfile.h>
 #include <qfileinfo.h>
@@ -428,11 +430,12 @@ int Backend::sync(const QByteArray& pass
         }
 
-        QFile qf(_path);
+        KSaveFile sf(_path, 0600);
+        QFile *qf = sf.file();
 
-        if (!qf.open(IO_WriteOnly)) {
+        if (!qf) {
                 return -1;              // error opening file
         }
 
-        qf.writeBlock(KWMAGIC, KWMAGIC_LEN);
+        qf->writeBlock(KWMAGIC, KWMAGIC_LEN);
 
         // Write the version number
@@ -442,5 +445,5 @@ int Backend::sync(const QByteArray& pass
         version[2] = KWALLET_CIPHER_BLOWFISH_CBC;
         version[3] = KWALLET_HASH_SHA1;
-        qf.writeBlock(version, 4);
+        qf->writeBlock(version, 4);
 
         // Holds the hashes we write out
@@ -488,5 +491,5 @@ int Backend::sync(const QByteArray& pass
         }
 
-        qf.writeBlock(hashes, hashes.size());
+        qf->writeBlock(hashes, hashes.size());
 
         // calculate the hash of the file
@@ -562,6 +565,8 @@ int Backend::sync(const QByteArray& pass
 
         // write the file
-        qf.writeBlock(wholeFile, wholeFile.size());
-        qf.close();
+        qf->writeBlock(wholeFile, wholeFile.size());
+        if (!sf.close()) {
+                return -4; // write error
+        }
 
         wholeFile.fill(0);


Comment 7 Blindauer Emmanuel 2008-02-13 07:42:19 UTC
I thing this bug is arround again.
I got a disk full, and I lost access to kwalletmanager.
Is the tool for recovering some part of the file somewhere ?