diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-31 13:03:48 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-10-31 13:03:48 +0100 |
commit | 7e3cf5f461eb4fbb7581672bf0835da07c378136 (patch) | |
tree | bdc3874b7894242b095b892f1ed3e81a4d4f06c0 /src/abd | |
parent | 01b480d6d026e0c537dc284a7e7df2c0320a3528 (diff) | |
download | gnunet-7e3cf5f461eb4fbb7581672bf0835da07c378136.tar.gz gnunet-7e3cf5f461eb4fbb7581672bf0835da07c378136.zip |
tighten formatting rules
Diffstat (limited to 'src/abd')
-rw-r--r-- | src/abd/abd.h | 2 | ||||
-rw-r--r-- | src/abd/abd_api.c | 90 | ||||
-rw-r--r-- | src/abd/abd_serialization.c | 40 | ||||
-rw-r--r-- | src/abd/abd_serialization.h | 14 | ||||
-rw-r--r-- | src/abd/delegate_misc.c | 2 | ||||
-rw-r--r-- | src/abd/delegate_misc.h | 2 | ||||
-rw-r--r-- | src/abd/gnunet-abd.c | 268 | ||||
-rw-r--r-- | src/abd/gnunet-service-abd.c | 170 | ||||
-rw-r--r-- | src/abd/plugin_gnsrecord_abd.c | 1 |
9 files changed, 323 insertions, 266 deletions
diff --git a/src/abd/abd.h b/src/abd/abd.h index 854814832..1e9d6bcea 100644 --- a/src/abd/abd.h +++ b/src/abd/abd.h | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
diff --git a/src/abd/abd_api.c b/src/abd/abd_api.c index cdc52df91..cc25d06da 100644 --- a/src/abd/abd_api.c +++ b/src/abd/abd_api.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
@@ -192,6 +192,7 @@ mq_error_handler (void *cls, enum GNUNET_MQ_Error error) | |||
192 | force_reconnect (handle); | 192 | force_reconnect (handle); |
193 | } | 193 | } |
194 | 194 | ||
195 | |||
195 | /** | 196 | /** |
196 | * Check validity of message received from the ABD service | 197 | * Check validity of message received from the ABD service |
197 | * | 198 | * |
@@ -201,7 +202,7 @@ mq_error_handler (void *cls, enum GNUNET_MQ_Error error) | |||
201 | static int | 202 | static int |
202 | check_result (void *cls, const struct DelegationChainResultMessage *vr_msg) | 203 | check_result (void *cls, const struct DelegationChainResultMessage *vr_msg) |
203 | { | 204 | { |
204 | //TODO | 205 | // TODO |
205 | return GNUNET_OK; | 206 | return GNUNET_OK; |
206 | } | 207 | } |
207 | 208 | ||
@@ -241,11 +242,11 @@ handle_result (void *cls, const struct DelegationChainResultMessage *vr_msg) | |||
241 | GNUNET_assert ( | 242 | GNUNET_assert ( |
242 | GNUNET_OK == | 243 | GNUNET_OK == |
243 | GNUNET_ABD_delegation_chain_deserialize (mlen, | 244 | GNUNET_ABD_delegation_chain_deserialize (mlen, |
244 | (const char *) &vr_msg[1], | 245 | (const char *) &vr_msg[1], |
245 | d_count, | 246 | d_count, |
246 | d_chain, | 247 | d_chain, |
247 | c_count, | 248 | c_count, |
248 | dels)); | 249 | dels)); |
249 | if (GNUNET_NO == ntohl (vr_msg->del_found)) | 250 | if (GNUNET_NO == ntohl (vr_msg->del_found)) |
250 | { | 251 | { |
251 | proc (proc_cls, 0, NULL, 0, | 252 | proc (proc_cls, 0, NULL, 0, |
@@ -257,51 +258,55 @@ handle_result (void *cls, const struct DelegationChainResultMessage *vr_msg) | |||
257 | } | 258 | } |
258 | } | 259 | } |
259 | 260 | ||
261 | |||
260 | static int | 262 | static int |
261 | check_intermediate (void *cls, const struct DelegationChainIntermediateMessage *vr_msg) | 263 | check_intermediate (void *cls, const struct |
264 | DelegationChainIntermediateMessage *vr_msg) | ||
262 | { | 265 | { |
263 | //TODO | 266 | // TODO |
264 | return GNUNET_OK; | 267 | return GNUNET_OK; |
265 | } | 268 | } |
266 | 269 | ||
270 | |||
267 | static void | 271 | static void |
268 | handle_intermediate (void *cls, const struct DelegationChainIntermediateMessage *vr_msg) | 272 | handle_intermediate (void *cls, const struct |
273 | DelegationChainIntermediateMessage *vr_msg) | ||
269 | { | 274 | { |
270 | struct GNUNET_ABD_Handle *handle = cls; | 275 | struct GNUNET_ABD_Handle *handle = cls; |
271 | uint32_t r_id = ntohl (vr_msg->id); | 276 | uint32_t r_id = ntohl (vr_msg->id); |
272 | uint32_t size = ntohl (vr_msg->size); | 277 | uint32_t size = ntohl (vr_msg->size); |
273 | bool is_bw = ntohs(vr_msg->is_bw); | 278 | bool is_bw = ntohs (vr_msg->is_bw); |
274 | struct GNUNET_ABD_Request *vr; | 279 | struct GNUNET_ABD_Request *vr; |
275 | GNUNET_ABD_IntermediateResultProcessor proc; | 280 | GNUNET_ABD_IntermediateResultProcessor proc; |
276 | void *proc_cls; | 281 | void *proc_cls; |
277 | struct GNUNET_ABD_Delegation *dd; | 282 | struct GNUNET_ABD_Delegation *dd; |
278 | 283 | ||
279 | 284 | ||
280 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received intermediate reply from ABD service\n"); | 285 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
286 | "Received intermediate reply from ABD service\n"); | ||
281 | 287 | ||
282 | for (vr = handle->request_head; NULL != vr; vr = vr->next) | 288 | for (vr = handle->request_head; NULL != vr; vr = vr->next) |
283 | if (vr->r_id == r_id) | 289 | if (vr->r_id == r_id) |
284 | break; | 290 | break; |
285 | if (NULL == vr) | 291 | if (NULL == vr) |
286 | return; | 292 | return; |
287 | 293 | ||
288 | proc = vr->int_proc; | 294 | proc = vr->int_proc; |
289 | proc_cls = vr->proc2_cls; | 295 | proc_cls = vr->proc2_cls; |
290 | 296 | ||
291 | dd = GNUNET_new (struct GNUNET_ABD_Delegation); | 297 | dd = GNUNET_new (struct GNUNET_ABD_Delegation); |
292 | GNUNET_assert ( | 298 | GNUNET_assert ( |
293 | GNUNET_OK == | 299 | GNUNET_OK == |
294 | GNUNET_ABD_delegation_chain_deserialize (size, | 300 | GNUNET_ABD_delegation_chain_deserialize (size, |
295 | (const char *) &vr_msg[1], | 301 | (const char *) &vr_msg[1], |
296 | 1, | 302 | 1, |
297 | dd, | 303 | dd, |
298 | 0, | 304 | 0, |
299 | NULL)); | 305 | NULL)); |
300 | proc (proc_cls, dd, is_bw); | 306 | proc (proc_cls, dd, is_bw); |
301 | } | 307 | } |
302 | 308 | ||
303 | 309 | ||
304 | |||
305 | /** | 310 | /** |
306 | * Reconnect to ABD service. | 311 | * Reconnect to ABD service. |
307 | * | 312 | * |
@@ -311,19 +316,19 @@ static void | |||
311 | reconnect (struct GNUNET_ABD_Handle *handle) | 316 | reconnect (struct GNUNET_ABD_Handle *handle) |
312 | { | 317 | { |
313 | struct GNUNET_MQ_MessageHandler handlers[] = | 318 | struct GNUNET_MQ_MessageHandler handlers[] = |
314 | {GNUNET_MQ_hd_var_size (result, | 319 | {GNUNET_MQ_hd_var_size (result, |
315 | GNUNET_MESSAGE_TYPE_ABD_VERIFY_RESULT, | 320 | GNUNET_MESSAGE_TYPE_ABD_VERIFY_RESULT, |
316 | struct DelegationChainResultMessage, | 321 | struct DelegationChainResultMessage, |
317 | handle), | 322 | handle), |
318 | GNUNET_MQ_hd_var_size (result, | 323 | GNUNET_MQ_hd_var_size (result, |
319 | GNUNET_MESSAGE_TYPE_ABD_COLLECT_RESULT, | 324 | GNUNET_MESSAGE_TYPE_ABD_COLLECT_RESULT, |
320 | struct DelegationChainResultMessage, | 325 | struct DelegationChainResultMessage, |
321 | handle), | 326 | handle), |
322 | GNUNET_MQ_hd_var_size (intermediate, | 327 | GNUNET_MQ_hd_var_size (intermediate, |
323 | GNUNET_MESSAGE_TYPE_ABD_INTERMEDIATE_RESULT, | 328 | GNUNET_MESSAGE_TYPE_ABD_INTERMEDIATE_RESULT, |
324 | struct DelegationChainIntermediateMessage, | 329 | struct DelegationChainIntermediateMessage, |
325 | handle), | 330 | handle), |
326 | GNUNET_MQ_handler_end ()}; | 331 | GNUNET_MQ_handler_end ()}; |
327 | struct GNUNET_ABD_Request *vr; | 332 | struct GNUNET_ABD_Request *vr; |
328 | 333 | ||
329 | GNUNET_assert (NULL == handle->mq); | 334 | GNUNET_assert (NULL == handle->mq); |
@@ -404,7 +409,7 @@ GNUNET_ABD_request_cancel (struct GNUNET_ABD_Request *lr) | |||
404 | 409 | ||
405 | /** | 410 | /** |
406 | * Performs attribute collection. | 411 | * Performs attribute collection. |
407 | * Collects all abds of subject to fulfill the | 412 | * Collects all abds of subject to fulfill the |
408 | * attribute, if possible | 413 | * attribute, if possible |
409 | * | 414 | * |
410 | * @param handle handle to the Credential service | 415 | * @param handle handle to the Credential service |
@@ -438,7 +443,7 @@ GNUNET_ABD_collect ( | |||
438 | return NULL; | 443 | return NULL; |
439 | } | 444 | } |
440 | 445 | ||
441 | //DEBUG LOG | 446 | // DEBUG LOG |
442 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 447 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
443 | "Trying to collect `%s' in ABD\n", | 448 | "Trying to collect `%s' in ABD\n", |
444 | issuer_attribute); | 449 | issuer_attribute); |
@@ -469,6 +474,8 @@ GNUNET_ABD_collect ( | |||
469 | GNUNET_MQ_send_copy (handle->mq, vr->env); | 474 | GNUNET_MQ_send_copy (handle->mq, vr->env); |
470 | return vr; | 475 | return vr; |
471 | } | 476 | } |
477 | |||
478 | |||
472 | /** | 479 | /** |
473 | * Performs attribute verification. | 480 | * Performs attribute verification. |
474 | * Checks if there is a delegation chain from | 481 | * Checks if there is a delegation chain from |
@@ -507,7 +514,7 @@ GNUNET_ABD_verify ( | |||
507 | size_t nlen; | 514 | size_t nlen; |
508 | size_t clen; | 515 | size_t clen; |
509 | 516 | ||
510 | if (NULL == issuer_attribute || NULL == delegates) | 517 | if ((NULL == issuer_attribute) || (NULL == delegates)) |
511 | { | 518 | { |
512 | GNUNET_break (0); | 519 | GNUNET_break (0); |
513 | return NULL; | 520 | return NULL; |
@@ -515,7 +522,7 @@ GNUNET_ABD_verify ( | |||
515 | 522 | ||
516 | clen = GNUNET_ABD_delegates_get_size (delegate_count, delegates); | 523 | clen = GNUNET_ABD_delegates_get_size (delegate_count, delegates); |
517 | 524 | ||
518 | //DEBUG LOG | 525 | // DEBUG LOG |
519 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 526 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
520 | "Trying to verify `%s' in ABD\n", | 527 | "Trying to verify `%s' in ABD\n", |
521 | issuer_attribute); | 528 | issuer_attribute); |
@@ -543,14 +550,15 @@ GNUNET_ABD_verify ( | |||
543 | 550 | ||
544 | GNUNET_memcpy (&v_msg[1], issuer_attribute, strlen (issuer_attribute)); | 551 | GNUNET_memcpy (&v_msg[1], issuer_attribute, strlen (issuer_attribute)); |
545 | GNUNET_ABD_delegates_serialize (delegate_count, | 552 | GNUNET_ABD_delegates_serialize (delegate_count, |
546 | delegates, | 553 | delegates, |
547 | clen, | 554 | clen, |
548 | ((char *) &v_msg[1]) + | 555 | ((char *) &v_msg[1]) |
549 | strlen (issuer_attribute) + 1); | 556 | + strlen (issuer_attribute) + 1); |
550 | GNUNET_CONTAINER_DLL_insert (handle->request_head, handle->request_tail, vr); | 557 | GNUNET_CONTAINER_DLL_insert (handle->request_head, handle->request_tail, vr); |
551 | if (NULL != handle->mq) | 558 | if (NULL != handle->mq) |
552 | GNUNET_MQ_send_copy (handle->mq, vr->env); | 559 | GNUNET_MQ_send_copy (handle->mq, vr->env); |
553 | return vr; | 560 | return vr; |
554 | } | 561 | } |
555 | 562 | ||
563 | |||
556 | /* end of abd_api.c */ | 564 | /* end of abd_api.c */ |
diff --git a/src/abd/abd_serialization.c b/src/abd/abd_serialization.c index d2bc15166..90a89886b 100644 --- a/src/abd/abd_serialization.c +++ b/src/abd/abd_serialization.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | /** | 22 | /** |
23 | * @file abd/abd_serialization.c | 23 | * @file abd/abd_serialization.c |
24 | * @brief API to serialize and deserialize delegation chains | 24 | * @brief API to serialize and deserialize delegation chains |
25 | * and abds | 25 | * and abds |
26 | * @author Martin Schanzenbach | 26 | * @author Martin Schanzenbach |
27 | */ | 27 | */ |
@@ -58,6 +58,7 @@ GNUNET_ABD_delegation_set_get_size ( | |||
58 | return ret; | 58 | return ret; |
59 | } | 59 | } |
60 | 60 | ||
61 | |||
61 | /** | 62 | /** |
62 | * Serizalize the given delegation chain entries and abd | 63 | * Serizalize the given delegation chain entries and abd |
63 | * | 64 | * |
@@ -158,12 +159,15 @@ GNUNET_ABD_delegates_get_size ( | |||
158 | 159 | ||
159 | for (i = 0; i < c_count; i++) | 160 | for (i = 0; i < c_count; i++) |
160 | { | 161 | { |
161 | GNUNET_assert ((ret + cd[i].issuer_attribute_len + cd[i].subject_attribute_len) >= ret); | 162 | GNUNET_assert ((ret + cd[i].issuer_attribute_len |
163 | + cd[i].subject_attribute_len) >= ret); | ||
162 | // subject_attribute_len should be 0 | 164 | // subject_attribute_len should be 0 |
163 | ret += cd[i].issuer_attribute_len + cd[i].subject_attribute_len; | 165 | ret += cd[i].issuer_attribute_len + cd[i].subject_attribute_len; |
164 | } | 166 | } |
165 | return ret; | 167 | return ret; |
166 | } | 168 | } |
169 | |||
170 | |||
167 | /** | 171 | /** |
168 | * Serizalize the given abds | 172 | * Serizalize the given abds |
169 | * | 173 | * |
@@ -187,15 +191,15 @@ GNUNET_ABD_delegates_serialize ( | |||
187 | off = 0; | 191 | off = 0; |
188 | for (i = 0; i < c_count; i++) | 192 | for (i = 0; i < c_count; i++) |
189 | { | 193 | { |
190 | //c_rec.subject_attribute_len = htonl ((uint32_t) cd[i].subject_attribute_len); | 194 | // c_rec.subject_attribute_len = htonl ((uint32_t) cd[i].subject_attribute_len); |
191 | c_rec.issuer_attribute_len = htonl ((uint32_t) cd[i].issuer_attribute_len); | 195 | c_rec.issuer_attribute_len = htonl ((uint32_t) cd[i].issuer_attribute_len); |
192 | c_rec.issuer_key = cd[i].issuer_key; | 196 | c_rec.issuer_key = cd[i].issuer_key; |
193 | c_rec.subject_key = cd[i].subject_key; | 197 | c_rec.subject_key = cd[i].subject_key; |
194 | c_rec.signature = cd[i].signature; | 198 | c_rec.signature = cd[i].signature; |
195 | c_rec.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_DELEGATE); | 199 | c_rec.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_DELEGATE); |
196 | c_rec.purpose.size = | 200 | c_rec.purpose.size = |
197 | htonl ((sizeof (struct DelegateEntry) + cd[i].issuer_attribute_len) - | 201 | htonl ((sizeof (struct DelegateEntry) + cd[i].issuer_attribute_len) |
198 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature)); | 202 | - sizeof (struct GNUNET_CRYPTO_EcdsaSignature)); |
199 | c_rec.expiration = GNUNET_htonll (cd[i].expiration.abs_value_us); | 203 | c_rec.expiration = GNUNET_htonll (cd[i].expiration.abs_value_us); |
200 | if (off + sizeof (c_rec) > dest_size) | 204 | if (off + sizeof (c_rec) > dest_size) |
201 | return -1; | 205 | return -1; |
@@ -224,9 +228,9 @@ GNUNET_ABD_delegates_serialize ( | |||
224 | */ | 228 | */ |
225 | int | 229 | int |
226 | GNUNET_ABD_delegates_deserialize (size_t len, | 230 | GNUNET_ABD_delegates_deserialize (size_t len, |
227 | const char *src, | 231 | const char *src, |
228 | unsigned int c_count, | 232 | unsigned int c_count, |
229 | struct GNUNET_ABD_Delegate *cd) | 233 | struct GNUNET_ABD_Delegate *cd) |
230 | { | 234 | { |
231 | struct DelegateEntry c_rec; | 235 | struct DelegateEntry c_rec; |
232 | unsigned int i; | 236 | unsigned int i; |
@@ -285,6 +289,7 @@ GNUNET_ABD_delegation_chain_get_size ( | |||
285 | return ret + GNUNET_ABD_delegates_get_size (c_count, cd); | 289 | return ret + GNUNET_ABD_delegates_get_size (c_count, cd); |
286 | } | 290 | } |
287 | 291 | ||
292 | |||
288 | /** | 293 | /** |
289 | * Serizalize the given delegation chain entries and abd | 294 | * Serizalize the given delegation chain entries and abd |
290 | * | 295 | * |
@@ -336,9 +341,9 @@ GNUNET_ABD_delegation_chain_serialize ( | |||
336 | off += dd[i].subject_attribute_len; | 341 | off += dd[i].subject_attribute_len; |
337 | } | 342 | } |
338 | return off + GNUNET_ABD_delegates_serialize (c_count, | 343 | return off + GNUNET_ABD_delegates_serialize (c_count, |
339 | cd, | 344 | cd, |
340 | dest_size - off, | 345 | dest_size - off, |
341 | &dest[off]); | 346 | &dest[off]); |
342 | } | 347 | } |
343 | 348 | ||
344 | 349 | ||
@@ -387,14 +392,15 @@ GNUNET_ABD_delegation_chain_deserialize ( | |||
387 | off += dd[i].subject_attribute_len; | 392 | off += dd[i].subject_attribute_len; |
388 | } | 393 | } |
389 | return GNUNET_ABD_delegates_deserialize (len - off, | 394 | return GNUNET_ABD_delegates_deserialize (len - off, |
390 | &src[off], | 395 | &src[off], |
391 | c_count, | 396 | c_count, |
392 | cd); | 397 | cd); |
393 | } | 398 | } |
394 | 399 | ||
400 | |||
395 | int | 401 | int |
396 | GNUNET_ABD_delegate_serialize (struct GNUNET_ABD_Delegate *dele, | 402 | GNUNET_ABD_delegate_serialize (struct GNUNET_ABD_Delegate *dele, |
397 | char **data) | 403 | char **data) |
398 | { | 404 | { |
399 | size_t size; | 405 | size_t size; |
400 | struct DelegateEntry *cdata; | 406 | struct DelegateEntry *cdata; |
@@ -455,6 +461,7 @@ GNUNET_ABD_delegate_serialize (struct GNUNET_ABD_Delegate *dele, | |||
455 | return size; | 461 | return size; |
456 | } | 462 | } |
457 | 463 | ||
464 | |||
458 | struct GNUNET_ABD_Delegate * | 465 | struct GNUNET_ABD_Delegate * |
459 | GNUNET_ABD_delegate_deserialize (const char *data, size_t data_size) | 466 | GNUNET_ABD_delegate_deserialize (const char *data, size_t data_size) |
460 | { | 467 | { |
@@ -505,4 +512,5 @@ GNUNET_ABD_delegate_deserialize (const char *data, size_t data_size) | |||
505 | return dele; | 512 | return dele; |
506 | } | 513 | } |
507 | 514 | ||
515 | |||
508 | /* end of abd_serialization.c */ | 516 | /* end of abd_serialization.c */ |
diff --git a/src/abd/abd_serialization.h b/src/abd/abd_serialization.h index cef9f42ef..21dc45a7b 100644 --- a/src/abd/abd_serialization.h +++ b/src/abd/abd_serialization.h | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | /** | 22 | /** |
23 | * @file abd/abd_serialization.h | 23 | * @file abd/abd_serialization.h |
24 | * @brief API to serialize and deserialize delegation chains | 24 | * @brief API to serialize and deserialize delegation chains |
25 | * and abds | 25 | * and abds |
26 | * @author Martin Schanzenbach | 26 | * @author Martin Schanzenbach |
27 | */ | 27 | */ |
@@ -136,6 +136,7 @@ GNUNET_ABD_delegation_chain_deserialize ( | |||
136 | struct GNUNET_ABD_Delegation *dd, | 136 | struct GNUNET_ABD_Delegation *dd, |
137 | unsigned int c_count, | 137 | unsigned int c_count, |
138 | struct GNUNET_ABD_Delegate *cd); | 138 | struct GNUNET_ABD_Delegate *cd); |
139 | |||
139 | size_t | 140 | size_t |
140 | GNUNET_ABD_delegates_get_size ( | 141 | GNUNET_ABD_delegates_get_size ( |
141 | unsigned int c_count, | 142 | unsigned int c_count, |
@@ -151,15 +152,16 @@ GNUNET_ABD_delegates_serialize ( | |||
151 | 152 | ||
152 | int | 153 | int |
153 | GNUNET_ABD_delegates_deserialize (size_t len, | 154 | GNUNET_ABD_delegates_deserialize (size_t len, |
154 | const char *src, | 155 | const char *src, |
155 | unsigned int c_count, | 156 | unsigned int c_count, |
156 | struct GNUNET_ABD_Delegate *cd); | 157 | struct GNUNET_ABD_Delegate *cd); |
157 | 158 | ||
158 | int | 159 | int |
159 | GNUNET_ABD_delegate_serialize (struct GNUNET_ABD_Delegate *cred, | 160 | GNUNET_ABD_delegate_serialize (struct GNUNET_ABD_Delegate *cred, |
160 | char **data); | 161 | char **data); |
161 | 162 | ||
162 | struct GNUNET_ABD_Delegate * | 163 | struct GNUNET_ABD_Delegate * |
163 | GNUNET_ABD_delegate_deserialize (const char *data, size_t data_size); | 164 | GNUNET_ABD_delegate_deserialize (const char *data, size_t data_size); |
165 | |||
164 | #endif | 166 | #endif |
165 | /* end of abd_serialization.h */ | 167 | /* end of abd_serialization.h */ |
diff --git a/src/abd/delegate_misc.c b/src/abd/delegate_misc.c index fb5834274..df34cff8b 100644 --- a/src/abd/delegate_misc.c +++ b/src/abd/delegate_misc.c | |||
@@ -75,6 +75,7 @@ GNUNET_ABD_delegate_to_string ( | |||
75 | return cred_str; | 75 | return cred_str; |
76 | } | 76 | } |
77 | 77 | ||
78 | |||
78 | struct GNUNET_ABD_Delegate * | 79 | struct GNUNET_ABD_Delegate * |
79 | GNUNET_ABD_delegate_from_string (const char *s) | 80 | GNUNET_ABD_delegate_from_string (const char *s) |
80 | { | 81 | { |
@@ -174,6 +175,7 @@ GNUNET_ABD_delegate_from_string (const char *s) | |||
174 | return dele; | 175 | return dele; |
175 | } | 176 | } |
176 | 177 | ||
178 | |||
177 | /** | 179 | /** |
178 | * Issue an attribute to a subject | 180 | * Issue an attribute to a subject |
179 | * | 181 | * |
diff --git a/src/abd/delegate_misc.h b/src/abd/delegate_misc.h index 42a95ce99..0a4ddd9eb 100644 --- a/src/abd/delegate_misc.h +++ b/src/abd/delegate_misc.h | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | char * | 29 | char * |
30 | GNUNET_ABD_delegate_to_string ( | 30 | GNUNET_ABD_delegate_to_string ( |
31 | const struct GNUNET_ABD_Delegate *cred); | 31 | const struct GNUNET_ABD_Delegate *cred); |
32 | 32 | ||
33 | struct GNUNET_ABD_Delegate * | 33 | struct GNUNET_ABD_Delegate * |
34 | GNUNET_ABD_delegate_from_string (const char *str); | 34 | GNUNET_ABD_delegate_from_string (const char *str); |
diff --git a/src/abd/gnunet-abd.c b/src/abd/gnunet-abd.c index 23083ec68..a5d32c3dd 100644 --- a/src/abd/gnunet-abd.c +++ b/src/abd/gnunet-abd.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
@@ -268,25 +268,27 @@ do_timeout (void *cls) | |||
268 | GNUNET_SCHEDULER_shutdown (); | 268 | GNUNET_SCHEDULER_shutdown (); |
269 | } | 269 | } |
270 | 270 | ||
271 | |||
271 | static void | 272 | static void |
272 | handle_intermediate_result(void *cls, | 273 | handle_intermediate_result (void *cls, |
273 | struct GNUNET_ABD_Delegation *dd, | 274 | struct GNUNET_ABD_Delegation *dd, |
274 | bool is_bw) | 275 | bool is_bw) |
275 | { | 276 | { |
276 | char *prefix = ""; | 277 | char *prefix = ""; |
277 | if(is_bw) | 278 | if (is_bw) |
278 | prefix = "Backward -"; | 279 | prefix = "Backward -"; |
279 | else | 280 | else |
280 | prefix = "Forward -"; | 281 | prefix = "Forward -"; |
281 | 282 | ||
282 | printf ("%s Intermediate result: %s.%s <- %s.%s\n", | 283 | printf ("%s Intermediate result: %s.%s <- %s.%s\n", |
283 | prefix, | 284 | prefix, |
284 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->issuer_key), | 285 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->issuer_key), |
285 | dd->issuer_attribute, | 286 | dd->issuer_attribute, |
286 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->subject_key), | 287 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->subject_key), |
287 | dd->subject_attribute); | 288 | dd->subject_attribute); |
288 | } | 289 | } |
289 | 290 | ||
291 | |||
290 | static void | 292 | static void |
291 | handle_collect_result (void *cls, | 293 | handle_collect_result (void *cls, |
292 | unsigned int d_count, | 294 | unsigned int d_count, |
@@ -373,6 +375,7 @@ handle_verify_result (void *cls, | |||
373 | GNUNET_SCHEDULER_shutdown (); | 375 | GNUNET_SCHEDULER_shutdown (); |
374 | } | 376 | } |
375 | 377 | ||
378 | |||
376 | /** | 379 | /** |
377 | * Callback invoked from identity service with ego information. | 380 | * Callback invoked from identity service with ego information. |
378 | * An @a ego of NULL means the ego was not found. | 381 | * An @a ego of NULL means the ego was not found. |
@@ -414,19 +417,20 @@ identity_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) | |||
414 | privkey = GNUNET_IDENTITY_ego_get_private_key (ego); | 417 | privkey = GNUNET_IDENTITY_ego_get_private_key (ego); |
415 | 418 | ||
416 | collect_request = GNUNET_ABD_collect (abd, | 419 | collect_request = GNUNET_ABD_collect (abd, |
417 | &issuer_pkey, | 420 | &issuer_pkey, |
418 | issuer_attr, | 421 | issuer_attr, |
419 | privkey, | 422 | privkey, |
420 | direction, | 423 | direction, |
421 | &handle_collect_result, | 424 | &handle_collect_result, |
422 | NULL, | 425 | NULL, |
423 | &handle_intermediate_result, | 426 | &handle_intermediate_result, |
424 | NULL); | 427 | NULL); |
425 | return; | 428 | return; |
426 | } | 429 | } |
427 | GNUNET_SCHEDULER_shutdown (); | 430 | GNUNET_SCHEDULER_shutdown (); |
428 | } | 431 | } |
429 | 432 | ||
433 | |||
430 | /** | 434 | /** |
431 | * Parse expiration time. | 435 | * Parse expiration time. |
432 | * | 436 | * |
@@ -473,6 +477,7 @@ parse_expiration (const char *expirationstring, | |||
473 | return GNUNET_SYSERR; | 477 | return GNUNET_SYSERR; |
474 | } | 478 | } |
475 | 479 | ||
480 | |||
476 | /** | 481 | /** |
477 | * Function called if lookup fails. | 482 | * Function called if lookup fails. |
478 | */ | 483 | */ |
@@ -483,13 +488,15 @@ error_cb (void *cls) | |||
483 | GNUNET_SCHEDULER_shutdown (); | 488 | GNUNET_SCHEDULER_shutdown (); |
484 | return; | 489 | return; |
485 | } | 490 | } |
491 | |||
492 | |||
486 | static void | 493 | static void |
487 | add_continuation (void *cls, int32_t success, const char *emsg) | 494 | add_continuation (void *cls, int32_t success, const char *emsg) |
488 | { | 495 | { |
489 | struct GNUNET_NAMESTORE_QueueEntry **qe = cls; | 496 | struct GNUNET_NAMESTORE_QueueEntry **qe = cls; |
490 | *qe = NULL; | 497 | *qe = NULL; |
491 | 498 | ||
492 | if(GNUNET_OK == success) | 499 | if (GNUNET_OK == success) |
493 | printf ("Adding successful.\n"); | 500 | printf ("Adding successful.\n"); |
494 | else | 501 | else |
495 | fprintf (stderr, "Error occured during adding, shutting down.\n"); | 502 | fprintf (stderr, "Error occured during adding, shutting down.\n"); |
@@ -497,6 +504,7 @@ add_continuation (void *cls, int32_t success, const char *emsg) | |||
497 | GNUNET_SCHEDULER_shutdown (); | 504 | GNUNET_SCHEDULER_shutdown (); |
498 | } | 505 | } |
499 | 506 | ||
507 | |||
500 | static void | 508 | static void |
501 | get_existing_record (void *cls, | 509 | get_existing_record (void *cls, |
502 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 510 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, |
@@ -535,6 +543,7 @@ get_existing_record (void *cls, | |||
535 | return; | 543 | return; |
536 | } | 544 | } |
537 | 545 | ||
546 | |||
538 | static void | 547 | static void |
539 | store_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) | 548 | store_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) |
540 | { | 549 | { |
@@ -627,6 +636,7 @@ store_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) | |||
627 | return; | 636 | return; |
628 | } | 637 | } |
629 | 638 | ||
639 | |||
630 | static void | 640 | static void |
631 | sign_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) | 641 | sign_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) |
632 | { | 642 | { |
@@ -695,10 +705,10 @@ sign_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) | |||
695 | 705 | ||
696 | // Sign delegate | 706 | // Sign delegate |
697 | dele = GNUNET_ABD_delegate_issue (privkey, | 707 | dele = GNUNET_ABD_delegate_issue (privkey, |
698 | &subject_pkey, | 708 | &subject_pkey, |
699 | issuer_attr, | 709 | issuer_attr, |
700 | subject_attr, | 710 | subject_attr, |
701 | &etime_abs); | 711 | &etime_abs); |
702 | res = GNUNET_ABD_delegate_to_string (dele); | 712 | res = GNUNET_ABD_delegate_to_string (dele); |
703 | GNUNET_free (dele); | 713 | GNUNET_free (dele); |
704 | printf ("%s\n", res); | 714 | printf ("%s\n", res); |
@@ -709,6 +719,7 @@ sign_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) | |||
709 | GNUNET_SCHEDULER_shutdown (); | 719 | GNUNET_SCHEDULER_shutdown (); |
710 | } | 720 | } |
711 | 721 | ||
722 | |||
712 | /** | 723 | /** |
713 | * Main function that will be run. | 724 | * Main function that will be run. |
714 | * | 725 | * |
@@ -796,7 +807,7 @@ run (void *cls, | |||
796 | return; | 807 | return; |
797 | } | 808 | } |
798 | 809 | ||
799 | if (GNUNET_NO == forward && GNUNET_NO == backward) | 810 | if ((GNUNET_NO == forward) && (GNUNET_NO == backward)) |
800 | { | 811 | { |
801 | // set default: bidirectional | 812 | // set default: bidirectional |
802 | forward = GNUNET_YES; | 813 | forward = GNUNET_YES; |
@@ -885,14 +896,14 @@ run (void *cls, | |||
885 | GNUNET_SCHEDULER_shutdown (); | 896 | GNUNET_SCHEDULER_shutdown (); |
886 | return; | 897 | return; |
887 | } | 898 | } |
888 | if (NULL == issuer_attr || NULL == subject_delegate) | 899 | if ((NULL == issuer_attr) || (NULL == subject_delegate)) |
889 | { | 900 | { |
890 | fprintf (stderr, _ ("You must provide issuer and subject attributes\n")); | 901 | fprintf (stderr, _ ("You must provide issuer and subject attributes\n")); |
891 | GNUNET_SCHEDULER_shutdown (); | 902 | GNUNET_SCHEDULER_shutdown (); |
892 | return; | 903 | return; |
893 | } | 904 | } |
894 | 905 | ||
895 | //Subject credentials are comma separated | 906 | // Subject credentials are comma separated |
896 | char *tmp = GNUNET_strdup (subject_delegate); | 907 | char *tmp = GNUNET_strdup (subject_delegate); |
897 | char *tok = strtok (tmp, ","); | 908 | char *tok = strtok (tmp, ","); |
898 | if (NULL == tok) | 909 | if (NULL == tok) |
@@ -923,16 +934,16 @@ run (void *cls, | |||
923 | } | 934 | } |
924 | 935 | ||
925 | verify_request = GNUNET_ABD_verify (abd, | 936 | verify_request = GNUNET_ABD_verify (abd, |
926 | &issuer_pkey, | 937 | &issuer_pkey, |
927 | issuer_attr, | 938 | issuer_attr, |
928 | &subject_pkey, | 939 | &subject_pkey, |
929 | count, | 940 | count, |
930 | delegates, | 941 | delegates, |
931 | direction, | 942 | direction, |
932 | &handle_verify_result, | 943 | &handle_verify_result, |
933 | NULL, | 944 | NULL, |
934 | &handle_intermediate_result, | 945 | &handle_intermediate_result, |
935 | NULL); | 946 | NULL); |
936 | for (i = 0; i < count; i++) | 947 | for (i = 0; i < count; i++) |
937 | { | 948 | { |
938 | GNUNET_free ((char *) delegates[i].issuer_attribute); | 949 | GNUNET_free ((char *) delegates[i].issuer_attribute); |
@@ -961,93 +972,93 @@ int | |||
961 | main (int argc, char *const *argv) | 972 | main (int argc, char *const *argv) |
962 | { | 973 | { |
963 | struct GNUNET_GETOPT_CommandLineOption options[] = | 974 | struct GNUNET_GETOPT_CommandLineOption options[] = |
964 | {GNUNET_GETOPT_option_flag ('V', | 975 | {GNUNET_GETOPT_option_flag ('V', |
965 | "verify", | 976 | "verify", |
977 | gettext_noop ( | ||
978 | "verify credential against attribute"), | ||
979 | &verify), | ||
980 | GNUNET_GETOPT_option_string ( | ||
981 | 's', | ||
982 | "subject", | ||
983 | "PKEY", | ||
984 | gettext_noop ( | ||
985 | "The public key of the subject to lookup the" | ||
986 | "credential for, or for issuer side storage: subject and its attributes"), | ||
987 | &subject), | ||
988 | GNUNET_GETOPT_option_string ( | ||
989 | 'd', | ||
990 | "delegate", | ||
991 | "DELE", | ||
992 | gettext_noop ("The private, signed delegate presented by the subject"), | ||
993 | &subject_delegate), | ||
994 | GNUNET_GETOPT_option_string ( | ||
995 | 'i', | ||
996 | "issuer", | ||
997 | "PKEY", | ||
998 | gettext_noop ( | ||
999 | "The public key of the authority to verify the credential against"), | ||
1000 | &issuer_key), | ||
1001 | GNUNET_GETOPT_option_string ('e', | ||
1002 | "ego", | ||
1003 | "EGO", | ||
1004 | gettext_noop ("The ego/zone name to use"), | ||
1005 | &ego_name), | ||
1006 | GNUNET_GETOPT_option_string ( | ||
1007 | 'a', | ||
1008 | "attribute", | ||
1009 | "ATTR", | ||
1010 | gettext_noop ("The issuer attribute to verify against or to issue"), | ||
1011 | &issuer_attr), | ||
1012 | GNUNET_GETOPT_option_string ('T', | ||
1013 | "ttl", | ||
1014 | "EXP", | ||
966 | gettext_noop ( | 1015 | gettext_noop ( |
967 | "verify credential against attribute"), | 1016 | "The time to live for the credential." |
968 | &verify), | 1017 | "e.g. 5m, 6h, \"1990-12-30 12:00:00\""), |
969 | GNUNET_GETOPT_option_string ( | 1018 | &expiration), |
970 | 's', | 1019 | GNUNET_GETOPT_option_flag ('g', |
971 | "subject", | 1020 | "collect", |
972 | "PKEY", | 1021 | gettext_noop ("collect credentials"), |
973 | gettext_noop ( | 1022 | &collect), |
974 | "The public key of the subject to lookup the" | 1023 | GNUNET_GETOPT_option_flag ('U', |
975 | "credential for, or for issuer side storage: subject and its attributes"), | 1024 | "createIssuerSide", |
976 | &subject), | 1025 | gettext_noop ( |
977 | GNUNET_GETOPT_option_string ( | 1026 | "Create and issue a credential issuer side."), |
978 | 'd', | 1027 | &create_is), |
979 | "delegate", | 1028 | GNUNET_GETOPT_option_flag ('C', |
980 | "DELE", | 1029 | "createSubjectSide", |
981 | gettext_noop ("The private, signed delegate presented by the subject"), | 1030 | gettext_noop ( |
982 | &subject_delegate), | 1031 | "Issue a credential subject side."), |
983 | GNUNET_GETOPT_option_string ( | 1032 | &create_ss), |
984 | 'i', | 1033 | GNUNET_GETOPT_option_flag ( |
985 | "issuer", | 1034 | 'S', |
986 | "PKEY", | 1035 | "signSubjectSide", |
987 | gettext_noop ( | 1036 | gettext_noop ("Create, sign and return a credential subject side."), |
988 | "The public key of the authority to verify the credential against"), | 1037 | &sign_ss), |
989 | &issuer_key), | 1038 | GNUNET_GETOPT_option_string ( |
990 | GNUNET_GETOPT_option_string ('e', | 1039 | 'x', |
991 | "ego", | 1040 | "import", |
992 | "EGO", | 1041 | "IMP", |
993 | gettext_noop ("The ego/zone name to use"), | 1042 | gettext_noop ( |
994 | &ego_name), | 1043 | "Import signed credentials that should be issued to a zone/ego"), |
995 | GNUNET_GETOPT_option_string ( | 1044 | &import), |
996 | 'a', | 1045 | GNUNET_GETOPT_option_flag ('P', |
997 | "attribute", | 1046 | "private", |
998 | "ATTR", | 1047 | gettext_noop ("Create private record entry."), |
999 | gettext_noop ("The issuer attribute to verify against or to issue"), | 1048 | &is_private), |
1000 | &issuer_attr), | 1049 | GNUNET_GETOPT_option_flag ( |
1001 | GNUNET_GETOPT_option_string ('T', | 1050 | 'F', |
1002 | "ttl", | 1051 | "forward", |
1003 | "EXP", | 1052 | gettext_noop ( |
1004 | gettext_noop ( | 1053 | "Indicates that the collect/verify process is done via forward search."), |
1005 | "The time to live for the credential." | 1054 | &forward), |
1006 | "e.g. 5m, 6h, \"1990-12-30 12:00:00\""), | 1055 | GNUNET_GETOPT_option_flag ( |
1007 | &expiration), | 1056 | 'B', |
1008 | GNUNET_GETOPT_option_flag ('g', | 1057 | "backward", |
1009 | "collect", | 1058 | gettext_noop ( |
1010 | gettext_noop ("collect credentials"), | 1059 | "Indicates that the collect/verify process is done via forward search."), |
1011 | &collect), | 1060 | &backward), |
1012 | GNUNET_GETOPT_option_flag ('U', | 1061 | GNUNET_GETOPT_OPTION_END}; |
1013 | "createIssuerSide", | ||
1014 | gettext_noop ( | ||
1015 | "Create and issue a credential issuer side."), | ||
1016 | &create_is), | ||
1017 | GNUNET_GETOPT_option_flag ('C', | ||
1018 | "createSubjectSide", | ||
1019 | gettext_noop ( | ||
1020 | "Issue a credential subject side."), | ||
1021 | &create_ss), | ||
1022 | GNUNET_GETOPT_option_flag ( | ||
1023 | 'S', | ||
1024 | "signSubjectSide", | ||
1025 | gettext_noop ("Create, sign and return a credential subject side."), | ||
1026 | &sign_ss), | ||
1027 | GNUNET_GETOPT_option_string ( | ||
1028 | 'x', | ||
1029 | "import", | ||
1030 | "IMP", | ||
1031 | gettext_noop ( | ||
1032 | "Import signed credentials that should be issued to a zone/ego"), | ||
1033 | &import), | ||
1034 | GNUNET_GETOPT_option_flag ('P', | ||
1035 | "private", | ||
1036 | gettext_noop ("Create private record entry."), | ||
1037 | &is_private), | ||
1038 | GNUNET_GETOPT_option_flag ( | ||
1039 | 'F', | ||
1040 | "forward", | ||
1041 | gettext_noop ( | ||
1042 | "Indicates that the collect/verify process is done via forward search."), | ||
1043 | &forward), | ||
1044 | GNUNET_GETOPT_option_flag ( | ||
1045 | 'B', | ||
1046 | "backward", | ||
1047 | gettext_noop ( | ||
1048 | "Indicates that the collect/verify process is done via forward search."), | ||
1049 | &backward), | ||
1050 | GNUNET_GETOPT_OPTION_END}; | ||
1051 | 1062 | ||
1052 | 1063 | ||
1053 | timeout = GNUNET_TIME_UNIT_FOREVER_REL; | 1064 | timeout = GNUNET_TIME_UNIT_FOREVER_REL; |
@@ -1056,15 +1067,16 @@ main (int argc, char *const *argv) | |||
1056 | 1067 | ||
1057 | GNUNET_log_setup ("gnunet-abd", "WARNING", NULL); | 1068 | GNUNET_log_setup ("gnunet-abd", "WARNING", NULL); |
1058 | if (GNUNET_OK != GNUNET_PROGRAM_run (argc, | 1069 | if (GNUNET_OK != GNUNET_PROGRAM_run (argc, |
1059 | argv, | 1070 | argv, |
1060 | "gnunet-abd", | 1071 | "gnunet-abd", |
1061 | _ ("GNUnet abd resolver tool"), | 1072 | _ ("GNUnet abd resolver tool"), |
1062 | options, | 1073 | options, |
1063 | &run, | 1074 | &run, |
1064 | NULL)) | 1075 | NULL)) |
1065 | ret = 1; | 1076 | ret = 1; |
1066 | GNUNET_free ((void *) argv); | 1077 | GNUNET_free ((void *) argv); |
1067 | return ret; | 1078 | return ret; |
1068 | } | 1079 | } |
1069 | 1080 | ||
1081 | |||
1070 | /* end of gnunet-abd.c */ | 1082 | /* end of gnunet-abd.c */ |
diff --git a/src/abd/gnunet-service-abd.c b/src/abd/gnunet-service-abd.c index 84222b290..36b0009ef 100644 --- a/src/abd/gnunet-service-abd.c +++ b/src/abd/gnunet-service-abd.c | |||
@@ -360,6 +360,7 @@ print_deleset (struct DelegationSetQueueEntry *dsentry, char *text) | |||
360 | dsentry->delegation_chain_entry->subject_attribute); | 360 | dsentry->delegation_chain_entry->subject_attribute); |
361 | } | 361 | } |
362 | 362 | ||
363 | |||
363 | static void | 364 | static void |
364 | cleanup_dsq_entry (struct DelegationSetQueueEntry *ds_entry) | 365 | cleanup_dsq_entry (struct DelegationSetQueueEntry *ds_entry) |
365 | { | 366 | { |
@@ -385,18 +386,19 @@ cleanup_dsq_entry (struct DelegationSetQueueEntry *ds_entry) | |||
385 | GNUNET_free (ds_entry->delegation_chain_entry); | 386 | GNUNET_free (ds_entry->delegation_chain_entry); |
386 | } | 387 | } |
387 | // Free DQ entries | 388 | // Free DQ entries |
388 | for(struct DelegationQueueEntry *dq_entry = ds_entry->queue_entries_head; | 389 | for (struct DelegationQueueEntry *dq_entry = ds_entry->queue_entries_head; |
389 | NULL != ds_entry->queue_entries_head; | 390 | NULL != ds_entry->queue_entries_head; |
390 | dq_entry = ds_entry->queue_entries_head) | 391 | dq_entry = ds_entry->queue_entries_head) |
391 | { | 392 | { |
392 | GNUNET_CONTAINER_DLL_remove (ds_entry->queue_entries_head, | 393 | GNUNET_CONTAINER_DLL_remove (ds_entry->queue_entries_head, |
393 | ds_entry->queue_entries_tail, | 394 | ds_entry->queue_entries_tail, |
394 | dq_entry); | 395 | dq_entry); |
395 | GNUNET_free (dq_entry); | 396 | GNUNET_free (dq_entry); |
396 | } | 397 | } |
397 | GNUNET_free (ds_entry); | 398 | GNUNET_free (ds_entry); |
398 | } | 399 | } |
399 | 400 | ||
401 | |||
400 | static void | 402 | static void |
401 | cleanup_handle (struct VerifyRequestHandle *vrh) | 403 | cleanup_handle (struct VerifyRequestHandle *vrh) |
402 | { | 404 | { |
@@ -405,21 +407,22 @@ cleanup_handle (struct VerifyRequestHandle *vrh) | |||
405 | 407 | ||
406 | if (NULL != vrh->dsq_head) | 408 | if (NULL != vrh->dsq_head) |
407 | { | 409 | { |
408 | for (struct DelegationSetQueueEntry *ds_entry = vrh->dsq_head; NULL != vrh->dsq_head; | 410 | for (struct DelegationSetQueueEntry *ds_entry = vrh->dsq_head; NULL != |
409 | ds_entry = vrh->dsq_head) | 411 | vrh->dsq_head; |
412 | ds_entry = vrh->dsq_head) | ||
410 | { | 413 | { |
411 | GNUNET_CONTAINER_DLL_remove (vrh->dsq_head, vrh->dsq_tail, ds_entry); | 414 | GNUNET_CONTAINER_DLL_remove (vrh->dsq_head, vrh->dsq_tail, ds_entry); |
412 | cleanup_dsq_entry(ds_entry); | 415 | cleanup_dsq_entry (ds_entry); |
413 | } | 416 | } |
414 | } | 417 | } |
415 | if (NULL != vrh->del_chain_head) | 418 | if (NULL != vrh->del_chain_head) |
416 | { | 419 | { |
417 | for (del_entry = vrh->del_chain_head; NULL != vrh->del_chain_head; | 420 | for (del_entry = vrh->del_chain_head; NULL != vrh->del_chain_head; |
418 | del_entry = vrh->del_chain_head) | 421 | del_entry = vrh->del_chain_head) |
419 | { | 422 | { |
420 | GNUNET_CONTAINER_DLL_remove (vrh->del_chain_head, | 423 | GNUNET_CONTAINER_DLL_remove (vrh->del_chain_head, |
421 | vrh->del_chain_tail, | 424 | vrh->del_chain_tail, |
422 | del_entry); | 425 | del_entry); |
423 | GNUNET_free_non_null (del_entry->delegate); | 426 | GNUNET_free_non_null (del_entry->delegate); |
424 | GNUNET_free (del_entry); | 427 | GNUNET_free (del_entry); |
425 | } | 428 | } |
@@ -428,6 +431,7 @@ cleanup_handle (struct VerifyRequestHandle *vrh) | |||
428 | GNUNET_free (vrh); | 431 | GNUNET_free (vrh); |
429 | } | 432 | } |
430 | 433 | ||
434 | |||
431 | static void | 435 | static void |
432 | shutdown_task (void *cls) | 436 | shutdown_task (void *cls) |
433 | { | 437 | { |
@@ -459,15 +463,18 @@ shutdown_task (void *cls) | |||
459 | } | 463 | } |
460 | } | 464 | } |
461 | 465 | ||
466 | |||
462 | static void | 467 | static void |
463 | send_intermediate_response(struct VerifyRequestHandle *vrh, struct DelegationChainEntry *ch_entry, bool is_bw){ | 468 | send_intermediate_response (struct VerifyRequestHandle *vrh, struct |
469 | DelegationChainEntry *ch_entry, bool is_bw) | ||
470 | { | ||
464 | struct DelegationChainIntermediateMessage *rmsg; | 471 | struct DelegationChainIntermediateMessage *rmsg; |
465 | struct GNUNET_MQ_Envelope *env; | 472 | struct GNUNET_MQ_Envelope *env; |
466 | struct GNUNET_ABD_Delegation *dd; | 473 | struct GNUNET_ABD_Delegation *dd; |
467 | size_t size; | 474 | size_t size; |
468 | 475 | ||
469 | // Don't report immediate results during collect | 476 | // Don't report immediate results during collect |
470 | if(vrh->is_collect) | 477 | if (vrh->is_collect) |
471 | return; | 478 | return; |
472 | 479 | ||
473 | dd = GNUNET_new (struct GNUNET_ABD_Delegation); | 480 | dd = GNUNET_new (struct GNUNET_ABD_Delegation); |
@@ -482,31 +489,32 @@ send_intermediate_response(struct VerifyRequestHandle *vrh, struct DelegationCha | |||
482 | dd->subject_attribute = ch_entry->subject_attribute; | 489 | dd->subject_attribute = ch_entry->subject_attribute; |
483 | dd->subject_attribute_len = strlen (ch_entry->subject_attribute) + 1; | 490 | dd->subject_attribute_len = strlen (ch_entry->subject_attribute) + 1; |
484 | } | 491 | } |
485 | 492 | ||
486 | 493 | ||
487 | size = GNUNET_ABD_delegation_chain_get_size (1, | 494 | size = GNUNET_ABD_delegation_chain_get_size (1, |
488 | dd, | 495 | dd, |
489 | 0, | 496 | 0, |
490 | NULL); | 497 | NULL); |
491 | 498 | ||
492 | env = GNUNET_MQ_msg_extra (rmsg, | 499 | env = GNUNET_MQ_msg_extra (rmsg, |
493 | size, | 500 | size, |
494 | GNUNET_MESSAGE_TYPE_ABD_INTERMEDIATE_RESULT); | 501 | GNUNET_MESSAGE_TYPE_ABD_INTERMEDIATE_RESULT); |
495 | // Assign id so that client can find associated request | 502 | // Assign id so that client can find associated request |
496 | rmsg->id = vrh->request_id; | 503 | rmsg->id = vrh->request_id; |
497 | rmsg->is_bw = htons(is_bw); | 504 | rmsg->is_bw = htons (is_bw); |
498 | rmsg->size = htonl(size); | 505 | rmsg->size = htonl (size); |
499 | 506 | ||
500 | GNUNET_assert ( | 507 | GNUNET_assert ( |
501 | -1 != GNUNET_ABD_delegation_chain_serialize (1, | 508 | -1 != GNUNET_ABD_delegation_chain_serialize (1, |
502 | dd, | 509 | dd, |
503 | 0, | 510 | 0, |
504 | NULL, | 511 | NULL, |
505 | size, | 512 | size, |
506 | (char *) &rmsg[1])); | 513 | (char *) &rmsg[1])); |
507 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (vrh->client), env); | 514 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (vrh->client), env); |
508 | } | 515 | } |
509 | 516 | ||
517 | |||
510 | static void | 518 | static void |
511 | send_lookup_response (struct VerifyRequestHandle *vrh) | 519 | send_lookup_response (struct VerifyRequestHandle *vrh) |
512 | { | 520 | { |
@@ -570,9 +578,9 @@ send_lookup_response (struct VerifyRequestHandle *vrh) | |||
570 | } | 578 | } |
571 | size = | 579 | size = |
572 | GNUNET_ABD_delegation_chain_get_size (vrh->delegation_chain_size, | 580 | GNUNET_ABD_delegation_chain_get_size (vrh->delegation_chain_size, |
573 | dd, | 581 | dd, |
574 | vrh->del_chain_size, | 582 | vrh->del_chain_size, |
575 | dele); | 583 | dele); |
576 | env = GNUNET_MQ_msg_extra (rmsg, | 584 | env = GNUNET_MQ_msg_extra (rmsg, |
577 | size, | 585 | size, |
578 | GNUNET_MESSAGE_TYPE_ABD_VERIFY_RESULT); | 586 | GNUNET_MESSAGE_TYPE_ABD_VERIFY_RESULT); |
@@ -589,11 +597,11 @@ send_lookup_response (struct VerifyRequestHandle *vrh) | |||
589 | GNUNET_assert ( | 597 | GNUNET_assert ( |
590 | -1 != | 598 | -1 != |
591 | GNUNET_ABD_delegation_chain_serialize (vrh->delegation_chain_size, | 599 | GNUNET_ABD_delegation_chain_serialize (vrh->delegation_chain_size, |
592 | dd, | 600 | dd, |
593 | vrh->del_chain_size, | 601 | vrh->del_chain_size, |
594 | dele, | 602 | dele, |
595 | size, | 603 | size, |
596 | (char *) &rmsg[1])); | 604 | (char *) &rmsg[1])); |
597 | 605 | ||
598 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (vrh->client), env); | 606 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (vrh->client), env); |
599 | GNUNET_CONTAINER_DLL_remove (vrh_head, vrh_tail, vrh); | 607 | GNUNET_CONTAINER_DLL_remove (vrh_head, vrh_tail, vrh); |
@@ -604,6 +612,7 @@ send_lookup_response (struct VerifyRequestHandle *vrh) | |||
604 | GNUNET_NO); | 612 | GNUNET_NO); |
605 | } | 613 | } |
606 | 614 | ||
615 | |||
607 | static char * | 616 | static char * |
608 | partial_match (char *tmp_trail, | 617 | partial_match (char *tmp_trail, |
609 | char *tmp_subattr, | 618 | char *tmp_subattr, |
@@ -660,6 +669,7 @@ partial_match (char *tmp_trail, | |||
660 | return attr_trailer; | 669 | return attr_trailer; |
661 | } | 670 | } |
662 | 671 | ||
672 | |||
663 | static int | 673 | static int |
664 | handle_bidirectional_match (struct DelegationSetQueueEntry *actual_entry, | 674 | handle_bidirectional_match (struct DelegationSetQueueEntry *actual_entry, |
665 | struct DelegationSetQueueEntry *match_entry, | 675 | struct DelegationSetQueueEntry *match_entry, |
@@ -679,7 +689,7 @@ handle_bidirectional_match (struct DelegationSetQueueEntry *actual_entry, | |||
679 | fw_entry = old_fw_parent; | 689 | fw_entry = old_fw_parent; |
680 | } | 690 | } |
681 | // set last entry of chain as actual_entry | 691 | // set last entry of chain as actual_entry |
682 | //actual_entry = last_entry; | 692 | // actual_entry = last_entry; |
683 | // set refcount, loop all delegations | 693 | // set refcount, loop all delegations |
684 | for (struct DelegateRecordEntry *del_entry = vrh->del_chain_head; | 694 | for (struct DelegateRecordEntry *del_entry = vrh->del_chain_head; |
685 | del_entry != NULL; | 695 | del_entry != NULL; |
@@ -724,6 +734,7 @@ handle_bidirectional_match (struct DelegationSetQueueEntry *actual_entry, | |||
724 | return GNUNET_YES; | 734 | return GNUNET_YES; |
725 | } | 735 | } |
726 | 736 | ||
737 | |||
727 | static void | 738 | static void |
728 | forward_resolution (void *cls, | 739 | forward_resolution (void *cls, |
729 | uint32_t rd_count, | 740 | uint32_t rd_count, |
@@ -846,9 +857,9 @@ forward_resolution (void *cls, | |||
846 | ds_entry->delegation_chain_entry->issuer_key = del->issuer_key; | 857 | ds_entry->delegation_chain_entry->issuer_key = del->issuer_key; |
847 | ds_entry->delegation_chain_entry->issuer_attribute = | 858 | ds_entry->delegation_chain_entry->issuer_attribute = |
848 | GNUNET_strdup (del->issuer_attribute); | 859 | GNUNET_strdup (del->issuer_attribute); |
849 | 860 | ||
850 | // Found new entry, repoting intermediate result | 861 | // Found new entry, repoting intermediate result |
851 | send_intermediate_response(vrh, ds_entry->delegation_chain_entry, false); | 862 | send_intermediate_response (vrh, ds_entry->delegation_chain_entry, false); |
852 | 863 | ||
853 | // current delegation as parent | 864 | // current delegation as parent |
854 | ds_entry->parent_queue_entry = dq_entry; | 865 | ds_entry->parent_queue_entry = dq_entry; |
@@ -929,7 +940,7 @@ forward_resolution (void *cls, | |||
929 | if (GNUNET_NO == | 940 | if (GNUNET_NO == |
930 | handle_bidirectional_match (ds_entry, del_entry, vrh)) | 941 | handle_bidirectional_match (ds_entry, del_entry, vrh)) |
931 | return; | 942 | return; |
932 | 943 | ||
933 | send_lookup_response (vrh); | 944 | send_lookup_response (vrh); |
934 | return; | 945 | return; |
935 | } | 946 | } |
@@ -948,12 +959,12 @@ forward_resolution (void *cls, | |||
948 | 959 | ||
949 | ds_entry->lookup_request = | 960 | ds_entry->lookup_request = |
950 | GNUNET_GNS_lookup (gns, | 961 | GNUNET_GNS_lookup (gns, |
951 | GNUNET_GNS_EMPTY_LABEL_AT, | 962 | GNUNET_GNS_EMPTY_LABEL_AT, |
952 | &del->issuer_key, | 963 | &del->issuer_key, |
953 | GNUNET_GNSRECORD_TYPE_DELEGATE, | 964 | GNUNET_GNSRECORD_TYPE_DELEGATE, |
954 | GNUNET_GNS_LO_DEFAULT, | 965 | GNUNET_GNS_LO_DEFAULT, |
955 | &forward_resolution, | 966 | &forward_resolution, |
956 | ds_entry); | 967 | ds_entry); |
957 | } | 968 | } |
958 | 969 | ||
959 | if (0 == vrh->pending_lookups) | 970 | if (0 == vrh->pending_lookups) |
@@ -964,6 +975,7 @@ forward_resolution (void *cls, | |||
964 | } | 975 | } |
965 | } | 976 | } |
966 | 977 | ||
978 | |||
967 | static void | 979 | static void |
968 | backward_resolution (void *cls, | 980 | backward_resolution (void *cls, |
969 | uint32_t rd_count, | 981 | uint32_t rd_count, |
@@ -998,10 +1010,10 @@ backward_resolution (void *cls, | |||
998 | 1010 | ||
999 | if (GNUNET_OK != | 1011 | if (GNUNET_OK != |
1000 | GNUNET_ABD_delegation_set_deserialize (GNUNET_ntohll ( | 1012 | GNUNET_ABD_delegation_set_deserialize (GNUNET_ntohll ( |
1001 | sets->data_size), | 1013 | sets->data_size), |
1002 | (const char *) &sets[1], | 1014 | (const char *) &sets[1], |
1003 | ntohl (sets->set_count), | 1015 | ntohl (sets->set_count), |
1004 | set)) | 1016 | set)) |
1005 | { | 1017 | { |
1006 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to deserialize!\n"); | 1018 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to deserialize!\n"); |
1007 | continue; | 1019 | continue; |
@@ -1064,7 +1076,7 @@ backward_resolution (void *cls, | |||
1064 | GNUNET_strdup (current_set->lookup_attribute); | 1076 | GNUNET_strdup (current_set->lookup_attribute); |
1065 | 1077 | ||
1066 | // Found new entry, repoting intermediate result | 1078 | // Found new entry, repoting intermediate result |
1067 | send_intermediate_response(vrh, ds_entry->delegation_chain_entry, true); | 1079 | send_intermediate_response (vrh, ds_entry->delegation_chain_entry, true); |
1068 | 1080 | ||
1069 | ds_entry->parent_queue_entry = dq_entry; // current_delegation; | 1081 | ds_entry->parent_queue_entry = dq_entry; // current_delegation; |
1070 | 1082 | ||
@@ -1127,8 +1139,8 @@ backward_resolution (void *cls, | |||
1127 | ds_entry->unresolved_attribute_delegation); | 1139 | ds_entry->unresolved_attribute_delegation); |
1128 | // Continue with next/new backward resolution | 1140 | // Continue with next/new backward resolution |
1129 | char issuer_attribute_name[strlen ( | 1141 | char issuer_attribute_name[strlen ( |
1130 | ds_entry->unresolved_attribute_delegation) + | 1142 | ds_entry->unresolved_attribute_delegation) |
1131 | 1]; | 1143 | + 1]; |
1132 | strcpy (issuer_attribute_name, ds_entry->unresolved_attribute_delegation); | 1144 | strcpy (issuer_attribute_name, ds_entry->unresolved_attribute_delegation); |
1133 | char *next_attr = strtok (issuer_attribute_name, "."); | 1145 | char *next_attr = strtok (issuer_attribute_name, "."); |
1134 | if (NULL == next_attr) | 1146 | if (NULL == next_attr) |
@@ -1156,7 +1168,7 @@ backward_resolution (void *cls, | |||
1156 | del_entry = del_entry->next) | 1168 | del_entry = del_entry->next) |
1157 | { | 1169 | { |
1158 | // only check entries added by forward algorithm | 1170 | // only check entries added by forward algorithm |
1159 | if (!del_entry->from_bw) | 1171 | if (! del_entry->from_bw) |
1160 | { | 1172 | { |
1161 | // key of list entry matches actual key | 1173 | // key of list entry matches actual key |
1162 | if (0 == memcmp (&del_entry->delegation_chain_entry->issuer_key, | 1174 | if (0 == memcmp (&del_entry->delegation_chain_entry->issuer_key, |
@@ -1174,8 +1186,8 @@ backward_resolution (void *cls, | |||
1174 | // if one node on the path still needs solutions: return | 1186 | // if one node on the path still needs solutions: return |
1175 | if (GNUNET_NO == | 1187 | if (GNUNET_NO == |
1176 | handle_bidirectional_match (del_entry, ds_entry, vrh)) | 1188 | handle_bidirectional_match (del_entry, ds_entry, vrh)) |
1177 | break; | 1189 | break; |
1178 | 1190 | ||
1179 | // Send lookup response | 1191 | // Send lookup response |
1180 | send_lookup_response (vrh); | 1192 | send_lookup_response (vrh); |
1181 | return; | 1193 | return; |
@@ -1197,12 +1209,12 @@ backward_resolution (void *cls, | |||
1197 | ds_entry->handle = vrh; | 1209 | ds_entry->handle = vrh; |
1198 | ds_entry->lookup_request = | 1210 | ds_entry->lookup_request = |
1199 | GNUNET_GNS_lookup (gns, | 1211 | GNUNET_GNS_lookup (gns, |
1200 | lookup_attribute, | 1212 | lookup_attribute, |
1201 | ds_entry->issuer_key, // issuer_key, | 1213 | ds_entry->issuer_key, // issuer_key, |
1202 | GNUNET_GNSRECORD_TYPE_ATTRIBUTE, | 1214 | GNUNET_GNSRECORD_TYPE_ATTRIBUTE, |
1203 | GNUNET_GNS_LO_DEFAULT, | 1215 | GNUNET_GNS_LO_DEFAULT, |
1204 | &backward_resolution, | 1216 | &backward_resolution, |
1205 | ds_entry); | 1217 | ds_entry); |
1206 | 1218 | ||
1207 | GNUNET_free (lookup_attribute); | 1219 | GNUNET_free (lookup_attribute); |
1208 | } | 1220 | } |
@@ -1262,8 +1274,8 @@ delegation_chain_bw_resolution_start (void *cls) | |||
1262 | } | 1274 | } |
1263 | 1275 | ||
1264 | 1276 | ||
1265 | //Check for attributes from the issuer and follow the chain | 1277 | // Check for attributes from the issuer and follow the chain |
1266 | //till you get the required subject's attributes | 1278 | // till you get the required subject's attributes |
1267 | char issuer_attribute_name[strlen (vrh->issuer_attribute) + 1]; | 1279 | char issuer_attribute_name[strlen (vrh->issuer_attribute) + 1]; |
1268 | strcpy (issuer_attribute_name, vrh->issuer_attribute); | 1280 | strcpy (issuer_attribute_name, vrh->issuer_attribute); |
1269 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1281 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1301,6 +1313,7 @@ delegation_chain_bw_resolution_start (void *cls) | |||
1301 | return 0; | 1313 | return 0; |
1302 | } | 1314 | } |
1303 | 1315 | ||
1316 | |||
1304 | static int | 1317 | static int |
1305 | delegation_chain_fw_resolution_start (void *cls) | 1318 | delegation_chain_fw_resolution_start (void *cls) |
1306 | { | 1319 | { |
@@ -1364,11 +1377,13 @@ delegation_chain_fw_resolution_start (void *cls) | |||
1364 | GNUNET_memcpy (ds_entry->issuer_key, | 1377 | GNUNET_memcpy (ds_entry->issuer_key, |
1365 | &del_entry->delegate->subject_key, | 1378 | &del_entry->delegate->subject_key, |
1366 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); | 1379 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); |
1367 | 1380 | ||
1368 | ds_entry->delegation_chain_entry = GNUNET_new (struct DelegationChainEntry); | 1381 | ds_entry->delegation_chain_entry = GNUNET_new (struct DelegationChainEntry); |
1369 | ds_entry->delegation_chain_entry->subject_key = del_entry->delegate->subject_key; | 1382 | ds_entry->delegation_chain_entry->subject_key = |
1383 | del_entry->delegate->subject_key; | ||
1370 | ds_entry->delegation_chain_entry->subject_attribute = NULL; | 1384 | ds_entry->delegation_chain_entry->subject_attribute = NULL; |
1371 | ds_entry->delegation_chain_entry->issuer_key = del_entry->delegate->issuer_key; | 1385 | ds_entry->delegation_chain_entry->issuer_key = |
1386 | del_entry->delegate->issuer_key; | ||
1372 | ds_entry->delegation_chain_entry->issuer_attribute = | 1387 | ds_entry->delegation_chain_entry->issuer_attribute = |
1373 | GNUNET_strdup (del_entry->delegate->issuer_attribute); | 1388 | GNUNET_strdup (del_entry->delegate->issuer_attribute); |
1374 | 1389 | ||
@@ -1392,6 +1407,7 @@ delegation_chain_fw_resolution_start (void *cls) | |||
1392 | return 0; | 1407 | return 0; |
1393 | } | 1408 | } |
1394 | 1409 | ||
1410 | |||
1395 | static int | 1411 | static int |
1396 | check_verify (void *cls, const struct VerifyMessage *v_msg) | 1412 | check_verify (void *cls, const struct VerifyMessage *v_msg) |
1397 | { | 1413 | { |
@@ -1419,6 +1435,7 @@ check_verify (void *cls, const struct VerifyMessage *v_msg) | |||
1419 | return GNUNET_OK; | 1435 | return GNUNET_OK; |
1420 | } | 1436 | } |
1421 | 1437 | ||
1438 | |||
1422 | static void | 1439 | static void |
1423 | handle_verify (void *cls, const struct VerifyMessage *v_msg) | 1440 | handle_verify (void *cls, const struct VerifyMessage *v_msg) |
1424 | { | 1441 | { |
@@ -1465,18 +1482,18 @@ handle_verify (void *cls, const struct VerifyMessage *v_msg) | |||
1465 | 1482 | ||
1466 | // Parse delegates from verifaction message | 1483 | // Parse delegates from verifaction message |
1467 | delegate_count = ntohl (v_msg->d_count); | 1484 | delegate_count = ntohl (v_msg->d_count); |
1468 | delegate_data_size = ntohs (v_msg->header.size) - | 1485 | delegate_data_size = ntohs (v_msg->header.size) |
1469 | sizeof (struct VerifyMessage) - | 1486 | - sizeof (struct VerifyMessage) |
1470 | ntohs (v_msg->issuer_attribute_len) - 1; | 1487 | - ntohs (v_msg->issuer_attribute_len) - 1; |
1471 | struct GNUNET_ABD_Delegate delegates[delegate_count]; | 1488 | struct GNUNET_ABD_Delegate delegates[delegate_count]; |
1472 | memset (delegates, | 1489 | memset (delegates, |
1473 | 0, | 1490 | 0, |
1474 | sizeof (struct GNUNET_ABD_Delegate) * delegate_count); | 1491 | sizeof (struct GNUNET_ABD_Delegate) * delegate_count); |
1475 | delegate_data = (char *) &v_msg[1] + ntohs (v_msg->issuer_attribute_len) + 1; | 1492 | delegate_data = (char *) &v_msg[1] + ntohs (v_msg->issuer_attribute_len) + 1; |
1476 | if (GNUNET_OK != GNUNET_ABD_delegates_deserialize (delegate_data_size, | 1493 | if (GNUNET_OK != GNUNET_ABD_delegates_deserialize (delegate_data_size, |
1477 | delegate_data, | 1494 | delegate_data, |
1478 | delegate_count, | 1495 | delegate_count, |
1479 | delegates)) | 1496 | delegates)) |
1480 | { | 1497 | { |
1481 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot deserialize delegates!\n"); | 1498 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot deserialize delegates!\n"); |
1482 | send_lookup_response (vrh); | 1499 | send_lookup_response (vrh); |
@@ -1488,8 +1505,8 @@ handle_verify (void *cls, const struct VerifyMessage *v_msg) | |||
1488 | { | 1505 | { |
1489 | del_entry = GNUNET_new (struct DelegateRecordEntry); | 1506 | del_entry = GNUNET_new (struct DelegateRecordEntry); |
1490 | del_entry->delegate = | 1507 | del_entry->delegate = |
1491 | GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + | 1508 | GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) |
1492 | delegates[i].issuer_attribute_len + 1); | 1509 | + delegates[i].issuer_attribute_len + 1); |
1493 | GNUNET_memcpy (del_entry->delegate, | 1510 | GNUNET_memcpy (del_entry->delegate, |
1494 | &delegates[i], | 1511 | &delegates[i], |
1495 | sizeof (struct GNUNET_ABD_Delegate)); | 1512 | sizeof (struct GNUNET_ABD_Delegate)); |
@@ -1509,7 +1526,7 @@ handle_verify (void *cls, const struct VerifyMessage *v_msg) | |||
1509 | if (GNUNET_ABD_FLAG_BACKWARD & vrh->resolution_algo && | 1526 | if (GNUNET_ABD_FLAG_BACKWARD & vrh->resolution_algo && |
1510 | GNUNET_ABD_FLAG_FORWARD & vrh->resolution_algo) | 1527 | GNUNET_ABD_FLAG_FORWARD & vrh->resolution_algo) |
1511 | { | 1528 | { |
1512 | if(1 == delegation_chain_fw_resolution_start (vrh)) | 1529 | if (1 == delegation_chain_fw_resolution_start (vrh)) |
1513 | return; | 1530 | return; |
1514 | delegation_chain_bw_resolution_start (vrh); | 1531 | delegation_chain_bw_resolution_start (vrh); |
1515 | } | 1532 | } |
@@ -1523,6 +1540,7 @@ handle_verify (void *cls, const struct VerifyMessage *v_msg) | |||
1523 | } | 1540 | } |
1524 | } | 1541 | } |
1525 | 1542 | ||
1543 | |||
1526 | static void | 1544 | static void |
1527 | handle_delegate_collection_error_cb (void *cls) | 1545 | handle_delegate_collection_error_cb (void *cls) |
1528 | { | 1546 | { |
@@ -1533,6 +1551,7 @@ handle_delegate_collection_error_cb (void *cls) | |||
1533 | send_lookup_response (vrh); | 1551 | send_lookup_response (vrh); |
1534 | } | 1552 | } |
1535 | 1553 | ||
1554 | |||
1536 | static void | 1555 | static void |
1537 | delegate_collection_finished (void *cls) | 1556 | delegate_collection_finished (void *cls) |
1538 | { | 1557 | { |
@@ -1544,7 +1563,7 @@ delegate_collection_finished (void *cls) | |||
1544 | GNUNET_ABD_FLAG_FORWARD & vrh->resolution_algo) | 1563 | GNUNET_ABD_FLAG_FORWARD & vrh->resolution_algo) |
1545 | { | 1564 | { |
1546 | // if premature match found don't start bw resultion | 1565 | // if premature match found don't start bw resultion |
1547 | if(1 == delegation_chain_fw_resolution_start (vrh)) | 1566 | if (1 == delegation_chain_fw_resolution_start (vrh)) |
1548 | return; | 1567 | return; |
1549 | delegation_chain_bw_resolution_start (vrh); | 1568 | delegation_chain_bw_resolution_start (vrh); |
1550 | } | 1569 | } |
@@ -1558,6 +1577,7 @@ delegate_collection_finished (void *cls) | |||
1558 | } | 1577 | } |
1559 | } | 1578 | } |
1560 | 1579 | ||
1580 | |||
1561 | static void | 1581 | static void |
1562 | handle_delegate_collection_cb (void *cls, | 1582 | handle_delegate_collection_cb (void *cls, |
1563 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | 1583 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, |
@@ -1599,6 +1619,7 @@ handle_delegate_collection_cb (void *cls, | |||
1599 | delegate_collection_finished (vrh); | 1619 | delegate_collection_finished (vrh); |
1600 | } | 1620 | } |
1601 | 1621 | ||
1622 | |||
1602 | static void | 1623 | static void |
1603 | handle_collect (void *cls, const struct CollectMessage *c_msg) | 1624 | handle_collect (void *cls, const struct CollectMessage *c_msg) |
1604 | { | 1625 | { |
@@ -1682,6 +1703,7 @@ check_collect (void *cls, const struct CollectMessage *c_msg) | |||
1682 | return GNUNET_OK; | 1703 | return GNUNET_OK; |
1683 | } | 1704 | } |
1684 | 1705 | ||
1706 | |||
1685 | static void | 1707 | static void |
1686 | client_disconnect_cb (void *cls, | 1708 | client_disconnect_cb (void *cls, |
1687 | struct GNUNET_SERVICE_Client *client, | 1709 | struct GNUNET_SERVICE_Client *client, |
@@ -1690,6 +1712,7 @@ client_disconnect_cb (void *cls, | |||
1690 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client); | 1712 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client); |
1691 | } | 1713 | } |
1692 | 1714 | ||
1715 | |||
1693 | static void * | 1716 | static void * |
1694 | client_connect_cb (void *cls, | 1717 | client_connect_cb (void *cls, |
1695 | struct GNUNET_SERVICE_Client *client, | 1718 | struct GNUNET_SERVICE_Client *client, |
@@ -1699,6 +1722,7 @@ client_connect_cb (void *cls, | |||
1699 | return client; | 1722 | return client; |
1700 | } | 1723 | } |
1701 | 1724 | ||
1725 | |||
1702 | /** | 1726 | /** |
1703 | * Process Credential requests. | 1727 | * Process Credential requests. |
1704 | * | 1728 | * |
diff --git a/src/abd/plugin_gnsrecord_abd.c b/src/abd/plugin_gnsrecord_abd.c index 9d8f4a79b..c7635b997 100644 --- a/src/abd/plugin_gnsrecord_abd.c +++ b/src/abd/plugin_gnsrecord_abd.c | |||
@@ -346,4 +346,5 @@ libgnunet_plugin_gnsrecord_abd_done (void *cls) | |||
346 | return NULL; | 346 | return NULL; |
347 | } | 347 | } |
348 | 348 | ||
349 | |||
349 | /* end of plugin_gnsrecord_abd.c */ | 350 | /* end of plugin_gnsrecord_abd.c */ |