added flag to only limit packets when necessary, otherwise a large keyring cannot be read

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7014 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-01-14 21:16:06 +00:00
parent 2d64e3f540
commit f7cbacdcb1
6 changed files with 14 additions and 14 deletions

View File

@ -154,7 +154,7 @@ int ops_parse_and_accumulate(ops_keyring_t *keyring,
parse_info->rinfo.accumulate=ops_true; parse_info->rinfo.accumulate=ops_true;
rtn=ops_parse(parse_info); rtn=ops_parse(parse_info,ops_false);
++keyring->nkeys; ++keyring->nkeys;
return rtn; return rtn;

View File

@ -370,7 +370,7 @@ int ops_decompress(ops_region_t *region,ops_parse_info_t *parse_info,
return 0; return 0;
} }
ret=ops_parse(parse_info); ret=ops_parse(parse_info,ops_true);
ops_reader_pop(parse_info); ops_reader_pop(parse_info);

View File

@ -368,7 +368,7 @@ ops_secret_key_t *ops_decrypt_secret_key_from_data(const ops_keydata_t *key,
ops_parse_cb_set(pinfo,decrypt_cb,&arg); ops_parse_cb_set(pinfo,decrypt_cb,&arg);
pinfo->rinfo.accumulate=ops_true; pinfo->rinfo.accumulate=ops_true;
ops_parse(pinfo); ops_parse(pinfo,ops_false);
ops_parse_info_delete(pinfo); ops_parse_info_delete(pinfo);

View File

@ -2866,7 +2866,7 @@ int ops_decrypt_se_data(ops_content_tag_t tag,ops_region_t *region, ops_parse_in
} }
r=ops_parse(pinfo); r=ops_parse(pinfo,ops_false);
ops_reader_pop_decrypt(pinfo); ops_reader_pop_decrypt(pinfo);
} }
@ -2904,7 +2904,7 @@ int ops_decrypt_se_ip_data(ops_content_tag_t tag,ops_region_t *region,
ops_reader_push_decrypt(pinfo,decrypt,region); ops_reader_push_decrypt(pinfo,decrypt,region);
ops_reader_push_se_ip_data(pinfo,decrypt,region); ops_reader_push_se_ip_data(pinfo,decrypt,region);
r=ops_parse(pinfo); r=ops_parse(pinfo,ops_false);
ops_reader_pop_se_ip_data(pinfo); ops_reader_pop_se_ip_data(pinfo);
ops_reader_pop_decrypt(pinfo); ops_reader_pop_decrypt(pinfo);
@ -3228,7 +3228,7 @@ void example()
* \endcode * \endcode
*/ */
int ops_parse(ops_parse_info_t *pinfo) int ops_parse(ops_parse_info_t *pinfo,ops_boolean_t limit_packets)
{ {
int r; int r;
unsigned long pktlen; unsigned long pktlen;
@ -3239,9 +3239,9 @@ int ops_parse(ops_parse_info_t *pinfo)
{ {
r=ops_parse_one_packet(pinfo,&pktlen); r=ops_parse_one_packet(pinfo,&pktlen);
if(++n_packets > 100) if(++n_packets > 500 && limit_packets)
{ {
fprintf(stderr,"More than 100 packets parsed in a row. This is likely to be a buggy certificate.") ; fprintf(stderr,"More than 500 packets parsed in a row. This is likely to be a buggy certificate.") ;
return 0 ; return 0 ;
} }
} while (r > 0); } while (r > 0);
@ -3261,7 +3261,7 @@ int ops_parse(ops_parse_info_t *pinfo)
int ops_parse_and_print_errors(ops_parse_info_t *pinfo) int ops_parse_and_print_errors(ops_parse_info_t *pinfo)
{ {
ops_parse(pinfo); ops_parse(pinfo,ops_false);
ops_print_errors(pinfo->errors); ops_print_errors(pinfo->errors);
return pinfo->errors ? 0 : 1; return pinfo->errors ? 0 : 1;
} }

View File

@ -125,7 +125,7 @@ ops_parse_cb_return_t ops_parse_stacked_cb(const ops_parser_content_t *content,
ops_parse_cb_info_t *cbinfo); ops_parse_cb_info_t *cbinfo);
ops_reader_info_t *ops_parse_get_rinfo(ops_parse_info_t *pinfo); ops_reader_info_t *ops_parse_get_rinfo(ops_parse_info_t *pinfo);
int ops_parse(ops_parse_info_t *parse_info); int ops_parse(ops_parse_info_t *parse_info,ops_boolean_t limit_packets);
int ops_parse_and_print_errors(ops_parse_info_t *parse_info); int ops_parse_and_print_errors(ops_parse_info_t *parse_info);
int ops_parse_and_save_errs(ops_parse_info_t *parse_info,ops_ulong_list_t *errs); int ops_parse_and_save_errs(ops_parse_info_t *parse_info,ops_ulong_list_t *errs);
int ops_parse_errs(ops_parse_info_t *parse_info,ops_ulong_list_t *errs); int ops_parse_errs(ops_parse_info_t *parse_info,ops_ulong_list_t *errs);

View File

@ -572,7 +572,7 @@ ops_boolean_t ops_validate_key_signatures(ops_validate_result_t *result,const op
// is never used. // is never used.
carg.rarg=ops_reader_get_arg_from_pinfo(pinfo); carg.rarg=ops_reader_get_arg_from_pinfo(pinfo);
ops_parse(pinfo); ops_parse(pinfo,ops_true);
ops_public_key_free(&carg.pkey); ops_public_key_free(&carg.pkey);
if(carg.subkey.version) if(carg.subkey.version)
@ -693,7 +693,7 @@ ops_boolean_t ops_validate_file(ops_validate_result_t *result, const char* filen
// Do the verification // Do the verification
ops_parse(pinfo); ops_parse(pinfo,ops_true);
if (debug) if (debug)
{ {
@ -748,7 +748,7 @@ ops_boolean_t ops_validate_mem(ops_validate_result_t *result, ops_memory_t* mem,
// Do the verification // Do the verification
ops_parse(pinfo); ops_parse(pinfo,ops_true);
if (debug) if (debug)
{ {
@ -819,7 +819,7 @@ ops_boolean_t ops_validate_detached_signature(const void *literal_data, unsigned
// Do the verification // Do the verification
ops_parse(pinfo); ops_parse(pinfo,ops_true);
if(debug) if(debug)
printf("valid=%d, invalid=%d, unknown=%d\n", result->valid_count, result->invalid_count, result->unknown_signer_count); printf("valid=%d, invalid=%d, unknown=%d\n", result->valid_count, result->invalid_count, result->unknown_signer_count);