author | zautrix <zautrix> | 2004-10-19 20:18:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-19 20:18:42 (UTC) |
commit | 72fcd35606475a620a8aab7dd4cf9cbaf4b0acee (patch) (unidiff) | |
tree | 396f0af18109c1cbc0075d9409743fc2fc1c650b /pwmanager | |
parent | eca49bb06a71980ef61d078904573f25890fc7f2 (diff) | |
download | kdepimpi-72fcd35606475a620a8aab7dd4cf9cbaf4b0acee.zip kdepimpi-72fcd35606475a620a8aab7dd4cf9cbaf4b0acee.tar.gz kdepimpi-72fcd35606475a620a8aab7dd4cf9cbaf4b0acee.tar.bz2 |
crypto changes
-rw-r--r-- | pwmanager/pwmanager/pwmanagerE.pro | 11 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmdoc.cpp | 2 |
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 |
6 | OBJECTS_DIR = obj/$(PLATFORM) | 6 | OBJECTS_DIR = obj/$(PLATFORM) |
7 | MOC_DIR = moc/$(PLATFORM) | 7 | MOC_DIR = moc/$(PLATFORM) |
8 | DESTDIR=$(QPEDIR)/bin | 8 | DESTDIR=$(QPEDIR)/bin |
9 | 9 | ||
10 | INCLUDEPATH += . ../../ ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils $(QPEDIR)/include | 10 | INCLUDEPATH += . ../../ ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils $(QPEDIR)/include |
11 | DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY | 11 | DEFINES += 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 | 15 | LIBS += -L../libcrypt/$(PLATFORM) | |
16 | LIBS += -lmicrokde | 16 | LIBS += -lmicrokde |
17 | LIBS += -lmicroqtcompat | 17 | LIBS += -lmicroqtcompat |
18 | LIBS += -lmicrokdepim | 18 | LIBS += -lmicrokdepim |
19 | LIBS += -L$(QPEDIR)/lib | 19 | LIBS += -L$(QPEDIR)/lib |
20 | LIBS += -lqpe | 20 | LIBS += -lqpe |
21 | LIBS += -lz | 21 | LIBS += -lzlib |
22 | #LIBS += -lbz2 | 22 | #LIBS += -lbz2 |
23 | LIBS += -lgcrypt | 23 | #LIBS += -lkpmicrogcrypt |
24 | LIBS += -ljpeg | ||
24 | LIBS += $(QTOPIALIB) | 25 | LIBS += $(QTOPIALIB) |
26 | LIBS += -lkpmicrocipher | ||
27 | LIBS += -lkpmicroerror | ||
28 | LIBS += -lkpmicrompi | ||
29 | LIBS += -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 | ||
50 | HEADERS = \ | 55 | HEADERS = \ |
51 | addentrywnd_emb.h \ | 56 | addentrywnd_emb.h \ |
52 | addentrywndimpl.h \ | 57 | addentrywndimpl.h \ |
53 | base64.h \ | 58 | base64.h \ |
54 | binentrygen.h \ | 59 | binentrygen.h \ |
55 | blowfish.h \ | 60 | blowfish.h \ |
56 | commentbox.h \ | 61 | commentbox.h \ |
57 | compiler.h \ | 62 | compiler.h \ |
58 | compressgzip.h \ | 63 | compressgzip.h \ |
59 | findwnd_emb.h \ | 64 | findwnd_emb.h \ |
60 | findwndimpl.h \ | 65 | findwndimpl.h \ |
61 | genpasswd.h \ | 66 | genpasswd.h \ |
62 | getkeycardwnd.h \ | 67 | getkeycardwnd.h \ |
63 | getmasterpwwnd_emb.h \ | 68 | getmasterpwwnd_emb.h \ |
64 | getmasterpwwndimpl.h \ | 69 | getmasterpwwndimpl.h \ |
65 | globalstuff.h \ | 70 | globalstuff.h \ |
66 | gpasmanfile.h \ | 71 | gpasmanfile.h \ |
67 | htmlgen.h \ | 72 | htmlgen.h \ |
68 | htmlparse.h \ | 73 | htmlparse.h \ |
69 | ipc.h \ | 74 | ipc.h \ |
70 | libgcryptif.h \ | 75 | libgcryptif.h \ |
71 | listobjselectwnd.h \ | 76 | listobjselectwnd.h \ |
72 | listviewpwm.h \ | 77 | listviewpwm.h \ |
73 | printtext.h \ | 78 | printtext.h \ |
74 | pwgenwnd_emb.h \ | 79 | pwgenwnd_emb.h \ |
75 | pwgenwndimpl.h \ | 80 | pwgenwndimpl.h \ |
76 | pwmdoc.h \ | 81 | pwmdoc.h \ |
77 | pwmdocui.h \ | 82 | pwmdocui.h \ |
78 | pwmexception.h \ | 83 | pwmexception.h \ |
79 | pwm.h \ | 84 | pwm.h \ |
80 | pwminit.h \ | 85 | pwminit.h \ |
81 | pwmprefs.h \ | 86 | pwmprefs.h \ |
82 | pwmprint.h \ | 87 | pwmprint.h \ |
83 | pwmtray.h \ | 88 | pwmtray.h \ |
84 | pwmview.h \ | 89 | pwmview.h \ |
85 | pwmviewstyle_0.h \ | 90 | pwmviewstyle_0.h \ |
86 | pwmviewstyle_1.h \ | 91 | pwmviewstyle_1.h \ |
87 | pwmviewstyle.h \ | 92 | pwmviewstyle.h \ |
88 | randomizer.h \ | 93 | randomizer.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 | ||
302 | PwMDocList PwMDoc::openDocList; | 302 | PwMDocList PwMDoc::openDocList; |
303 | unsigned int PwMDocList::unnamedDocCnt = 1; | 303 | unsigned int PwMDocList::unnamedDocCnt = 1; |
304 | 304 | ||
305 | PwMDoc::PwMDoc(QObject *parent, const char *name) | 305 | PwMDoc::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 | ||
323 | PwMDoc::~PwMDoc() | 323 | PwMDoc::~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 | ||
330 | PwMerror PwMDoc::saveDoc(char compress, const QString *file) | 330 | PwMerror 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 | } |