diff options
author | Sven Moritz Hallberg <sm@khjk.org> | 2008-02-16 18:15:31 +0100 |
---|---|---|
committer | Sven Moritz Hallberg <sm@khjk.org> | 2008-02-16 18:15:31 +0100 |
commit | 4eb4c0f4beeb87e07bd6b10daed8fe8e48fb4206 (patch) | |
tree | a54ec7b6b4622aa35ef7bd1efc58ab8ec45749ae /protocols/jabber/sasl.c | |
parent | 896195002cc903ec4b1ef7e1468f73c1dc08df9e (diff) | |
parent | ca605509d0b49e6012d10ae5d1553ced007e6ce7 (diff) |
merge in upstream changes
Diffstat (limited to 'protocols/jabber/sasl.c')
-rw-r--r-- | protocols/jabber/sasl.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/protocols/jabber/sasl.c b/protocols/jabber/sasl.c index 87059051..53248ef3 100644 --- a/protocols/jabber/sasl.c +++ b/protocols/jabber/sasl.c @@ -21,6 +21,8 @@ * * \***************************************************************************/ +#include <ctype.h> + #include "jabber.h" #include "base64.h" @@ -106,12 +108,17 @@ xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data ) return XT_HANDLED; } -static char *sasl_get_part( char *data, char *field ) +/* Non-static function, but not mentioned in jabber.h because it's for internal + use, just that the unittest should be able to reach it... */ +char *sasl_get_part( char *data, char *field ) { int i, len; len = strlen( field ); + while( isspace( *data ) || *data == ',' ) + data ++; + if( g_strncasecmp( data, field, len ) == 0 && data[len] == '=' ) { i = strlen( field ) + 1; @@ -128,13 +135,19 @@ static char *sasl_get_part( char *data, char *field ) i ++; } - /* If we got a comma, we got a new field. Check it. */ - if( data[i] == ',' && - g_strncasecmp( data + i + 1, field, len ) == 0 && - data[i+len+1] == '=' ) + /* If we got a comma, we got a new field. Check it, + find the next key after it. */ + if( data[i] == ',' ) { - i += len + 2; - break; + while( isspace( data[i] ) || data[i] == ',' ) + i ++; + + if( g_strncasecmp( data + i, field, len ) == 0 && + data[i+len] == '=' ) + { + i += len + 1; + break; + } } } } |