summaryrefslogtreecommitdiffabout
path: root/pwmanager
authorzautrix <zautrix>2004-10-19 20:18:42 (UTC)
committer zautrix <zautrix>2004-10-19 20:18:42 (UTC)
commit72fcd35606475a620a8aab7dd4cf9cbaf4b0acee (patch) (unidiff)
tree396f0af18109c1cbc0075d9409743fc2fc1c650b /pwmanager
parenteca49bb06a71980ef61d078904573f25890fc7f2 (diff)
downloadkdepimpi-72fcd35606475a620a8aab7dd4cf9cbaf4b0acee.zip
kdepimpi-72fcd35606475a620a8aab7dd4cf9cbaf4b0acee.tar.gz
kdepimpi-72fcd35606475a620a8aab7dd4cf9cbaf4b0acee.tar.bz2
crypto changes
Diffstat (limited to 'pwmanager') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmanagerE.pro11
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp2
2 files changed, 9 insertions, 4 deletions
diff --git a/pwmanager/pwmanager/pwmanagerE.pro b/pwmanager/pwmanager/pwmanagerE.pro
index 4c3a568..6aa0571 100644
--- a/pwmanager/pwmanager/pwmanagerE.pro
+++ b/pwmanager/pwmanager/pwmanagerE.pro
@@ -1,88 +1,93 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3 3
4 4
5 TARGET = pwmpi 5 TARGET = pwmpi
6OBJECTS_DIR = obj/$(PLATFORM) 6OBJECTS_DIR = obj/$(PLATFORM)
7MOC_DIR = moc/$(PLATFORM) 7MOC_DIR = moc/$(PLATFORM)
8DESTDIR=$(QPEDIR)/bin 8DESTDIR=$(QPEDIR)/bin
9 9
10INCLUDEPATH += . ../../ ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils $(QPEDIR)/include 10INCLUDEPATH += . ../../ ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils $(QPEDIR)/include
11DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY 11DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY
12 12
13#enable this setting if you want debugoutput for pwmanager 13#enable this setting if you want debugoutput for pwmanager
14#DEFINES += CONFIG_DEBUG 14#DEFINES += CONFIG_DEBUG
15 15LIBS += -L../libcrypt/$(PLATFORM)
16LIBS += -lmicrokde 16LIBS += -lmicrokde
17LIBS += -lmicroqtcompat 17LIBS += -lmicroqtcompat
18LIBS += -lmicrokdepim 18LIBS += -lmicrokdepim
19LIBS += -L$(QPEDIR)/lib 19LIBS += -L$(QPEDIR)/lib
20LIBS += -lqpe 20LIBS += -lqpe
21LIBS += -lz 21LIBS += -lzlib
22#LIBS += -lbz2 22#LIBS += -lbz2
23LIBS += -lgcrypt 23#LIBS += -lkpmicrogcrypt
24LIBS += -ljpeg
24LIBS += $(QTOPIALIB) 25LIBS += $(QTOPIALIB)
26LIBS += -lkpmicrocipher
27LIBS += -lkpmicroerror
28LIBS += -lkpmicrompi
29LIBS += -lstdc++
25 30
26#INTERFACES = \ 31#INTERFACES = \
27#addentrywnd.ui \ 32#addentrywnd.ui \
28#configwnd.ui \ 33#configwnd.ui \
29#findwnd.ui \ 34#findwnd.ui \
30#getmasterpwwnd.ui \ 35#getmasterpwwnd.ui \
31#pwgenwnd.ui \ 36#pwgenwnd.ui \
32#setmasterpwwnd.ui \ 37#setmasterpwwnd.ui \
33#subtbledit.ui 38#subtbledit.ui
34 39
35#INTERFACES = \ 40#INTERFACES = \
36#subtbledit.ui \ 41#subtbledit.ui \
37 42
38 43
39 44
40#HEADERS = \ 45#HEADERS = \
41#configuration_31compat.h \ 46#configuration_31compat.h \
42#configuration.h \ 47#configuration.h \
43#configwnd.h \ 48#configwnd.h \
44#configwndimpl.h \ 49#configwndimpl.h \
45#selftest.h 50#selftest.h
46#subtbledit.h \ 51#subtbledit.h \
47#subtbleditimpl.h \ 52#subtbleditimpl.h \
48#compressbzip2.h \ 53#compressbzip2.h \
49 54
50HEADERS = \ 55HEADERS = \
51addentrywnd_emb.h \ 56addentrywnd_emb.h \
52addentrywndimpl.h \ 57addentrywndimpl.h \
53base64.h \ 58base64.h \
54binentrygen.h \ 59binentrygen.h \
55blowfish.h \ 60blowfish.h \
56commentbox.h \ 61commentbox.h \
57compiler.h \ 62compiler.h \
58compressgzip.h \ 63compressgzip.h \
59findwnd_emb.h \ 64findwnd_emb.h \
60findwndimpl.h \ 65findwndimpl.h \
61genpasswd.h \ 66genpasswd.h \
62getkeycardwnd.h \ 67getkeycardwnd.h \
63getmasterpwwnd_emb.h \ 68getmasterpwwnd_emb.h \
64getmasterpwwndimpl.h \ 69getmasterpwwndimpl.h \
65globalstuff.h \ 70globalstuff.h \
66gpasmanfile.h \ 71gpasmanfile.h \
67htmlgen.h \ 72htmlgen.h \
68htmlparse.h \ 73htmlparse.h \
69ipc.h \ 74ipc.h \
70libgcryptif.h \ 75libgcryptif.h \
71listobjselectwnd.h \ 76listobjselectwnd.h \
72listviewpwm.h \ 77listviewpwm.h \
73printtext.h \ 78printtext.h \
74pwgenwnd_emb.h \ 79pwgenwnd_emb.h \
75pwgenwndimpl.h \ 80pwgenwndimpl.h \
76pwmdoc.h \ 81pwmdoc.h \
77pwmdocui.h \ 82pwmdocui.h \
78pwmexception.h \ 83pwmexception.h \
79pwm.h \ 84pwm.h \
80pwminit.h \ 85pwminit.h \
81pwmprefs.h \ 86pwmprefs.h \
82pwmprint.h \ 87pwmprint.h \
83pwmtray.h \ 88pwmtray.h \
84pwmview.h \ 89pwmview.h \
85pwmviewstyle_0.h \ 90pwmviewstyle_0.h \
86pwmviewstyle_1.h \ 91pwmviewstyle_1.h \
87pwmviewstyle.h \ 92pwmviewstyle.h \
88randomizer.h \ 93randomizer.h \
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp
index f4a1636..e29e3d1 100644
--- a/pwmanager/pwmanager/pwmdoc.cpp
+++ b/pwmanager/pwmanager/pwmdoc.cpp
@@ -285,129 +285,129 @@ void DocTimer::metaCheckTimeout()
285 /* We simply trigger all views to update their 285 /* We simply trigger all views to update their
286 * displayed values. This way they have a chance 286 * displayed values. This way they have a chance
287 * to get notified when some meta changes over time. 287 * to get notified when some meta changes over time.
288 * (for example an entry expired). 288 * (for example an entry expired).
289 * The _view_ is responsive for not updating its 289 * The _view_ is responsive for not updating its
290 * contents if nothing really changed! 290 * contents if nothing really changed!
291 */ 291 */
292 emit doc->dataChanged(doc); 292 emit doc->dataChanged(doc);
293#ifdef CONFIG_KWALLETIF 293#ifdef CONFIG_KWALLETIF
294 if (kwlEmu) 294 if (kwlEmu)
295 kwlEmu->resumeDocSignals(); 295 kwlEmu->resumeDocSignals();
296#endif // CONFIG_KWALLETIF 296#endif // CONFIG_KWALLETIF
297 metaCheckTimer->start(META_CHECK_TIMER_INTERVAL * 1000, true); 297 metaCheckTimer->start(META_CHECK_TIMER_INTERVAL * 1000, true);
298} 298}
299 299
300 300
301 301
302PwMDocList PwMDoc::openDocList; 302PwMDocList PwMDoc::openDocList;
303unsigned int PwMDocList::unnamedDocCnt = 1; 303unsigned int PwMDocList::unnamedDocCnt = 1;
304 304
305PwMDoc::PwMDoc(QObject *parent, const char *name) 305PwMDoc::PwMDoc(QObject *parent, const char *name)
306 : PwMDocUi(parent, name) 306 : PwMDocUi(parent, name)
307 , dataChangedLock (0) 307 , dataChangedLock (0)
308{ 308{
309 deleted = false; 309 deleted = false;
310 unnamedNum = 0; 310 unnamedNum = 0;
311 getOpenDocList()->add(this, getTitle().latin1()); 311 getOpenDocList()->add(this, getTitle().latin1());
312 curDocStat = 0; 312 curDocStat = 0;
313 setMaxNumEntries(); 313 setMaxNumEntries();
314 _timer = new DocTimer(this); 314 _timer = new DocTimer(this);
315 timer()->start(DocTimer::id_mpwTimer); 315 timer()->start(DocTimer::id_mpwTimer);
316 timer()->start(DocTimer::id_autoLockTimer); 316 timer()->start(DocTimer::id_autoLockTimer);
317 timer()->start(DocTimer::id_metaCheckTimer); 317 timer()->start(DocTimer::id_metaCheckTimer);
318 addCategory(DEFAULT_CATEGORY, 0, false); 318 addCategory(DEFAULT_CATEGORY, 0, false);
319 listView = 0; 319 listView = 0;
320 emit docCreated(this); 320 emit docCreated(this);
321} 321}
322 322
323PwMDoc::~PwMDoc() 323PwMDoc::~PwMDoc()
324{ 324{
325 emit docClosed(this); 325 emit docClosed(this);
326 getOpenDocList()->del(this); 326 getOpenDocList()->del(this);
327 delete _timer; 327 delete _timer;
328} 328}
329 329
330PwMerror PwMDoc::saveDoc(char compress, const QString *file) 330PwMerror PwMDoc::saveDoc(char compress, const QString *file)
331{ 331{
332 PwMerror ret, e; 332 PwMerror ret, e;
333 string serialized; 333 string serialized;
334 QFile f; 334 QFile f;
335 QString tmpFileMoved(QString::null); 335 QString tmpFileMoved(QString::null);
336 bool wasDeepLocked; 336 bool wasDeepLocked;
337 QString savedFilename(filename); 337 QString savedFilename(filename);
338 338
339 if (!file) { 339 if (!file) {
340 if (filename == "") 340 if (filename == "")
341 return e_filename; 341 return e_filename;
342 if (isDeepLocked()) { 342 if (isDeepLocked()) {
343 /* We don't need to save any data. 343 /* We don't need to save any data.
344 * It's already all on disk, because 344 * It's already all on disk, because
345 * we are deeplocked. 345 * we are deeplocked.
346 */ 346 */
347 unsetDocStatFlag(DOC_STAT_DISK_DIRTY); 347 unsetDocStatFlag(DOC_STAT_DISK_DIRTY);
348 ret = e_success; 348 ret = e_success;
349 goto out; 349 return ret;
350 } 350 }
351 } else { 351 } else {
352 if (*file == "" && filename == "") 352 if (*file == "" && filename == "")
353 return e_filename; 353 return e_filename;
354 if (*file != "") 354 if (*file != "")
355 filename = *file; 355 filename = *file;
356 } 356 }
357 357
358 wasDeepLocked = isDeepLocked(); 358 wasDeepLocked = isDeepLocked();
359 if (wasDeepLocked) { 359 if (wasDeepLocked) {
360 /* We are deeplocked. That means all data is already 360 /* We are deeplocked. That means all data is already
361 * on disk. BUT we need to do saving procedure, 361 * on disk. BUT we need to do saving procedure,
362 * because *file != savedFilename. 362 * because *file != savedFilename.
363 * Additionally we need to tempoarly restore 363 * Additionally we need to tempoarly restore
364 * the old "filename", because deepLock() references it. 364 * the old "filename", because deepLock() references it.
365 */ 365 */
366 QString newFilename(filename); 366 QString newFilename(filename);
367 filename = savedFilename; 367 filename = savedFilename;
368 getDataChangedLock(); 368 getDataChangedLock();
369 e = deepLock(false); 369 e = deepLock(false);
370 putDataChangedLock(); 370 putDataChangedLock();
371 filename = newFilename; 371 filename = newFilename;
372 switch (e) { 372 switch (e) {
373 case e_success: 373 case e_success:
374 break; 374 break;
375 case e_wrongPw: 375 case e_wrongPw:
376 case e_noPw: 376 case e_noPw:
377 emitDataChanged(this); 377 emitDataChanged(this);
378 return e; 378 return e;
379 default: 379 default:
380 emitDataChanged(this); 380 emitDataChanged(this);
381 return e_openFile; 381 return e_openFile;
382 } 382 }
383 } 383 }
384 384
385 if (!isPwAvailable()) { 385 if (!isPwAvailable()) {
386 /* password is not available. This means, the 386 /* password is not available. This means, the
387 * document wasn't saved, yet. 387 * document wasn't saved, yet.
388 */ 388 */
389 bool useChipcard = getDocStatFlag(DOC_STAT_USE_CHIPCARD); 389 bool useChipcard = getDocStatFlag(DOC_STAT_USE_CHIPCARD);
390 QString pw(requestNewMpw(&useChipcard)); 390 QString pw(requestNewMpw(&useChipcard));
391 if (pw != "") { 391 if (pw != "") {
392 currentPw = pw; 392 currentPw = pw;
393 } else { 393 } else {
394 return e_noPw; 394 return e_noPw;
395 } 395 }
396 if (useChipcard) { 396 if (useChipcard) {
397 setDocStatFlag(DOC_STAT_USE_CHIPCARD); 397 setDocStatFlag(DOC_STAT_USE_CHIPCARD);
398 } else { 398 } else {
399 unsetDocStatFlag(DOC_STAT_USE_CHIPCARD); 399 unsetDocStatFlag(DOC_STAT_USE_CHIPCARD);
400 } 400 }
401 } 401 }
402 402
403 int _cryptAlgo = conf()->confGlobCryptAlgo(); 403 int _cryptAlgo = conf()->confGlobCryptAlgo();
404 int _hashAlgo = conf()->confGlobHashAlgo(); 404 int _hashAlgo = conf()->confGlobHashAlgo();
405 405
406 // sanity check for the selected algorithms 406 // sanity check for the selected algorithms
407 if (_cryptAlgo < PWM_CRYPT_BLOWFISH || 407 if (_cryptAlgo < PWM_CRYPT_BLOWFISH ||
408 _cryptAlgo > PWM_CRYPT_TWOFISH128) { 408 _cryptAlgo > PWM_CRYPT_TWOFISH128) {
409 printWarn("Invalid Crypto-Algorithm selected! " 409 printWarn("Invalid Crypto-Algorithm selected! "
410 "Config-file seems to be corrupt. " 410 "Config-file seems to be corrupt. "
411 "Falling back to Blowfish."); 411 "Falling back to Blowfish.");
412 _cryptAlgo = PWM_CRYPT_BLOWFISH; 412 _cryptAlgo = PWM_CRYPT_BLOWFISH;
413 } 413 }