Changeset af97b23 for protocols


Ignore:
Timestamp:
2008-02-16T13:17:52Z (16 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
ca60550
Parents:
2799ff9
Message:

Improved sasl_get_part() to deal with whitespace in challenge strings, as
described in RFC 2831 secion 7.1 (the #rule description). Closes bug #362.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/sasl.c

    r2799ff9 raf97b23  
    2121*                                                                           *
    2222\***************************************************************************/
     23
     24#include <ctype.h>
    2325
    2426#include "jabber.h"
     
    107109}
    108110
    109 static char *sasl_get_part( char *data, char *field )
     111/* Non-static function, but not mentioned in jabber.h because it's for internal
     112   use, just that the unittest should be able to reach it... */
     113char *sasl_get_part( char *data, char *field )
    110114{
    111115        int i, len;
    112116       
    113117        len = strlen( field );
     118       
     119        while( isspace( *data ) || *data == ',' )
     120                data ++;
    114121       
    115122        if( g_strncasecmp( data, field, len ) == 0 && data[len] == '=' )
     
    129136                        }
    130137                       
    131                         /* If we got a comma, we got a new field. Check it. */
    132                         if( data[i] == ',' &&
    133                             g_strncasecmp( data + i + 1, field, len ) == 0 &&
    134                             data[i+len+1] == '=' )
     138                        /* If we got a comma, we got a new field. Check it,
     139                           find the next key after it. */
     140                        if( data[i] == ',' )
    135141                        {
    136                                 i += len + 2;
    137                                 break;
     142                                while( isspace( data[i] ) || data[i] == ',' )
     143                                        i ++;
     144                               
     145                                if( g_strncasecmp( data + i, field, len ) == 0 &&
     146                                    data[i+len] == '=' )
     147                                {
     148                                        i += len + 1;
     149                                        break;
     150                                }
    138151                        }
    139152                }
Note: See TracChangeset for help on using the changeset viewer.