Changeset 327

Show
Ignore:
Timestamp:
01/05/06 13:57:53
Author:
ben
Message:

Optionally allow trailing whitespace where we don't strictly expect it.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openpgpsdk/trunk/examples/packet-dump.c

    r326 r327  
    907907 
    908908    if(armour) 
    909         ops_reader_push_dearmour(pinfo,ops_true,ops_true); 
     909        ops_reader_push_dearmour(pinfo,ops_true,ops_true,ops_true); 
    910910 
    911911    ret=ops_parse(pinfo); 
  • openpgpsdk/trunk/examples/verify2.c

    r320 r327  
    187187 
    188188    if(armour) 
    189         ops_reader_push_dearmour(pinfo,ops_false,ops_false); 
     189        ops_reader_push_dearmour(pinfo,ops_false,ops_false,ops_false); 
    190190 
    191191    ops_parse(pinfo); 
  • openpgpsdk/trunk/include/openpgpsdk/armour.h

    r320 r327  
    33 
    44void ops_reader_push_dearmour(ops_parse_info_t *parse_info, 
    5                               ops_boolean_t without_gap,ops_boolean_t no_gap); 
     5                              ops_boolean_t without_gap, 
     6                              ops_boolean_t no_gap, 
     7                              ops_boolean_t trailing_whitespace); 
    68 
    79void ops_reader_pop_dearmour(ops_parse_info_t *parse_info); 
  • openpgpsdk/trunk/src/armour.c

    r320 r327  
    3131    ops_boolean_t allow_no_gap:1; /*!< allow no blank line at the 
    3232                                       start of armoured data */ 
     33    ops_boolean_t allow_trailing_whitespace:1; /*!< allow armoured 
     34                                                 stuff to have 
     35                                                 trailing whitespace 
     36                                                 where we wouldn't 
     37                                                 strictly expect it */ 
    3338 
    3439    // base64 stuff 
     
    452457            ERR(cbinfo,"Error in checksum"); 
    453458        c=read_char(arg,errors,rinfo,cbinfo,ops_true); 
     459        if(arg->allow_trailing_whitespace) 
     460            while(c == ' ' || c == '\t') 
     461                c=read_char(arg,errors,rinfo,cbinfo,ops_true); 
    454462        if(c != '\n') 
    455463            ERR(cbinfo,"Badly terminated checksum"); 
     
    572580             if((c=unarmoured_read_char(arg,errors,rinfo,cbinfo,ops_true)) < 0) 
    573581                 return OPS_R_EOF; 
     582             if(arg->allow_trailing_whitespace) 
     583                 while(c == ' ' || c == '\t') 
     584                     if((c=unarmoured_read_char(arg,errors,rinfo,cbinfo, 
     585                                                ops_true)) < 0) 
     586                         return OPS_R_EOF; 
    574587             if(c != '\n') 
    575588                 /* wasn't a header line after all */ 
     
    698711 
    699712void ops_reader_push_dearmour(ops_parse_info_t *parse_info, 
    700                               ops_boolean_t without_gap,ops_boolean_t no_gap) 
     713                              ops_boolean_t without_gap, 
     714                              ops_boolean_t no_gap, 
     715                              ops_boolean_t trailing_whitespace) 
    701716    { 
    702717    dearmour_arg_t *arg; 
     
    706721    arg->allow_headers_without_gap=without_gap; 
    707722    arg->allow_no_gap=no_gap; 
     723    arg->allow_trailing_whitespace=trailing_whitespace; 
    708724 
    709725    ops_reader_push(parse_info,armoured_data_reader,arg);