aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb/exchangedb_auditorkeys.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchangedb/exchangedb_auditorkeys.c')
-rw-r--r--src/exchangedb/exchangedb_auditorkeys.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/exchangedb/exchangedb_auditorkeys.c b/src/exchangedb/exchangedb_auditorkeys.c
index 38498d9b5..6546c1a3f 100644
--- a/src/exchangedb/exchangedb_auditorkeys.c
+++ b/src/exchangedb/exchangedb_auditorkeys.c
@@ -141,8 +141,8 @@ auditor_iter (void *cls,
141 return GNUNET_OK; 141 return GNUNET_OK;
142 } 142 }
143 if ( (size - sizeof (struct AuditorFileHeaderP)) / dki_len < 143 if ( (size - sizeof (struct AuditorFileHeaderP)) / dki_len <
144 (sizeof (struct TALER_DenominationKeyValidityPS) + 144 (sizeof (struct TALER_DenominationKeyValidityPS)
145 sizeof (struct TALER_AuditorSignatureP)) ) 145 + sizeof (struct TALER_AuditorSignatureP)) )
146 { 146 {
147 GNUNET_break_op (0); 147 GNUNET_break_op (0);
148 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 148 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -152,9 +152,9 @@ auditor_iter (void *cls,
152 return GNUNET_OK; 152 return GNUNET_OK;
153 } 153 }
154 url_len = size 154 url_len = size
155 - sizeof (struct AuditorFileHeaderP) 155 - sizeof (struct AuditorFileHeaderP)
156 - dki_len * (sizeof (struct TALER_DenominationKeyValidityPS) + 156 - dki_len * (sizeof (struct TALER_DenominationKeyValidityPS)
157 sizeof (struct TALER_AuditorSignatureP)); 157 + sizeof (struct TALER_AuditorSignatureP));
158 sigs = (const struct TALER_AuditorSignatureP *) &af[1]; 158 sigs = (const struct TALER_AuditorSignatureP *) &af[1];
159 dki = (const struct TALER_DenominationKeyValidityPS *) &sigs[dki_len]; 159 dki = (const struct TALER_DenominationKeyValidityPS *) &sigs[dki_len];
160 auditor_url = (const char *) &dki[dki_len]; 160 auditor_url = (const char *) &dki[dki_len];
@@ -171,12 +171,12 @@ auditor_iter (void *cls,
171 /* Ignoring return value to not interrupt the iteration */ 171 /* Ignoring return value to not interrupt the iteration */
172 if (GNUNET_OK != 172 if (GNUNET_OK !=
173 (iret = aic->it (aic->it_cls, 173 (iret = aic->it (aic->it_cls,
174 &af->apub, 174 &af->apub,
175 auditor_url, 175 auditor_url,
176 &af->mpub, 176 &af->mpub,
177 dki_len, 177 dki_len,
178 sigs, 178 sigs,
179 dki))) 179 dki)))
180 { 180 {
181 GNUNET_free (af); 181 GNUNET_free (af);
182 if (GNUNET_SYSERR == iret) 182 if (GNUNET_SYSERR == iret)
@@ -248,7 +248,8 @@ TALER_EXCHANGEDB_auditor_write (const char *filename,
248 const struct TALER_AuditorSignatureP *asigs, 248 const struct TALER_AuditorSignatureP *asigs,
249 const struct TALER_MasterPublicKeyP *mpub, 249 const struct TALER_MasterPublicKeyP *mpub,
250 unsigned int dki_len, 250 unsigned int dki_len,
251 const struct TALER_DenominationKeyValidityPS *dki) 251 const struct
252 TALER_DenominationKeyValidityPS *dki)
252{ 253{
253 struct AuditorFileHeaderP af; 254 struct AuditorFileHeaderP af;
254 struct GNUNET_DISK_FileHandle *fh; 255 struct GNUNET_DISK_FileHandle *fh;
@@ -262,9 +263,11 @@ TALER_EXCHANGEDB_auditor_write (const char *filename,
262 af.dki_len = htonl ((uint32_t) dki_len); 263 af.dki_len = htonl ((uint32_t) dki_len);
263 ret = GNUNET_SYSERR; 264 ret = GNUNET_SYSERR;
264 if (NULL == (fh = GNUNET_DISK_file_open 265 if (NULL == (fh = GNUNET_DISK_file_open
265 (filename, 266 (filename,
266 GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_TRUNCATE, 267 GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE
267 GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE))) 268 | GNUNET_DISK_OPEN_TRUNCATE,
269 GNUNET_DISK_PERM_USER_READ
270 | GNUNET_DISK_PERM_USER_WRITE)))
268 goto cleanup; 271 goto cleanup;
269 wsize = sizeof (struct AuditorFileHeaderP); 272 wsize = sizeof (struct AuditorFileHeaderP);
270 if (GNUNET_SYSERR == (wrote = GNUNET_DISK_file_write (fh, 273 if (GNUNET_SYSERR == (wrote = GNUNET_DISK_file_write (fh,
@@ -291,7 +294,7 @@ TALER_EXCHANGEDB_auditor_write (const char *filename,
291 auditor_url, 294 auditor_url,
292 wsize)) 295 wsize))
293 ret = GNUNET_OK; 296 ret = GNUNET_OK;
294 cleanup: 297 cleanup:
295 eno = errno; 298 eno = errno;
296 if (NULL != fh) 299 if (NULL != fh)
297 (void) GNUNET_DISK_file_close (fh); 300 (void) GNUNET_DISK_file_close (fh);