summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-19 20:18:42 (UTC)
committer zautrix <zautrix>2004-10-19 20:18:42 (UTC)
commit72fcd35606475a620a8aab7dd4cf9cbaf4b0acee (patch) (unidiff)
tree396f0af18109c1cbc0075d9409743fc2fc1c650b
parenteca49bb06a71980ef61d078904573f25890fc7f2 (diff)
downloadkdepimpi-72fcd35606475a620a8aab7dd4cf9cbaf4b0acee.zip
kdepimpi-72fcd35606475a620a8aab7dd4cf9cbaf4b0acee.tar.gz
kdepimpi-72fcd35606475a620a8aab7dd4cf9cbaf4b0acee.tar.bz2
crypto changes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile24
-rw-r--r--pwmanager/pwmanager/pwmanagerE.pro11
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp2
3 files changed, 33 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 84f909e..8c6110c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,338 +1,362 @@
1export KDEPIMDIR = $(shell pwd) 1export KDEPIMDIR = $(shell pwd)
2 2
3export KDEPIM_VERSION=$(shell sed -e 's/.*\"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/' < version) 3export KDEPIM_VERSION=$(shell sed -e 's/.*\"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/' < version)
4 4
5ifeq ($(PLATFORM) , zaurus) 5ifeq ($(PLATFORM) , zaurus)
6 BUILD_NO_LDAP_PLUGIN=1 6 BUILD_NO_LDAP_PLUGIN=1
7endif 7endif
8 8
9ifneq ($(PLATFORM) , zaurus) 9ifneq ($(PLATFORM) , zaurus)
10 BUILD_NO_SHARP_PLUGIN=1 10 BUILD_NO_SHARP_PLUGIN=1
11endif 11endif
12 12
13SUBDIRS_MICROKDE = \ 13SUBDIRS_MICROKDE = \
14 libical/src/libical \ 14 libical/src/libical \
15 libical/src/libicalss \ 15 libical/src/libicalss \
16 qtcompat \ 16 qtcompat \
17 microkde \ 17 microkde \
18 libkcal \ 18 libkcal \
19 libkdepim \ 19 libkdepim \
20 kabc \ 20 kabc \
21 kabc/formats/binary \ 21 kabc/formats/binary \
22 kabc/plugins/file \ 22 kabc/plugins/file \
23 kabc/plugins/dir \ 23 kabc/plugins/dir \
24 korganizer \ 24 korganizer \
25 kalarmd \ 25 kalarmd \
26 kaddressbook 26 kaddressbook
27 27
28SUBDIRS_QTOPIA_PLUGIN = \ 28SUBDIRS_QTOPIA_PLUGIN = \
29 kabc/plugins/qtopia 29 kabc/plugins/qtopia
30 30
31SUBDIRS_OPIE_PLUGIN = \ 31SUBDIRS_OPIE_PLUGIN = \
32 kabc/plugins/opie 32 kabc/plugins/opie
33 33
34SUBDIRS_SHARP_PLUGIN = \ 34SUBDIRS_SHARP_PLUGIN = \
35 kabc/plugins/sharpdtm 35 kabc/plugins/sharpdtm
36 36
37SUBDIRS_LDAP_PLUGIN = \ 37SUBDIRS_LDAP_PLUGIN = \
38 kabc/plugins/ldap 38 kabc/plugins/ldap
39 39
40SUBDIRS_MICROMAIL = \ 40SUBDIRS_MICROMAIL = \
41 kmicromail/libetpan \ 41 kmicromail/libetpan \
42 kmicromail/libmailwrapper \ 42 kmicromail/libmailwrapper \
43 kmicromail 43 kmicromail
44 44
45SUBDIRS_GAMMU = \ 45SUBDIRS_GAMMU = \
46 gammu/emb/common \ 46 gammu/emb/common \
47 gammu/emb/gammu 47 gammu/emb/gammu
48 48
49SUBDIRS_PWMANAGER = \ 49SUBDIRS_PWMANAGER = \
50 pwmanager/libcrypt/mpi \
51 pwmanager/libcrypt/error \
52 pwmanager/libcrypt/cipher \
53 pwmanager/libcrypt/zlib \
50 pwmanager/pwmanager 54 pwmanager/pwmanager
51 55
52SUBDIRS = \ 56SUBDIRS = \
53 $(SUBDIRS_MICROKDE) \ 57 $(SUBDIRS_MICROKDE) \
54 $(SUBDIRS_QTOPIA_PLUGIN) \ 58 $(SUBDIRS_QTOPIA_PLUGIN) \
55 $(SUBDIRS_OPIE_PLUGIN) \ 59 $(SUBDIRS_OPIE_PLUGIN) \
56 $(SUBDIRS_SHARP_PLUGIN) \ 60 $(SUBDIRS_SHARP_PLUGIN) \
57 $(SUBDIRS_LDAP_PLUGIN) \ 61 $(SUBDIRS_LDAP_PLUGIN) \
58 $(SUBDIRS_MICROMAIL) \ 62 $(SUBDIRS_MICROMAIL) \
59 $(SUBDIRS_GAMMU) \ 63 $(SUBDIRS_GAMMU) \
60 $(SUBDIRS_PWMANAGER) 64 $(SUBDIRS_PWMANAGER)
61 65
62 66
63all: build_microkde \ 67all: build_microkde \
64 build_qtopia_plugin \ 68 build_qtopia_plugin \
65 build_opie_plugin \ 69 build_opie_plugin \
66 build_sharp_plugin \ 70 build_sharp_plugin \
67 build_ldap_plugin \ 71 build_ldap_plugin \
68 build_micromail \ 72 build_micromail \
69 build_gammu \ 73 build_gammu \
70 build_pwmanager 74 build_pwmanager
71 75
72 76
73build_microkde: variable_test tmake 77build_microkde: variable_test tmake
74 for i in $(SUBDIRS_MICROKDE); do pushd $$i; \ 78 for i in $(SUBDIRS_MICROKDE); do pushd $$i; \
75 make -f Makefile$(PLATFORM) || exit 1; popd; \ 79 make -f Makefile$(PLATFORM) || exit 1; popd; \
76 done 80 done
77 81
78build_qtopia_plugin: build_microkde 82build_qtopia_plugin: build_microkde
79 ifdef BUILD_NO_QTOPIA_PLUGIN 83 ifdef BUILD_NO_QTOPIA_PLUGIN
80 @echo == qtopia plugin not build. 84 @echo == qtopia plugin not build.
81 else 85 else
82 for i in $(SUBDIRS_QTOPIA_PLUGIN); do pushd $$i; \ 86 for i in $(SUBDIRS_QTOPIA_PLUGIN); do pushd $$i; \
83 make -f Makefile$(PLATFORM) || exit 1; popd; \ 87 make -f Makefile$(PLATFORM) || exit 1; popd; \
84 done 88 done
85 endif 89 endif
86 90
87build_opie_plugin: build_microkde 91build_opie_plugin: build_microkde
88 ifdef BUILD_NO_OPIE_PLUGIN 92 ifdef BUILD_NO_OPIE_PLUGIN
89 @echo == opie plugin not build. 93 @echo == opie plugin not build.
90 else 94 else
91 for i in $(SUBDIRS_OPIE_PLUGIN); do pushd $$i; \ 95 for i in $(SUBDIRS_OPIE_PLUGIN); do pushd $$i; \
92 make -f Makefile$(PLATFORM) || exit 1; popd; \ 96 make -f Makefile$(PLATFORM) || exit 1; popd; \
93 done 97 done
94 endif 98 endif
95 99
96build_sharp_plugin: build_microkde 100build_sharp_plugin: build_microkde
97 ifdef BUILD_NO_SHARP_PLUGIN 101 ifdef BUILD_NO_SHARP_PLUGIN
98 @echo == ldap plugin not build. 102 @echo == ldap plugin not build.
99 else 103 else
100 for i in $(SUBDIRS_SHARP_PLUGIN); do pushd $$i; \ 104 for i in $(SUBDIRS_SHARP_PLUGIN); do pushd $$i; \
101 make -f Makefile$(PLATFORM) || exit 1; popd; \ 105 make -f Makefile$(PLATFORM) || exit 1; popd; \
102 done 106 done
103 endif 107 endif
104 108
105build_ldap_plugin: build_microkde 109build_ldap_plugin: build_microkde
106 ifdef BUILD_NO_LDAP_PLUGIN 110 ifdef BUILD_NO_LDAP_PLUGIN
107 @echo == ldap plugin not build. 111 @echo == ldap plugin not build.
108 else 112 else
109 for i in $(SUBDIRS_LDAP_PLUGIN); do pushd $$i; \ 113 for i in $(SUBDIRS_LDAP_PLUGIN); do pushd $$i; \
110 make -f Makefile$(PLATFORM) || exit 1; popd; \ 114 make -f Makefile$(PLATFORM) || exit 1; popd; \
111 done 115 done
112 endif 116 endif
113 117
114 118
115build_micromail: build_microkde 119build_micromail: build_microkde
116 ifdef BUILD_NO_MICROMAIL 120 ifdef BUILD_NO_MICROMAIL
117 @echo == kmicromail not build. 121 @echo == kmicromail not build.
118 else 122 else
119 for i in $(SUBDIRS_MICROMAIL); do pushd $$i; \ 123 for i in $(SUBDIRS_MICROMAIL); do pushd $$i; \
120 make -f Makefile$(PLATFORM) || exit 1; popd; \ 124 make -f Makefile$(PLATFORM) || exit 1; popd; \
121 done 125 done
122 endif 126 endif
123 127
124build_gammu: variable_test tmake 128build_gammu: variable_test tmake
125 ifdef BUILD_NO_GAMMU 129 ifdef BUILD_NO_GAMMU
126 @echo == gammu not build. 130 @echo == gammu not build.
127 else 131 else
128 for i in $(SUBDIRS_GAMMU); do pushd $$i; \ 132 for i in $(SUBDIRS_GAMMU); do pushd $$i; \
129 make -f Makefile$(PLATFORM) || exit 1; popd; \ 133 make -f Makefile$(PLATFORM) || exit 1; popd; \
130 done 134 done
131 endif 135 endif
132 136
133build_pwmanager: build_microkde 137build_pwmanager: build_microkde
134 ifdef BUILD_NO_PWMANAGER 138 ifdef BUILD_NO_PWMANAGER
135 @echo == pwmanager not build. 139 @echo == pwmanager not build.
136 else 140 else
137 for i in $(SUBDIRS_PWMANAGER); do pushd $$i; \ 141 for i in $(SUBDIRS_PWMANAGER); do pushd $$i; \
138 make -f Makefile$(PLATFORM) || exit 1; popd; \ 142 make -f Makefile$(PLATFORM) || exit 1; popd; \
139 done 143 done
140 endif 144 endif
141 145
142 146
143variable_info: 147variable_info:
144 @echo -------------------------------------- 148 @echo --------------------------------------
145 @echo KDEPIM buildsystem, variableinfo... 149 @echo KDEPIM buildsystem, variableinfo...
146 @echo KDEPIMDIR=$(KDEPIMDIR) 150 @echo KDEPIMDIR=$(KDEPIMDIR)
147 @echo QTDIR=$(QTDIR) 151 @echo QTDIR=$(QTDIR)
148 @echo QPEDIR=$(QPEDIR) 152 @echo QPEDIR=$(QPEDIR)
149 @echo OPIEDIR=$(OPIEDIR) 153 @echo OPIEDIR=$(OPIEDIR)
150 @echo PLATFORM=$(PLATFORM) 154 @echo PLATFORM=$(PLATFORM)
151 @echo RELEASE_DEBUG=$(RELEASE_DEBUG) 155 @echo RELEASE_DEBUG=$(RELEASE_DEBUG)
152 @echo BUILD_NO_MICROMAIL=$(BUILD_NO_MICROMAIL) 156 @echo BUILD_NO_MICROMAIL=$(BUILD_NO_MICROMAIL)
153 @echo BUILD_NO_LDAP_PLUGIN=$(BUILD_NO_LDAP_PLUGIN) 157 @echo BUILD_NO_LDAP_PLUGIN=$(BUILD_NO_LDAP_PLUGIN)
154 @echo BUILD_NO_OPIE_PLUGIN=$(BUILD_NO_OPIE_PLUGIN) 158 @echo BUILD_NO_OPIE_PLUGIN=$(BUILD_NO_OPIE_PLUGIN)
155 @echo BUILD_NO_QTOPIA_PLUGIN=$(BUILD_NO_QTOPIA_PLUGIN) 159 @echo BUILD_NO_QTOPIA_PLUGIN=$(BUILD_NO_QTOPIA_PLUGIN)
156 @echo BUILD_NO_SHARP_PLUGIN=$(BUILD_NO_SHARP_PLUGIN) 160 @echo BUILD_NO_SHARP_PLUGIN=$(BUILD_NO_SHARP_PLUGIN)
157 ifndef BUILD_NO_SHARP_PLUGIN 161 ifndef BUILD_NO_SHARP_PLUGIN
158 @echo SHARPDTMSDK=$(SHARPDTMSDK) 162 @echo SHARPDTMSDK=$(SHARPDTMSDK)
159 endif 163 endif
160 @echo BUILD_NO_GAMMU=$(BUILD_NO_GAMMU) 164 @echo BUILD_NO_GAMMU=$(BUILD_NO_GAMMU)
161 @echo BUILD_NO_PWMANAGER=$(BUILD_NO_PWMANAGER) 165 @echo BUILD_NO_PWMANAGER=$(BUILD_NO_PWMANAGER)
162 @echo -------------------------------------- 166 @echo --------------------------------------
163 167
164variable_test: variable_info 168variable_test: variable_info
165 @echo KDEPIM buildsystem, variablecheck... 169 @echo KDEPIM buildsystem, variablecheck...
166 ifndef KDEPIMDIR 170 ifndef KDEPIMDIR
167 @echo KDEPIMDIR is not defined. 171 @echo KDEPIMDIR is not defined.
168 $(error KDEPIMDIR is not defined) 172 $(error KDEPIMDIR is not defined)
169 endif 173 endif
170 ifndef PLATFORM 174 ifndef PLATFORM
171 @echo PLATFORM is not defined. 175 @echo PLATFORM is not defined.
172 $(error PLATFORM is not defined) 176 $(error PLATFORM is not defined)
173 endif 177 endif
174 ifdef BUILD_NO_LDAP_PLUGIN 178 ifdef BUILD_NO_LDAP_PLUGIN
175 @echo LDAP PLUGIN will not be build, because BUILD_NO_LDAP_PLUGIN is set to $(BUILD_NO_LDAP_PLUGIN) 179 @echo LDAP PLUGIN will not be build, because BUILD_NO_LDAP_PLUGIN is set to $(BUILD_NO_LDAP_PLUGIN)
176 endif 180 endif
177 ifdef BUILD_NO_OPIE_PLUGIN 181 ifdef BUILD_NO_OPIE_PLUGIN
178 @echo OPIE PLUGIN will not be build, because BUILD_NO_OPIE_PLUGIN is set to $(BUILD_NO_OPIE_PLUGIN) 182 @echo OPIE PLUGIN will not be build, because BUILD_NO_OPIE_PLUGIN is set to $(BUILD_NO_OPIE_PLUGIN)
179 endif 183 endif
180 ifdef BUILD_NO_QTOPIA_PLUGIN 184 ifdef BUILD_NO_QTOPIA_PLUGIN
181 @echo QTOPIA PLUGIN will not be build, because BUILD_NO__QTOPIA_PLUGIN is set to $(BUILD_NO__QTOPIA_PLUGIN) 185 @echo QTOPIA PLUGIN will not be build, because BUILD_NO__QTOPIA_PLUGIN is set to $(BUILD_NO__QTOPIA_PLUGIN)
182 endif 186 endif
183 ifdef BUILD_NO_MICROMAIL 187 ifdef BUILD_NO_MICROMAIL
184 @echo MICROMAIL will not be build, because BUILD_NO_MICROMAIL is set to $(BUILD_NO_MICROMAIL) 188 @echo MICROMAIL will not be build, because BUILD_NO_MICROMAIL is set to $(BUILD_NO_MICROMAIL)
185 endif 189 endif
186 ifdef BUILD_NO_SHARP_PLUGIN 190 ifdef BUILD_NO_SHARP_PLUGIN
187 @echo SHARP PLUGIN will not be build, because BUILD_NO_SHARP_PLUGIN is set to $(BUILD_NO_SHARP_PLUGIN) 191 @echo SHARP PLUGIN will not be build, because BUILD_NO_SHARP_PLUGIN is set to $(BUILD_NO_SHARP_PLUGIN)
188 else 192 else
189 ifndef SHARPDTMSDK 193 ifndef SHARPDTMSDK
190 @echo SHARP PLUGIN can not be build, because SHARPDTMSDK is set to $(SHARPDTMSDK) 194 @echo SHARP PLUGIN can not be build, because SHARPDTMSDK is set to $(SHARPDTMSDK)
191 $(error SHARPDTMSDK is not defined) 195 $(error SHARPDTMSDK is not defined)
192 endif 196 endif
193 endif 197 endif
194 ifdef BUILD_NO_GAMMU 198 ifdef BUILD_NO_GAMMU
195 @echo GAMMU will not be build, because BUILD_NO_GAMMU is set to $(BUILD_NO_GAMMU) 199 @echo GAMMU will not be build, because BUILD_NO_GAMMU is set to $(BUILD_NO_GAMMU)
196 endif 200 endif
197 ifdef BUILD_NO_PWMANAGER 201 ifdef BUILD_NO_PWMANAGER
198 @echo PWMANAGER will not be build, because BUILD_NO_PWMANAGER is set to $(BUILD_NO_PWMANAGER) 202 @echo PWMANAGER will not be build, because BUILD_NO_PWMANAGER is set to $(BUILD_NO_PWMANAGER)
199 endif 203 endif
200 @echo -------------------------------------- 204 @echo --------------------------------------
201 205
202 206
203objects: 207objects:
204 for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done 208 for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done
205 for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done 209 for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done
206 mkdir -p libical/lib/$(PLATFORM) 210 mkdir -p libical/lib/$(PLATFORM)
211 mkdir -p pwmanager/libcrypt/$(PLATFORM)
207 212
208clean: 213clean:
209 rm -rf libical/lib/$(PLATFORM)/*; 214 rm -rf libical/lib/$(PLATFORM)/*;
215 rm -rf pwmanager/libcrypt/$(PLATFORM)/*;
210 for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\ 216 for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\
211 rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \ 217 rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \
212 done 218 done
213 219
214install: 220install:
215 221
216 cd bin/kdepim; make install 222 cd bin/kdepim; make install
217 cp -r Pim $(QPEDIR)/apps 223 cp -r Pim $(QPEDIR)/apps
218 cp db2file/db2file $(QPEDIR)/bin/db2file 224 cp db2file/db2file $(QPEDIR)/bin/db2file
219 cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop 225 cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop
220 cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop 226 cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop
221 cp kmicromail/kmicromail.desktop $(QPEDIR)/apps/Pim/kopiemail.desktop 227 cp kmicromail/kmicromail.desktop $(QPEDIR)/apps/Pim/kopiemail.desktop
222 cp pwmanager/pwmanager/pwmanager.desktop $(QPEDIR)/apps/Pim/pwmanager.desktop 228 cp pwmanager/pwmanager/pwmanager.desktop $(QPEDIR)/apps/Pim/pwmanager.desktop
223 229
224dist: 230dist:
225 @echo Dont forget to do "make install" before "make dist" 231 @echo Dont forget to do "make install" before "make dist"
226 rm -f *arm.ipk 232 rm -f *arm.ipk
227 rm -f *~ 233 rm -f *~
228 cd ..; tar czf kdepim.src.tar.gz --exclude=obj --exclude=moc --exclude=CVS --exclude=Makefilezaurus --exclude=Makefileqtopia kdepim 234 cd ..; tar czf kdepim.src.tar.gz --exclude=obj --exclude=moc --exclude=CVS --exclude=Makefilezaurus --exclude=Makefileqtopia kdepim
229 mkipks kmicrokdelibs.control 235 mkipks kmicrokdelibs.control
230 mkipks korganizer.control 236 mkipks korganizer.control
231 mkipks kaddressbook.control 237 mkipks kaddressbook.control
232 ifndef BUILD_NO_MICROMAIL 238 ifndef BUILD_NO_MICROMAIL
233 mkipks kopiemail.control 239 mkipks kopiemail.control
234 endif 240 endif
235 mkipks korganizer-alarm.control 241 mkipks korganizer-alarm.control
236 ifndef BUILD_NO_GAMMU 242 ifndef BUILD_NO_GAMMU
237 mkipks phoneaccess.control 243 mkipks phoneaccess.control
238 endif 244 endif
239 ifndef BUILD_NO_PWMANAGER 245 ifndef BUILD_NO_PWMANAGER
240 mkipks pwmanager.control 246 mkipks pwmanager.control
241 endif 247 endif
242 mkipks pim_TAB_icon.control 248 mkipks pim_TAB_icon.control
243 249
244tmake: objects \ 250tmake: objects \
245 qtcompat/Makefile$(PLATFORM) \ 251 qtcompat/Makefile$(PLATFORM) \
246 microkde/Makefile$(PLATFORM) \ 252 microkde/Makefile$(PLATFORM) \
247 libkcal/Makefile$(PLATFORM) \ 253 libkcal/Makefile$(PLATFORM) \
248 libkdepim/Makefile$(PLATFORM) \ 254 libkdepim/Makefile$(PLATFORM) \
249 korganizer/Makefile$(PLATFORM) \ 255 korganizer/Makefile$(PLATFORM) \
250 kalarmd/Makefile$(PLATFORM) \ 256 kalarmd/Makefile$(PLATFORM) \
251 libical/src/libical/Makefile$(PLATFORM) \ 257 libical/src/libical/Makefile$(PLATFORM) \
252 libical/src/libicalss/Makefile$(PLATFORM) \ 258 libical/src/libicalss/Makefile$(PLATFORM) \
253 kabc/Makefile$(PLATFORM) \ 259 kabc/Makefile$(PLATFORM) \
254 kabc/formats/binary/Makefile$(PLATFORM) \ 260 kabc/formats/binary/Makefile$(PLATFORM) \
255 kabc/plugins/file/Makefile$(PLATFORM) \ 261 kabc/plugins/file/Makefile$(PLATFORM) \
256 kabc/plugins/dir/Makefile$(PLATFORM) \ 262 kabc/plugins/dir/Makefile$(PLATFORM) \
257 kabc/plugins/ldap/Makefile$(PLATFORM) \ 263 kabc/plugins/ldap/Makefile$(PLATFORM) \
258 kabc/plugins/opie/Makefile$(PLATFORM) \ 264 kabc/plugins/opie/Makefile$(PLATFORM) \
259 kabc/plugins/qtopia/Makefile$(PLATFORM) \ 265 kabc/plugins/qtopia/Makefile$(PLATFORM) \
260 kabc/plugins/sharpdtm/Makefile$(PLATFORM) \ 266 kabc/plugins/sharpdtm/Makefile$(PLATFORM) \
261 kaddressbook/Makefile$(PLATFORM) \ 267 kaddressbook/Makefile$(PLATFORM) \
262 kmicromail/Makefile$(PLATFORM) \ 268 kmicromail/Makefile$(PLATFORM) \
263 kmicromail/libetpan/Makefile$(PLATFORM) \ 269 kmicromail/libetpan/Makefile$(PLATFORM) \
264 kmicromail/libmailwrapper/Makefile$(PLATFORM) \ 270 kmicromail/libmailwrapper/Makefile$(PLATFORM) \
265 gammu/emb/common/Makefile$(PLATFORM) \ 271 gammu/emb/common/Makefile$(PLATFORM) \
266 gammu/emb/gammu/Makefile$(PLATFORM) \ 272 gammu/emb/gammu/Makefile$(PLATFORM) \
267 pwmanager/pwmanager/Makefile$(PLATFORM) \ 273 pwmanager/pwmanager/Makefile$(PLATFORM) \
274 pwmanager/libcrypt/mpi/Makefile$(PLATFORM) \
275 pwmanager/libcrypt/error/Makefile$(PLATFORM) \
276 pwmanager/libcrypt/cipher/Makefile$(PLATFORM) \
277 pwmanager/libcrypt/zlib/Makefile$(PLATFORM)
268 278
269qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro 279qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro
270 cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" qtcompat.pro -o Makefile$(PLATFORM) 280 cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" qtcompat.pro -o Makefile$(PLATFORM)
271 281
272microkde/Makefile$(PLATFORM): microkde/microkdeE.pro 282microkde/Makefile$(PLATFORM): microkde/microkdeE.pro
273 cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" microkdeE.pro -o Makefile$(PLATFORM) 283 cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" microkdeE.pro -o Makefile$(PLATFORM)
274 284
275libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro 285libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro
276 cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libkcalE.pro -o Makefile$(PLATFORM) 286 cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libkcalE.pro -o Makefile$(PLATFORM)
277 287
278 288
279libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro 289libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro
280 cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libkdepimE.pro -o Makefile$(PLATFORM) 290 cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libkdepimE.pro -o Makefile$(PLATFORM)
281 291
282kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro 292kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro
283 cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kalarmdE.pro -o Makefile$(PLATFORM) 293 cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kalarmdE.pro -o Makefile$(PLATFORM)
284 294
285korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro 295korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro
286 cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" korganizerE.pro -o Makefile$(PLATFORM) 296 cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" korganizerE.pro -o Makefile$(PLATFORM)
287 297
288libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro 298libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro
289 cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libicalE.pro -o Makefile$(PLATFORM) 299 cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libicalE.pro -o Makefile$(PLATFORM)
290 300
291libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro 301libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro
292 cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libicalssE.pro -o Makefile$(PLATFORM) 302 cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libicalssE.pro -o Makefile$(PLATFORM)
293 303
294kabc/Makefile$(PLATFORM): kabc/kabcE.pro 304kabc/Makefile$(PLATFORM): kabc/kabcE.pro
295 cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kabcE.pro -o Makefile$(PLATFORM) 305 cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kabcE.pro -o Makefile$(PLATFORM)
296 306
297kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro 307kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro
298 cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kabcformat_binaryE.pro -o Makefile$(PLATFORM) 308 cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kabcformat_binaryE.pro -o Makefile$(PLATFORM)
299 309
300kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro 310kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro
301 cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" fileE.pro -o Makefile$(PLATFORM) 311 cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" fileE.pro -o Makefile$(PLATFORM)
302 312
303kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/dirE.pro 313kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/dirE.pro
304 cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" dirE.pro -o Makefile$(PLATFORM) 314 cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" dirE.pro -o Makefile$(PLATFORM)
305 315
306kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro 316kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro
307 cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" ldapE.pro -o Makefile$(PLATFORM) 317 cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" ldapE.pro -o Makefile$(PLATFORM)
308 318
309kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro 319kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro
310 cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" opieE.pro -o Makefile$(PLATFORM) 320 cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" opieE.pro -o Makefile$(PLATFORM)
311 321
312kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro 322kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro
313 cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" qtopiaE.pro -o Makefile$(PLATFORM) 323 cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" qtopiaE.pro -o Makefile$(PLATFORM)
314 324
315kabc/plugins/sharpdtm/Makefile$(PLATFORM): kabc/plugins/sharpdtm/sharpdtmE.pro 325kabc/plugins/sharpdtm/Makefile$(PLATFORM): kabc/plugins/sharpdtm/sharpdtmE.pro
316 cd kabc/plugins/sharpdtm; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" sharpdtmE.pro -o Makefile$(PLATFORM) 326 cd kabc/plugins/sharpdtm; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" sharpdtmE.pro -o Makefile$(PLATFORM)
317 327
318kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro 328kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro
319 cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kaddressbookE.pro -o Makefile$(PLATFORM) 329 cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kaddressbookE.pro -o Makefile$(PLATFORM)
320 330
321kmicromail/Makefile$(PLATFORM): kmicromail/kmicromailE.pro 331kmicromail/Makefile$(PLATFORM): kmicromail/kmicromailE.pro
322 cd kmicromail; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kmicromailE.pro -o Makefile$(PLATFORM) 332 cd kmicromail; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kmicromailE.pro -o Makefile$(PLATFORM)
323 333
324kmicromail/libetpan/Makefile$(PLATFORM): kmicromail/libetpan/libetpanE.pro 334kmicromail/libetpan/Makefile$(PLATFORM): kmicromail/libetpan/libetpanE.pro
325 cd kmicromail/libetpan; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libetpanE.pro -o Makefile$(PLATFORM) 335 cd kmicromail/libetpan; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libetpanE.pro -o Makefile$(PLATFORM)
326 336
327kmicromail/libmailwrapper/Makefile$(PLATFORM): kmicromail/libmailwrapper/libmailwrapperE.pro 337kmicromail/libmailwrapper/Makefile$(PLATFORM): kmicromail/libmailwrapper/libmailwrapperE.pro
328 cd kmicromail/libmailwrapper; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libmailwrapperE.pro -o Makefile$(PLATFORM) 338 cd kmicromail/libmailwrapper; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libmailwrapperE.pro -o Makefile$(PLATFORM)
329 339
330gammu/emb/common/Makefile$(PLATFORM): gammu/emb/common/commonE.pro 340gammu/emb/common/Makefile$(PLATFORM): gammu/emb/common/commonE.pro
331 cd gammu/emb/common; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" commonE.pro -o Makefile$(PLATFORM) 341 cd gammu/emb/common; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" commonE.pro -o Makefile$(PLATFORM)
332 342
333gammu/emb/gammu/Makefile$(PLATFORM): gammu/emb/gammu/gammuE.pro 343gammu/emb/gammu/Makefile$(PLATFORM): gammu/emb/gammu/gammuE.pro
334 cd gammu/emb/gammu; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" gammuE.pro -o Makefile$(PLATFORM) 344 cd gammu/emb/gammu; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" gammuE.pro -o Makefile$(PLATFORM)
335 345
336pwmanager/pwmanager/Makefile$(PLATFORM): pwmanager/pwmanager/pwmanagerE.pro 346pwmanager/pwmanager/Makefile$(PLATFORM): pwmanager/pwmanager/pwmanagerE.pro
337 cd pwmanager/pwmanager; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" pwmanagerE.pro -o Makefile$(PLATFORM) 347 cd pwmanager/pwmanager; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" pwmanagerE.pro -o Makefile$(PLATFORM)
338 348
349
350pwmanager/libcrypt/mpi/Makefile$(PLATFORM): pwmanager/libcrypt/mpi/mpi.pro
351 cd pwmanager/libcrypt/mpi;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" mpi.pro -o Makefile$(PLATFORM)
352
353pwmanager/libcrypt/error/Makefile$(PLATFORM): pwmanager/libcrypt/error/error.pro
354 cd pwmanager/libcrypt/error;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" error.pro -o Makefile$(PLATFORM)
355
356pwmanager/libcrypt/cipher/Makefile$(PLATFORM): pwmanager/libcrypt/cipher/cipher.pro
357 cd pwmanager/libcrypt/cipher;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" cipher.pro -o Makefile$(PLATFORM)
358
359pwmanager/libcrypt/zlib/Makefile$(PLATFORM): pwmanager/libcrypt/zlib/zlib.pro
360 cd pwmanager/libcrypt/zlib;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" zlib.pro -o Makefile$(PLATFORM)
361
362
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,163 +1,168 @@
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 \
89rc2.h \ 94rc2.h \
90rencatwnd.h \ 95rencatwnd.h \
91serializer.h \ 96serializer.h \
92setmasterpwwnd_emb.h \ 97setmasterpwwnd_emb.h \
93setmasterpwwndimpl.h \ 98setmasterpwwndimpl.h \
94sha1.h \ 99sha1.h \
95waitwnd.h \ 100waitwnd.h \
96kcmconfigs/kcmpwmconfig.h \ 101kcmconfigs/kcmpwmconfig.h \
97kcmconfigs/pwmconfigwidget.h 102kcmconfigs/pwmconfigwidget.h
98 103
99#sources that need not be build 104#sources that need not be build
100#SOURCES = \ 105#SOURCES = \
101#advcommeditimpl.cpp \ 106#advcommeditimpl.cpp \
102#configuration.cpp \ 107#configuration.cpp \
103#configwnd.cpp \ 108#configwnd.cpp \
104#configwndimpl.cpp \ 109#configwndimpl.cpp \
105#configuration_31compat.cpp \ 110#configuration_31compat.cpp \
106#htmlparse.cpp \ 111#htmlparse.cpp \
107#printtext.cpp \ 112#printtext.cpp \
108#selftest.cpp \ 113#selftest.cpp \
109#pwmprint.cpp \ 114#pwmprint.cpp \
110#spinforsignal.cpp 115#spinforsignal.cpp
111#subtbledit.cpp \ 116#subtbledit.cpp \
112#subtbleditimpl.cpp \ 117#subtbleditimpl.cpp \
113#compressbzip2.cpp 118#compressbzip2.cpp
114 119
115 120
116SOURCES = \ 121SOURCES = \
117addentrywnd_emb.cpp \ 122addentrywnd_emb.cpp \
118addentrywndimpl.cpp \ 123addentrywndimpl.cpp \
119base64.cpp \ 124base64.cpp \
120binentrygen.cpp \ 125binentrygen.cpp \
121blowfish.cpp \ 126blowfish.cpp \
122commentbox.cpp \ 127commentbox.cpp \
123compressgzip.cpp \ 128compressgzip.cpp \
124findwnd_emb.cpp \ 129findwnd_emb.cpp \
125findwndimpl.cpp \ 130findwndimpl.cpp \
126genpasswd.cpp \ 131genpasswd.cpp \
127getkeycardwnd.cpp \ 132getkeycardwnd.cpp \
128getmasterpwwnd_emb.cpp \ 133getmasterpwwnd_emb.cpp \
129getmasterpwwndimpl.cpp \ 134getmasterpwwndimpl.cpp \
130globalstuff.cpp \ 135globalstuff.cpp \
131gpasmanfile.cpp \ 136gpasmanfile.cpp \
132htmlgen.cpp \ 137htmlgen.cpp \
133ipc.cpp \ 138ipc.cpp \
134libgcryptif.cpp \ 139libgcryptif.cpp \
135listobjselectwnd.cpp \ 140listobjselectwnd.cpp \
136listviewpwm.cpp \ 141listviewpwm.cpp \
137main.cpp \ 142main.cpp \
138pwgenwnd_emb.cpp \ 143pwgenwnd_emb.cpp \
139pwgenwndimpl.cpp \ 144pwgenwndimpl.cpp \
140pwm.cpp \ 145pwm.cpp \
141pwmdoc.cpp \ 146pwmdoc.cpp \
142pwmdocui.cpp \ 147pwmdocui.cpp \
143pwmexception.cpp \ 148pwmexception.cpp \
144pwminit.cpp \ 149pwminit.cpp \
145pwmprefs.cpp \ 150pwmprefs.cpp \
146pwmtray.cpp \ 151pwmtray.cpp \
147pwmview.cpp \ 152pwmview.cpp \
148pwmviewstyle_0.cpp \ 153pwmviewstyle_0.cpp \
149pwmviewstyle_1.cpp \ 154pwmviewstyle_1.cpp \
150pwmviewstyle.cpp \ 155pwmviewstyle.cpp \
151randomizer.cpp \ 156randomizer.cpp \
152rc2.cpp \ 157rc2.cpp \
153rencatwnd.cpp \ 158rencatwnd.cpp \
154serializer.cpp \ 159serializer.cpp \
155setmasterpwwnd_emb.cpp \ 160setmasterpwwnd_emb.cpp \
156setmasterpwwndimpl.cpp \ 161setmasterpwwndimpl.cpp \
157sha1.cpp \ 162sha1.cpp \
158waitwnd.cpp \ 163waitwnd.cpp \
159kcmconfigs/kcmpwmconfig.cpp \ 164kcmconfigs/kcmpwmconfig.cpp \
160kcmconfigs/pwmconfigwidget.cpp 165kcmconfigs/pwmconfigwidget.cpp
161 166
162 167
163 168
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
@@ -1,861 +1,861 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * copyright (C) 2003, 2004 by Michael Buesch * 3 * copyright (C) 2003, 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de * 4 * email: mbuesch@freenet.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License version 2 * 7 * it under the terms of the GNU General Public License version 2 *
8 * as published by the Free Software Foundation. * 8 * as published by the Free Software Foundation. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.1 of pwmanager 14 * This file is originaly based on version 1.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#include "pwmdoc.h" 20#include "pwmdoc.h"
21#include "pwmview.h" 21#include "pwmview.h"
22#include "blowfish.h" 22#include "blowfish.h"
23#include "sha1.h" 23#include "sha1.h"
24#include "globalstuff.h" 24#include "globalstuff.h"
25#include "gpasmanfile.h" 25#include "gpasmanfile.h"
26#include "serializer.h" 26#include "serializer.h"
27#include "compressgzip.h" 27#include "compressgzip.h"
28//US#include "compressbzip2.h" 28//US#include "compressbzip2.h"
29#include "randomizer.h" 29#include "randomizer.h"
30#include "pwminit.h" 30#include "pwminit.h"
31#include "libgcryptif.h" 31#include "libgcryptif.h"
32#ifdef PWM_EMBEDDED 32#ifdef PWM_EMBEDDED
33#include "pwmprefs.h" 33#include "pwmprefs.h"
34#include "kglobal.h" 34#include "kglobal.h"
35#endif 35#endif
36 36
37#include <kmessagebox.h> 37#include <kmessagebox.h>
38#include <libkcal/syncdefines.h> 38#include <libkcal/syncdefines.h>
39 39
40 40
41#ifdef CONFIG_KWALLETIF 41#ifdef CONFIG_KWALLETIF
42# include "kwalletemu.h" 42# include "kwalletemu.h"
43#endif // CONFIG_KWALLETIF 43#endif // CONFIG_KWALLETIF
44 44
45#include <qdatetime.h> 45#include <qdatetime.h>
46#include <qsize.h> 46#include <qsize.h>
47#include <qfileinfo.h> 47#include <qfileinfo.h>
48#include <qfile.h> 48#include <qfile.h>
49 49
50#include <stdio.h> 50#include <stdio.h>
51#include <stdlib.h> 51#include <stdlib.h>
52#include <errno.h> 52#include <errno.h>
53#include <string.h> 53#include <string.h>
54//US#include <iostream> 54//US#include <iostream>
55#include <algorithm> 55#include <algorithm>
56#include <sys/types.h> 56#include <sys/types.h>
57#include <sys/stat.h> 57#include <sys/stat.h>
58#include <unistd.h> 58#include <unistd.h>
59#include <stdint.h> 59#include <stdint.h>
60 60
61 61
62#ifdef PWM_EMBEDDED 62#ifdef PWM_EMBEDDED
63#ifndef Q_LONG 63#ifndef Q_LONG
64#define Q_LONG long 64#define Q_LONG long
65#endif 65#endif
66 66
67#ifndef Q_ULONG 67#ifndef Q_ULONG
68#define Q_ULONG unsigned long 68#define Q_ULONG unsigned long
69#endif 69#endif
70#endif //PWM_EMBEDDED 70#endif //PWM_EMBEDDED
71 71
72 72
73//TODO: reset to its normal value. 73//TODO: reset to its normal value.
74 #define META_CHECK_TIMER_INTERVAL10/*300*/ /* sek */ 74 #define META_CHECK_TIMER_INTERVAL10/*300*/ /* sek */
75 75
76using namespace std; 76using namespace std;
77 77
78 78
79void PwMDocList::add(PwMDoc *doc, const string &id) 79void PwMDocList::add(PwMDoc *doc, const string &id)
80{ 80{
81#ifdef PWM_DEBUG 81#ifdef PWM_DEBUG
82 // check for existance of object in debug mode only. 82 // check for existance of object in debug mode only.
83 vector<listItem>::iterator begin = docList.begin(), 83 vector<listItem>::iterator begin = docList.begin(),
84 end = docList.end(), 84 end = docList.end(),
85 i = begin; 85 i = begin;
86 while (i != end) { 86 while (i != end) {
87 if (i->doc == doc) { 87 if (i->doc == doc) {
88 BUG(); 88 BUG();
89 return; 89 return;
90 } 90 }
91 ++i; 91 ++i;
92 } 92 }
93#endif 93#endif
94 listItem newItem; 94 listItem newItem;
95 newItem.doc = doc; 95 newItem.doc = doc;
96 newItem.docId = id; 96 newItem.docId = id;
97 docList.push_back(newItem); 97 docList.push_back(newItem);
98} 98}
99 99
100void PwMDocList::edit(PwMDoc *doc, const string &newId) 100void PwMDocList::edit(PwMDoc *doc, const string &newId)
101{ 101{
102 vector<listItem>::iterator begin = docList.begin(), 102 vector<listItem>::iterator begin = docList.begin(),
103 end = docList.end(), 103 end = docList.end(),
104 i = begin; 104 i = begin;
105 while (i != end) { 105 while (i != end) {
106 if (i->doc == doc) { 106 if (i->doc == doc) {
107 i->docId = newId; 107 i->docId = newId;
108 return; 108 return;
109 } 109 }
110 ++i; 110 ++i;
111 } 111 }
112} 112}
113 113
114void PwMDocList::del(PwMDoc *doc) 114void PwMDocList::del(PwMDoc *doc)
115{ 115{
116 vector<listItem>::iterator begin = docList.begin(), 116 vector<listItem>::iterator begin = docList.begin(),
117 end = docList.end(), 117 end = docList.end(),
118 i = begin; 118 i = begin;
119 while (i != end) { 119 while (i != end) {
120 if (i->doc == doc) { 120 if (i->doc == doc) {
121 docList.erase(i); 121 docList.erase(i);
122 return; 122 return;
123 } 123 }
124 ++i; 124 ++i;
125 } 125 }
126} 126}
127 127
128bool PwMDocList::find(const string &id, listItem *ret) 128bool PwMDocList::find(const string &id, listItem *ret)
129{ 129{
130 vector<listItem>::iterator begin = docList.begin(), 130 vector<listItem>::iterator begin = docList.begin(),
131 end = docList.end(), 131 end = docList.end(),
132 i = begin; 132 i = begin;
133 while (i != end) { 133 while (i != end) {
134 if (i->docId == id) { 134 if (i->docId == id) {
135 if (ret) 135 if (ret)
136 *ret = *i; 136 *ret = *i;
137 return true; 137 return true;
138 } 138 }
139 ++i; 139 ++i;
140 } 140 }
141 return false; 141 return false;
142} 142}
143 143
144 144
145 145
146DocTimer::DocTimer(PwMDoc *_doc) 146DocTimer::DocTimer(PwMDoc *_doc)
147 : doc (_doc) 147 : doc (_doc)
148 , mpwLock (0) 148 , mpwLock (0)
149 , autoLockLock (0) 149 , autoLockLock (0)
150 , metaCheckLock (0) 150 , metaCheckLock (0)
151{ 151{
152 mpwTimer = new QTimer; 152 mpwTimer = new QTimer;
153 autoLockTimer = new QTimer; 153 autoLockTimer = new QTimer;
154 metaCheckTimer = new QTimer; 154 metaCheckTimer = new QTimer;
155 connect(mpwTimer, SIGNAL(timeout()), 155 connect(mpwTimer, SIGNAL(timeout()),
156 this, SLOT(mpwTimeout())); 156 this, SLOT(mpwTimeout()));
157 connect(autoLockTimer, SIGNAL(timeout()), 157 connect(autoLockTimer, SIGNAL(timeout()),
158 this, SLOT(autoLockTimeout())); 158 this, SLOT(autoLockTimeout()));
159 connect(metaCheckTimer, SIGNAL(timeout()), 159 connect(metaCheckTimer, SIGNAL(timeout()),
160 this, SLOT(metaCheckTimeout())); 160 this, SLOT(metaCheckTimeout()));
161} 161}
162 162
163DocTimer::~DocTimer() 163DocTimer::~DocTimer()
164{ 164{
165 delete mpwTimer; 165 delete mpwTimer;
166 delete autoLockTimer; 166 delete autoLockTimer;
167 delete metaCheckTimer; 167 delete metaCheckTimer;
168} 168}
169 169
170void DocTimer::start(TimerIDs timer) 170void DocTimer::start(TimerIDs timer)
171{ 171{
172 switch (timer) { 172 switch (timer) {
173 case id_mpwTimer: 173 case id_mpwTimer:
174 if (mpwTimer->isActive()) 174 if (mpwTimer->isActive())
175 mpwTimer->stop(); 175 mpwTimer->stop();
176 doc->setDocStatFlag(DOC_STAT_UNLOCK_WITHOUT_PW); 176 doc->setDocStatFlag(DOC_STAT_UNLOCK_WITHOUT_PW);
177 mpwTimer->start(conf()->confGlobPwTimeout() * 1000, true); 177 mpwTimer->start(conf()->confGlobPwTimeout() * 1000, true);
178 break; 178 break;
179 case id_autoLockTimer: 179 case id_autoLockTimer:
180 if (autoLockTimer->isActive()) 180 if (autoLockTimer->isActive())
181 autoLockTimer->stop(); 181 autoLockTimer->stop();
182 if (conf()->confGlobLockTimeout() > 0) 182 if (conf()->confGlobLockTimeout() > 0)
183 autoLockTimer->start(conf()->confGlobLockTimeout() * 1000, true); 183 autoLockTimer->start(conf()->confGlobLockTimeout() * 1000, true);
184 break; 184 break;
185 case id_metaCheckTimer: 185 case id_metaCheckTimer:
186 if (metaCheckTimer->isActive()) 186 if (metaCheckTimer->isActive())
187 metaCheckTimer->stop(); 187 metaCheckTimer->stop();
188 metaCheckTimer->start(META_CHECK_TIMER_INTERVAL * 1000, true); 188 metaCheckTimer->start(META_CHECK_TIMER_INTERVAL * 1000, true);
189 break; 189 break;
190 } 190 }
191} 191}
192 192
193void DocTimer::stop(TimerIDs timer) 193void DocTimer::stop(TimerIDs timer)
194{ 194{
195 switch (timer) { 195 switch (timer) {
196 case id_mpwTimer: 196 case id_mpwTimer:
197 mpwTimer->stop(); 197 mpwTimer->stop();
198 break; 198 break;
199 case id_autoLockTimer: 199 case id_autoLockTimer:
200 autoLockTimer->stop(); 200 autoLockTimer->stop();
201 break; 201 break;
202 case id_metaCheckTimer: 202 case id_metaCheckTimer:
203 metaCheckTimer->stop(); 203 metaCheckTimer->stop();
204 break; 204 break;
205 } 205 }
206} 206}
207 207
208void DocTimer::getLock(TimerIDs timer) 208void DocTimer::getLock(TimerIDs timer)
209{ 209{
210 switch (timer) { 210 switch (timer) {
211 case id_mpwTimer: 211 case id_mpwTimer:
212 ++mpwLock; 212 ++mpwLock;
213 break; 213 break;
214 case id_autoLockTimer: 214 case id_autoLockTimer:
215 ++autoLockLock; 215 ++autoLockLock;
216 break; 216 break;
217 case id_metaCheckTimer: 217 case id_metaCheckTimer:
218 ++metaCheckLock; 218 ++metaCheckLock;
219 break; 219 break;
220 } 220 }
221} 221}
222 222
223void DocTimer::putLock(TimerIDs timer) 223void DocTimer::putLock(TimerIDs timer)
224{ 224{
225 switch (timer) { 225 switch (timer) {
226 case id_mpwTimer: 226 case id_mpwTimer:
227 if (mpwLock) 227 if (mpwLock)
228 --mpwLock; 228 --mpwLock;
229 break; 229 break;
230 case id_autoLockTimer: 230 case id_autoLockTimer:
231 if (autoLockLock) 231 if (autoLockLock)
232 --autoLockLock; 232 --autoLockLock;
233 break; 233 break;
234 case id_metaCheckTimer: 234 case id_metaCheckTimer:
235 if (metaCheckLock) 235 if (metaCheckLock)
236 --metaCheckLock; 236 --metaCheckLock;
237 break; 237 break;
238 } 238 }
239} 239}
240 240
241void DocTimer::mpwTimeout() 241void DocTimer::mpwTimeout()
242{ 242{
243 if (mpwLock) { 243 if (mpwLock) {
244 mpwTimer->start(1000, true); 244 mpwTimer->start(1000, true);
245 return; 245 return;
246 } 246 }
247 doc->unsetDocStatFlag(DOC_STAT_UNLOCK_WITHOUT_PW); 247 doc->unsetDocStatFlag(DOC_STAT_UNLOCK_WITHOUT_PW);
248} 248}
249 249
250void DocTimer::autoLockTimeout() 250void DocTimer::autoLockTimeout()
251{ 251{
252 if (autoLockLock) { 252 if (autoLockLock) {
253 autoLockTimer->start(1000, true); 253 autoLockTimer->start(1000, true);
254 return; 254 return;
255 } 255 }
256 if (conf()->confGlobAutoDeepLock() && 256 if (conf()->confGlobAutoDeepLock() &&
257 doc->filename != QString::null && 257 doc->filename != QString::null &&
258 doc->filename != "") { 258 doc->filename != "") {
259 doc->deepLock(true); 259 doc->deepLock(true);
260 } else { 260 } else {
261 doc->lockAll(true); 261 doc->lockAll(true);
262 } 262 }
263} 263}
264 264
265void DocTimer::metaCheckTimeout() 265void DocTimer::metaCheckTimeout()
266{ 266{
267 if (metaCheckLock) { 267 if (metaCheckLock) {
268 // check again in one second. 268 // check again in one second.
269 metaCheckTimer->start(1000, true); 269 metaCheckTimer->start(1000, true);
270 return; 270 return;
271 } 271 }
272 if (doc->isDeepLocked()) { 272 if (doc->isDeepLocked()) {
273 metaCheckTimer->start(META_CHECK_TIMER_INTERVAL * 1000, true); 273 metaCheckTimer->start(META_CHECK_TIMER_INTERVAL * 1000, true);
274 return; 274 return;
275 } 275 }
276 if (doc->isDocEmpty()) { 276 if (doc->isDocEmpty()) {
277 metaCheckTimer->start(META_CHECK_TIMER_INTERVAL * 1000, true); 277 metaCheckTimer->start(META_CHECK_TIMER_INTERVAL * 1000, true);
278 return; 278 return;
279 } 279 }
280#ifdef CONFIG_KWALLETIF 280#ifdef CONFIG_KWALLETIF
281 KWalletEmu *kwlEmu = doc->init->kwalletEmu(); 281 KWalletEmu *kwlEmu = doc->init->kwalletEmu();
282 if (kwlEmu) 282 if (kwlEmu)
283 kwlEmu->suspendDocSignals(); 283 kwlEmu->suspendDocSignals();
284#endif // CONFIG_KWALLETIF 284#endif // CONFIG_KWALLETIF
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 }
414 if (_hashAlgo < PWM_HASH_SHA1 || 414 if (_hashAlgo < PWM_HASH_SHA1 ||
415 _hashAlgo > PWM_HASH_TIGER) { 415 _hashAlgo > PWM_HASH_TIGER) {
416 printWarn("Invalid Hash-Algorithm selected! " 416 printWarn("Invalid Hash-Algorithm selected! "
417 "Config-file seems to be corrupt. " 417 "Config-file seems to be corrupt. "
418 "Falling back to SHA1."); 418 "Falling back to SHA1.");
419 _hashAlgo = PWM_HASH_SHA1; 419 _hashAlgo = PWM_HASH_SHA1;
420 } 420 }
421 char cryptAlgo = static_cast<char>(_cryptAlgo); 421 char cryptAlgo = static_cast<char>(_cryptAlgo);
422 char hashAlgo = static_cast<char>(_hashAlgo); 422 char hashAlgo = static_cast<char>(_hashAlgo);
423 423
424 if (conf()->confGlobMakeFileBackup()) { 424 if (conf()->confGlobMakeFileBackup()) {
425 if (!backupFile(filename)) 425 if (!backupFile(filename))
426 return e_fileBackup; 426 return e_fileBackup;
427 } 427 }
428 if (QFile::exists(filename)) { 428 if (QFile::exists(filename)) {
429 /* Move the existing file to some tmp file. 429 /* Move the existing file to some tmp file.
430 * When saving file succeeds, delete tmp file. Otherwise 430 * When saving file succeeds, delete tmp file. Otherwise
431 * move tmp file back. See below. 431 * move tmp file back. See below.
432 */ 432 */
433 Randomizer *rnd = Randomizer::obj(); 433 Randomizer *rnd = Randomizer::obj();
434 char rnd_buf[5]; 434 char rnd_buf[5];
435 sprintf(rnd_buf, "%X%X%X%X", rnd->genRndChar() & 0xFF, rnd->genRndChar() & 0xFF, 435 sprintf(rnd_buf, "%X%X%X%X", rnd->genRndChar() & 0xFF, rnd->genRndChar() & 0xFF,
436 rnd->genRndChar() & 0xFF, rnd->genRndChar() & 0xFF); 436 rnd->genRndChar() & 0xFF, rnd->genRndChar() & 0xFF);
437 tmpFileMoved = filename + "." + rnd_buf + ".mv"; 437 tmpFileMoved = filename + "." + rnd_buf + ".mv";
438 if (!copyFile(filename, tmpFileMoved)) 438 if (!copyFile(filename, tmpFileMoved))
439 return e_openFile; 439 return e_openFile;
440 if (!QFile::remove(filename)) { 440 if (!QFile::remove(filename)) {
441 printWarn(string("removing orig file ") 441 printWarn(string("removing orig file ")
442 + filename.latin1() 442 + filename.latin1()
443 + " failed!"); 443 + " failed!");
444 } 444 }
445 } 445 }
446 f.setName(filename); 446 f.setName(filename);
447 if (!f.open(IO_ReadWrite)) { 447 if (!f.open(IO_ReadWrite)) {
448 ret = e_openFile; 448 ret = e_openFile;
449 goto out_moveback; 449 goto out_moveback;
450 } 450 }
451 e = writeFileHeader(hashAlgo, hashAlgo, 451 e = writeFileHeader(hashAlgo, hashAlgo,
452 cryptAlgo, compress, 452 cryptAlgo, compress,
453 &currentPw, &f); 453 &currentPw, &f);
454 if (e == e_hashNotImpl) { 454 if (e == e_hashNotImpl) {
455 printDebug("PwMDoc::saveDoc(): writeFileHeader() failed: e_hashNotImpl"); 455 printDebug("PwMDoc::saveDoc(): writeFileHeader() failed: e_hashNotImpl");
456 f.close(); 456 f.close();
457 ret = e_hashNotImpl; 457 ret = e_hashNotImpl;
458 goto out_moveback; 458 goto out_moveback;
459 } else if (e != e_success) { 459 } else if (e != e_success) {
460 printDebug("PwMDoc::saveDoc(): writeFileHeader() failed"); 460 printDebug("PwMDoc::saveDoc(): writeFileHeader() failed");
461 f.close(); 461 f.close();
462 ret = e_writeHeader; 462 ret = e_writeHeader;
463 goto out_moveback; 463 goto out_moveback;
464 } 464 }
465 if (!serializeDta(&serialized)) { 465 if (!serializeDta(&serialized)) {
466 printDebug("PwMDoc::saveDoc(): serializeDta() failed"); 466 printDebug("PwMDoc::saveDoc(): serializeDta() failed");
467 f.close(); 467 f.close();
468 ret = e_serializeDta; 468 ret = e_serializeDta;
469 goto out_moveback; 469 goto out_moveback;
470 } 470 }
471 e = writeDataHash(hashAlgo, &serialized, &f); 471 e = writeDataHash(hashAlgo, &serialized, &f);
472 if (e == e_hashNotImpl) { 472 if (e == e_hashNotImpl) {
473 printDebug("PwMDoc::saveDoc(): writeDataHash() failed: e_hashNotImpl"); 473 printDebug("PwMDoc::saveDoc(): writeDataHash() failed: e_hashNotImpl");
474 f.close(); 474 f.close();
475 ret = e_hashNotImpl; 475 ret = e_hashNotImpl;
476 goto out_moveback; 476 goto out_moveback;
477 } else if (e != e_success) { 477 } else if (e != e_success) {
478 printDebug("PwMDoc::saveDoc(): writeDataHash() failed"); 478 printDebug("PwMDoc::saveDoc(): writeDataHash() failed");
479 f.close(); 479 f.close();
480 ret = e_writeHeader; 480 ret = e_writeHeader;
481 goto out_moveback; 481 goto out_moveback;
482 } 482 }
483 if (!compressDta(&serialized, compress)) { 483 if (!compressDta(&serialized, compress)) {
484 printDebug("PwMDoc::saveDoc(): compressDta() failed"); 484 printDebug("PwMDoc::saveDoc(): compressDta() failed");
485 f.close(); 485 f.close();
486 ret = e_enc; 486 ret = e_enc;
487 goto out_moveback; 487 goto out_moveback;
488 } 488 }
489 e = encrypt(&serialized, &currentPw, &f, cryptAlgo); 489 e = encrypt(&serialized, &currentPw, &f, cryptAlgo);
490 if (e == e_weakPw) { 490 if (e == e_weakPw) {
491 printDebug("PwMDoc::saveDoc(): encrypt() failed: e_weakPw"); 491 printDebug("PwMDoc::saveDoc(): encrypt() failed: e_weakPw");
492 f.close(); 492 f.close();
493 ret = e_weakPw; 493 ret = e_weakPw;
494 goto out_moveback; 494 goto out_moveback;
495 } else if (e == e_cryptNotImpl) { 495 } else if (e == e_cryptNotImpl) {
496 printDebug("PwMDoc::saveDoc(): encrypt() failed: e_cryptNotImpl"); 496 printDebug("PwMDoc::saveDoc(): encrypt() failed: e_cryptNotImpl");
497 f.close(); 497 f.close();
498 ret = e_cryptNotImpl; 498 ret = e_cryptNotImpl;
499 goto out_moveback; 499 goto out_moveback;
500 } else if (e != e_success) { 500 } else if (e != e_success) {
501 printDebug("PwMDoc::saveDoc(): encrypt() failed"); 501 printDebug("PwMDoc::saveDoc(): encrypt() failed");
502 f.close(); 502 f.close();
503 ret = e_enc; 503 ret = e_enc;
504 goto out_moveback; 504 goto out_moveback;
505 } 505 }
506 unsetDocStatFlag(DOC_STAT_DISK_DIRTY); 506 unsetDocStatFlag(DOC_STAT_DISK_DIRTY);
507 f.close(); 507 f.close();
508 if (chmod(filename.latin1(), 508 if (chmod(filename.latin1(),
509 conf()->confGlobFilePermissions())) { 509 conf()->confGlobFilePermissions())) {
510 printWarn(string("chmod failed: ") + strerror(errno)); 510 printWarn(string("chmod failed: ") + strerror(errno));
511 } 511 }
512 openDocList.edit(this, getTitle().latin1()); 512 openDocList.edit(this, getTitle().latin1());
513 if (wasDeepLocked) { 513 if (wasDeepLocked) {
514 /* Do _not_ save the data with the deepLock() 514 /* Do _not_ save the data with the deepLock()
515 * call, because this will recurse 515 * call, because this will recurse
516 * into saveDoc() 516 * into saveDoc()
517 */ 517 */
518 deepLock(true, false); 518 deepLock(true, false);
519 /* We don't check return value here, because 519 /* We don't check return value here, because
520 * it won't fail. See NOTE in deepLock() 520 * it won't fail. See NOTE in deepLock()
521 */ 521 */
522 } 522 }
523 if (tmpFileMoved != QString::null) { 523 if (tmpFileMoved != QString::null) {
524 // now remove the moved file. 524 // now remove the moved file.
525 if (!QFile::remove(tmpFileMoved)) { 525 if (!QFile::remove(tmpFileMoved)) {
526 printWarn(string("removing file ") 526 printWarn(string("removing file ")
527 + tmpFileMoved.latin1() 527 + tmpFileMoved.latin1()
528 + " failed!"); 528 + " failed!");
529 } 529 }
530 } 530 }
531 ret = e_success; 531 ret = e_success;
532 printDebug(string("writing file { name: ") 532 printDebug(string("writing file { name: ")
533 + filename.latin1() + " compress: " 533 + filename.latin1() + " compress: "
534 + tostr(static_cast<int>(compress)) + " cryptAlgo: " 534 + tostr(static_cast<int>(compress)) + " cryptAlgo: "
535 + tostr(static_cast<int>(cryptAlgo)) + " hashAlgo: " 535 + tostr(static_cast<int>(cryptAlgo)) + " hashAlgo: "
536 + tostr(static_cast<int>(hashAlgo)) 536 + tostr(static_cast<int>(hashAlgo))
537 + " }"); 537 + " }");
538 goto out; 538 goto out;
539out_moveback: 539out_moveback:
540 if (tmpFileMoved != QString::null) { 540 if (tmpFileMoved != QString::null) {
541 if (copyFile(tmpFileMoved, filename)) { 541 if (copyFile(tmpFileMoved, filename)) {
542 if (!QFile::remove(tmpFileMoved)) { 542 if (!QFile::remove(tmpFileMoved)) {
543 printWarn(string("removing tmp file ") 543 printWarn(string("removing tmp file ")
544 + filename.latin1() 544 + filename.latin1()
545 + " failed!"); 545 + " failed!");
546 } 546 }
547 } else { 547 } else {
548 printWarn(string("couldn't copy file ") 548 printWarn(string("couldn't copy file ")
549 + tmpFileMoved.latin1() 549 + tmpFileMoved.latin1()
550 + " back to " 550 + " back to "
551 + filename.latin1()); 551 + filename.latin1());
552 } 552 }
553 } 553 }
554out: 554out:
555 return ret; 555 return ret;
556} 556}
557 557
558PwMerror PwMDoc::openDoc(const QString *file, int openLocked) 558PwMerror PwMDoc::openDoc(const QString *file, int openLocked)
559{ 559{
560 PWM_ASSERT(file); 560 PWM_ASSERT(file);
561 PWM_ASSERT(openLocked == 0 || openLocked == 1 || openLocked == 2); 561 PWM_ASSERT(openLocked == 0 || openLocked == 1 || openLocked == 2);
562 string decrypted, dataHash; 562 string decrypted, dataHash;
563 PwMerror ret; 563 PwMerror ret;
564 char cryptAlgo, dataHashType, compress; 564 char cryptAlgo, dataHashType, compress;
565 unsigned int headerLen; 565 unsigned int headerLen;
566 566
567 if (*file == "") 567 if (*file == "")
568 return e_readFile; 568 return e_readFile;
569 filename = *file; 569 filename = *file;
570 /* check if this file is already open. 570 /* check if this file is already open.
571 * This does not catch symlinks! 571 * This does not catch symlinks!
572 */ 572 */
573 if (!isDeepLocked()) { 573 if (!isDeepLocked()) {
574 if (getOpenDocList()->find(filename.latin1())) 574 if (getOpenDocList()->find(filename.latin1()))
575 return e_alreadyOpen; 575 return e_alreadyOpen;
576 } 576 }
577 QFile f(filename); 577 QFile f(filename);
578 578
579 if (openLocked == 2) { 579 if (openLocked == 2) {
580 // open deep-locked 580 // open deep-locked
581 if (!QFile::exists(filename)) 581 if (!QFile::exists(filename))
582 return e_openFile; 582 return e_openFile;
583 if (deepLock(true, false) != e_success) 583 if (deepLock(true, false) != e_success)
584 return e_openFile; 584 return e_openFile;
585 goto out_success; 585 goto out_success;
586 } 586 }
587 587
588 if (!f.open(IO_ReadOnly)) 588 if (!f.open(IO_ReadOnly))
589 return e_openFile; 589 return e_openFile;
590 590
591 ret = checkHeader(&cryptAlgo, &currentPw, &compress, &headerLen, 591 ret = checkHeader(&cryptAlgo, &currentPw, &compress, &headerLen,
592 &dataHashType, &dataHash, &f); 592 &dataHashType, &dataHash, &f);
593 if (ret != e_success) { 593 if (ret != e_success) {
594 printDebug("PwMDoc::openDoc(): checkHeader() failed"); 594 printDebug("PwMDoc::openDoc(): checkHeader() failed");
595 f.close(); 595 f.close();
596 if (ret == e_wrongPw) { 596 if (ret == e_wrongPw) {
597 wrongMpwMsgBox(getDocStatFlag(DOC_STAT_USE_CHIPCARD)); 597 wrongMpwMsgBox(getDocStatFlag(DOC_STAT_USE_CHIPCARD));
598 return ret; 598 return ret;
599 } else if (ret == e_noPw || 599 } else if (ret == e_noPw ||
600 ret == e_fileVer || 600 ret == e_fileVer ||
601 ret == e_fileFormat || 601 ret == e_fileFormat ||
602 ret == e_hashNotImpl) { 602 ret == e_hashNotImpl) {
603 return ret; 603 return ret;
604 } else 604 } else
605 return e_readFile; 605 return e_readFile;
606 } 606 }
607 ret = decrypt(&decrypted, headerLen, &currentPw, cryptAlgo, &f); 607 ret = decrypt(&decrypted, headerLen, &currentPw, cryptAlgo, &f);
608 if (ret == e_cryptNotImpl) { 608 if (ret == e_cryptNotImpl) {
609 printDebug("PwMDoc::openDoc(): decrypt() failed: e_cryptNotImpl"); 609 printDebug("PwMDoc::openDoc(): decrypt() failed: e_cryptNotImpl");
610 f.close(); 610 f.close();
611 return e_cryptNotImpl; 611 return e_cryptNotImpl;
612 } else if (ret != e_success) { 612 } else if (ret != e_success) {
613 printDebug("PwMDoc::openDoc(): decrypt() failed"); 613 printDebug("PwMDoc::openDoc(): decrypt() failed");
614 f.close(); 614 f.close();
615 return e_readFile; 615 return e_readFile;
616 } 616 }
617 if (!decompressDta(&decrypted, compress)) { 617 if (!decompressDta(&decrypted, compress)) {
618 printDebug("PwMDoc::openDoc(): decompressDta() failed"); 618 printDebug("PwMDoc::openDoc(): decompressDta() failed");
619 f.close(); 619 f.close();
620 return e_fileCorrupt; 620 return e_fileCorrupt;
621 } 621 }
622 ret = checkDataHash(dataHashType, &dataHash, &decrypted); 622 ret = checkDataHash(dataHashType, &dataHash, &decrypted);
623 if (ret == e_hashNotImpl) { 623 if (ret == e_hashNotImpl) {
624 printDebug("PwMDoc::openDoc(): checkDataHash() failed: e_hashNotImpl"); 624 printDebug("PwMDoc::openDoc(): checkDataHash() failed: e_hashNotImpl");
625 f.close(); 625 f.close();
626 return e_hashNotImpl; 626 return e_hashNotImpl;
627 } else if (ret != e_success) { 627 } else if (ret != e_success) {
628 printDebug("PwMDoc::openDoc(): checkDataHash() failed"); 628 printDebug("PwMDoc::openDoc(): checkDataHash() failed");
629 f.close(); 629 f.close();
630 return e_fileCorrupt; 630 return e_fileCorrupt;
631 } 631 }
632 if (!deSerializeDta(&decrypted, openLocked == 1)) { 632 if (!deSerializeDta(&decrypted, openLocked == 1)) {
633 printDebug("PwMDoc::openDoc(): deSerializeDta() failed"); 633 printDebug("PwMDoc::openDoc(): deSerializeDta() failed");
634 f.close(); 634 f.close();
635 return e_readFile; 635 return e_readFile;
636 } 636 }
637 f.close(); 637 f.close();
638 timer()->start(DocTimer::id_mpwTimer); 638 timer()->start(DocTimer::id_mpwTimer);
639 timer()->start(DocTimer::id_autoLockTimer); 639 timer()->start(DocTimer::id_autoLockTimer);
640out_success: 640out_success:
641 openDocList.edit(this, getTitle().latin1()); 641 openDocList.edit(this, getTitle().latin1());
642 emit docOpened(this); 642 emit docOpened(this);
643 return e_success; 643 return e_success;
644} 644}
645 645
646PwMerror PwMDoc::writeFileHeader(char keyHash, char dataHash, char crypt, char compress, 646PwMerror PwMDoc::writeFileHeader(char keyHash, char dataHash, char crypt, char compress,
647 QString *pw, QFile *f) 647 QString *pw, QFile *f)
648{ 648{
649 PWM_ASSERT(pw); 649 PWM_ASSERT(pw);
650 PWM_ASSERT(f); 650 PWM_ASSERT(f);
651 //US ENH: or maybe a bug: checking here for listView does not make sense because we do not check anywhere else 651 //US ENH: or maybe a bug: checking here for listView does not make sense because we do not check anywhere else
652 //Wenn I sync, I open a doc without a view => listView is 0 => Assertion 652 //Wenn I sync, I open a doc without a view => listView is 0 => Assertion
653 //USPWM_ASSERT(listView); 653 //USPWM_ASSERT(listView);
654 if (f->writeBlock(FILE_ID_HEADER, strlen(FILE_ID_HEADER)) != 654 if (f->writeBlock(FILE_ID_HEADER, strlen(FILE_ID_HEADER)) !=
655 static_cast<Q_LONG>(strlen(FILE_ID_HEADER))) { 655 static_cast<Q_LONG>(strlen(FILE_ID_HEADER))) {
656 return e_writeFile; 656 return e_writeFile;
657 } 657 }
658 if (f->putch(PWM_FILE_VER) == -1 || 658 if (f->putch(PWM_FILE_VER) == -1 ||
659 f->putch(keyHash) == -1 || 659 f->putch(keyHash) == -1 ||
660 f->putch(dataHash) == -1 || 660 f->putch(dataHash) == -1 ||
661 f->putch(crypt) == -1 || 661 f->putch(crypt) == -1 ||
662 f->putch(compress) == -1 || 662 f->putch(compress) == -1 ||
663 f->putch((getDocStatFlag(DOC_STAT_USE_CHIPCARD)) ? 663 f->putch((getDocStatFlag(DOC_STAT_USE_CHIPCARD)) ?
664 (static_cast<char>(0x01)) : (static_cast<char>(0x00))) == -1) { 664 (static_cast<char>(0x01)) : (static_cast<char>(0x00))) == -1) {
665 return e_writeFile; 665 return e_writeFile;
666 } 666 }
667 667
668 // write bytes of NUL-data. These bytes are reserved for future-use. 668 // write bytes of NUL-data. These bytes are reserved for future-use.
669 const int bufSize = 64; 669 const int bufSize = 64;
670 char tmp_buf[bufSize]; 670 char tmp_buf[bufSize];
671 memset(tmp_buf, 0x00, bufSize); 671 memset(tmp_buf, 0x00, bufSize);
672 if (f->writeBlock(tmp_buf, bufSize) != bufSize) 672 if (f->writeBlock(tmp_buf, bufSize) != bufSize)
673 return e_writeFile; 673 return e_writeFile;
674 674
675 switch (keyHash) { 675 switch (keyHash) {
676 case PWM_HASH_SHA1: { 676 case PWM_HASH_SHA1: {
677 const int hashlen = SHA1_HASH_LEN_BYTE; 677 const int hashlen = SHA1_HASH_LEN_BYTE;
678 Sha1 hash; 678 Sha1 hash;
679 hash.sha1_write(reinterpret_cast<const byte *>(pw->latin1()), pw->length()); 679 hash.sha1_write(reinterpret_cast<const byte *>(pw->latin1()), pw->length());
680 string ret = hash.sha1_read(); 680 string ret = hash.sha1_read();
681 if (f->writeBlock(ret.c_str(), hashlen) != hashlen) 681 if (f->writeBlock(ret.c_str(), hashlen) != hashlen)
682 return e_writeFile; 682 return e_writeFile;
683 break; 683 break;
684 } 684 }
685 case PWM_HASH_SHA256: 685 case PWM_HASH_SHA256:
686 /*... fall through */ 686 /*... fall through */
687 case PWM_HASH_SHA384: 687 case PWM_HASH_SHA384:
688 case PWM_HASH_SHA512: 688 case PWM_HASH_SHA512:
689 case PWM_HASH_MD5: 689 case PWM_HASH_MD5:
690 case PWM_HASH_RMD160: 690 case PWM_HASH_RMD160:
691 case PWM_HASH_TIGER: 691 case PWM_HASH_TIGER:
692 { 692 {
693 if (!LibGCryptIf::available()) 693 if (!LibGCryptIf::available())
694 return e_hashNotImpl; 694 return e_hashNotImpl;
695 LibGCryptIf gc; 695 LibGCryptIf gc;
696 PwMerror err; 696 PwMerror err;
697 unsigned char *buf; 697 unsigned char *buf;
698 size_t hashLen; 698 size_t hashLen;
699 err = gc.hash(&buf, 699 err = gc.hash(&buf,
700 &hashLen, 700 &hashLen,
701 reinterpret_cast<const unsigned char *>(pw->latin1()), 701 reinterpret_cast<const unsigned char *>(pw->latin1()),
702 pw->length(), 702 pw->length(),
703 keyHash); 703 keyHash);
704 if (err != e_success) 704 if (err != e_success)
705 return e_hashNotImpl; 705 return e_hashNotImpl;
706 if (f->writeBlock(reinterpret_cast<const char *>(buf), hashLen) 706 if (f->writeBlock(reinterpret_cast<const char *>(buf), hashLen)
707 != static_cast<Q_LONG>(hashLen)) { 707 != static_cast<Q_LONG>(hashLen)) {
708 delete [] buf; 708 delete [] buf;
709 return e_hashNotImpl; 709 return e_hashNotImpl;
710 } 710 }
711 delete [] buf; 711 delete [] buf;
712 break; 712 break;
713 } 713 }
714 default: { 714 default: {
715 return e_hashNotImpl; 715 return e_hashNotImpl;
716 } } 716 } }
717 return e_success; 717 return e_success;
718} 718}
719 719
720PwMerror PwMDoc::checkHeader(char *cryptAlgo, QString *pw, char *compress, 720PwMerror PwMDoc::checkHeader(char *cryptAlgo, QString *pw, char *compress,
721 unsigned int *headerLength, char *dataHashType, 721 unsigned int *headerLength, char *dataHashType,
722 string *dataHash, QFile *f) 722 string *dataHash, QFile *f)
723{ 723{
724 PWM_ASSERT(cryptAlgo); 724 PWM_ASSERT(cryptAlgo);
725 PWM_ASSERT(pw); 725 PWM_ASSERT(pw);
726 PWM_ASSERT(headerLength); 726 PWM_ASSERT(headerLength);
727 PWM_ASSERT(dataHashType); 727 PWM_ASSERT(dataHashType);
728 PWM_ASSERT(dataHash); 728 PWM_ASSERT(dataHash);
729 PWM_ASSERT(f); 729 PWM_ASSERT(f);
730 int tmpRet; 730 int tmpRet;
731 // check "magic" header 731 // check "magic" header
732 const char magicHdr[] = FILE_ID_HEADER; 732 const char magicHdr[] = FILE_ID_HEADER;
733 const int hdrLen = array_size(magicHdr) - 1; 733 const int hdrLen = array_size(magicHdr) - 1;
734 char tmp[hdrLen]; 734 char tmp[hdrLen];
735 if (f->readBlock(tmp, hdrLen) != hdrLen) 735 if (f->readBlock(tmp, hdrLen) != hdrLen)
736 return e_readFile; 736 return e_readFile;
737 if (memcmp(tmp, magicHdr, hdrLen) != 0) 737 if (memcmp(tmp, magicHdr, hdrLen) != 0)
738 return e_fileFormat; 738 return e_fileFormat;
739 // read and check file ver 739 // read and check file ver
740 int fileV = f->getch(); 740 int fileV = f->getch();
741 if (fileV == -1) 741 if (fileV == -1)
742 return e_fileFormat; 742 return e_fileFormat;
743 if (fileV != PWM_FILE_VER) 743 if (fileV != PWM_FILE_VER)
744 return e_fileVer; 744 return e_fileVer;
745 // read hash hash type 745 // read hash hash type
746 int keyHash = f->getch(); 746 int keyHash = f->getch();
747 if (keyHash == -1) 747 if (keyHash == -1)
748 return e_fileFormat; 748 return e_fileFormat;
749 // read data hash type 749 // read data hash type
750 tmpRet = f->getch(); 750 tmpRet = f->getch();
751 if (tmpRet == -1) 751 if (tmpRet == -1)
752 return e_fileFormat; 752 return e_fileFormat;
753 *dataHashType = tmpRet; 753 *dataHashType = tmpRet;
754 // read crypt algo 754 // read crypt algo
755 tmpRet = f->getch(); 755 tmpRet = f->getch();
756 if (tmpRet == -1) 756 if (tmpRet == -1)
757 return e_fileFormat; 757 return e_fileFormat;
758 *cryptAlgo = tmpRet; 758 *cryptAlgo = tmpRet;
759 // get compression-algo 759 // get compression-algo
760 tmpRet = f->getch(); 760 tmpRet = f->getch();
761 if (tmpRet == -1) 761 if (tmpRet == -1)
762 return e_fileFormat; 762 return e_fileFormat;
763 *compress = tmpRet; 763 *compress = tmpRet;
764 // get the MPW-flag 764 // get the MPW-flag
765 int mpw_flag = f->getch(); 765 int mpw_flag = f->getch();
766 if (mpw_flag == -1) 766 if (mpw_flag == -1)
767 return e_fileFormat; 767 return e_fileFormat;
768 if (mpw_flag == 0x01) 768 if (mpw_flag == 0x01)
769 setDocStatFlag(DOC_STAT_USE_CHIPCARD); 769 setDocStatFlag(DOC_STAT_USE_CHIPCARD);
770 else 770 else
771 unsetDocStatFlag(DOC_STAT_USE_CHIPCARD); 771 unsetDocStatFlag(DOC_STAT_USE_CHIPCARD);
772 // skip the "RESERVED"-bytes 772 // skip the "RESERVED"-bytes
773 if (!(f->at(f->at() + 64))) 773 if (!(f->at(f->at() + 64)))
774 return e_fileFormat; 774 return e_fileFormat;
775 775
776 *pw = requestMpw(getDocStatFlag(DOC_STAT_USE_CHIPCARD)); 776 *pw = requestMpw(getDocStatFlag(DOC_STAT_USE_CHIPCARD));
777 if (*pw == "") { 777 if (*pw == "") {
778 /* the user didn't give a master-password 778 /* the user didn't give a master-password
779 * or didn't insert a chipcard 779 * or didn't insert a chipcard
780 */ 780 */
781 return e_noPw; 781 return e_noPw;
782 } 782 }
783 // verify key-hash 783 // verify key-hash
784 switch (keyHash) { 784 switch (keyHash) {
785 case PWM_HASH_SHA1: { 785 case PWM_HASH_SHA1: {
786 // read hash from header 786 // read hash from header
787 const int hashLen = SHA1_HASH_LEN_BYTE; 787 const int hashLen = SHA1_HASH_LEN_BYTE;
788 string readHash; 788 string readHash;
789 int i; 789 int i;
790 for (i = 0; i < hashLen; ++i) 790 for (i = 0; i < hashLen; ++i)
791 readHash.push_back(f->getch()); 791 readHash.push_back(f->getch());
792 Sha1 hash; 792 Sha1 hash;
793 hash.sha1_write(reinterpret_cast<const byte *>(pw->latin1()), pw->length()); 793 hash.sha1_write(reinterpret_cast<const byte *>(pw->latin1()), pw->length());
794 string ret = hash.sha1_read(); 794 string ret = hash.sha1_read();
795 if (ret != readHash) 795 if (ret != readHash)
796 return e_wrongPw;// hash doesn't match (wrong key) 796 return e_wrongPw;// hash doesn't match (wrong key)
797 break; 797 break;
798 } 798 }
799 case PWM_HASH_SHA256: 799 case PWM_HASH_SHA256:
800 /*... fall through */ 800 /*... fall through */
801 case PWM_HASH_SHA384: 801 case PWM_HASH_SHA384:
802 case PWM_HASH_SHA512: 802 case PWM_HASH_SHA512:
803 case PWM_HASH_MD5: 803 case PWM_HASH_MD5:
804 case PWM_HASH_RMD160: 804 case PWM_HASH_RMD160:
805 case PWM_HASH_TIGER: { 805 case PWM_HASH_TIGER: {
806 if (!LibGCryptIf::available()) 806 if (!LibGCryptIf::available())
807 return e_hashNotImpl; 807 return e_hashNotImpl;
808 LibGCryptIf gc; 808 LibGCryptIf gc;
809 PwMerror err; 809 PwMerror err;
810 unsigned char *buf; 810 unsigned char *buf;
811 size_t hashLen; 811 size_t hashLen;
812 err = gc.hash(&buf, 812 err = gc.hash(&buf,
813 &hashLen, 813 &hashLen,
814 reinterpret_cast<const unsigned char *>(pw->latin1()), 814 reinterpret_cast<const unsigned char *>(pw->latin1()),
815 pw->length(), 815 pw->length(),
816 keyHash); 816 keyHash);
817 if (err != e_success) 817 if (err != e_success)
818 return e_hashNotImpl; 818 return e_hashNotImpl;
819 string calcHash(reinterpret_cast<const char *>(buf), 819 string calcHash(reinterpret_cast<const char *>(buf),
820 static_cast<string::size_type>(hashLen)); 820 static_cast<string::size_type>(hashLen));
821 delete [] buf; 821 delete [] buf;
822 // read hash from header 822 // read hash from header
823 string readHash; 823 string readHash;
824 size_t i; 824 size_t i;
825 for (i = 0; i < hashLen; ++i) 825 for (i = 0; i < hashLen; ++i)
826 readHash.push_back(f->getch()); 826 readHash.push_back(f->getch());
827 if (calcHash != readHash) 827 if (calcHash != readHash)
828 return e_wrongPw;// hash doesn't match (wrong key) 828 return e_wrongPw;// hash doesn't match (wrong key)
829 break; 829 break;
830 } 830 }
831 default: { 831 default: {
832 return e_hashNotImpl; 832 return e_hashNotImpl;
833 } } 833 } }
834 // read the data-hash from the file 834 // read the data-hash from the file
835 unsigned int hashLen, i; 835 unsigned int hashLen, i;
836 switch (*dataHashType) { 836 switch (*dataHashType) {
837 case PWM_HASH_SHA1: 837 case PWM_HASH_SHA1:
838 hashLen = SHA1_HASH_LEN_BYTE; 838 hashLen = SHA1_HASH_LEN_BYTE;
839 break; 839 break;
840 case PWM_HASH_SHA256: 840 case PWM_HASH_SHA256:
841 /*... fall through */ 841 /*... fall through */
842 case PWM_HASH_SHA384: 842 case PWM_HASH_SHA384:
843 case PWM_HASH_SHA512: 843 case PWM_HASH_SHA512:
844 case PWM_HASH_MD5: 844 case PWM_HASH_MD5:
845 case PWM_HASH_RMD160: 845 case PWM_HASH_RMD160:
846 case PWM_HASH_TIGER: { 846 case PWM_HASH_TIGER: {
847 if (!LibGCryptIf::available()) 847 if (!LibGCryptIf::available())
848 return e_hashNotImpl; 848 return e_hashNotImpl;
849 LibGCryptIf gc; 849 LibGCryptIf gc;
850 hashLen = gc.hashLength(*dataHashType); 850 hashLen = gc.hashLength(*dataHashType);
851 if (hashLen == 0) 851 if (hashLen == 0)
852 return e_hashNotImpl; 852 return e_hashNotImpl;
853 break; 853 break;
854 } 854 }
855 default: 855 default:
856 return e_hashNotImpl; 856 return e_hashNotImpl;
857 } 857 }
858 *dataHash = ""; 858 *dataHash = "";
859 for (i = 0; i < hashLen; ++i) { 859 for (i = 0; i < hashLen; ++i) {
860 tmpRet = f->getch(); 860 tmpRet = f->getch();
861 if (tmpRet == -1) 861 if (tmpRet == -1)