diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-06-30 00:06:07 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-06-30 00:06:07 +0100 |
commit | 64f8c425da20554e6909d969b8748076825ef601 (patch) | |
tree | c25d55fa650145ddf6363d4f9b069722b14faa7c | |
parent | 051372c0219f067bb4b116bd06d482420b20e3c8 (diff) |
Strip whitespace in Twitter OAuth PIN responses.
-rw-r--r-- | protocols/twitter/twitter.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index ca57e51e..2e3ab634 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -268,7 +268,14 @@ static int twitter_buddy_msg( struct im_connection *ic, char *who, char *message if( set_getbool( &ic->acc->set, "oauth" ) && td->oauth_info && td->oauth_info->token == NULL ) { - if( !oauth_access_token( message, td->oauth_info ) ) + char pin[strlen(message)+1], *s; + + strcpy( pin, message ); + for( s = pin + sizeof( pin ) - 2; s > pin && isspace( *s ); s -- ) + *s = '\0'; + for( s = pin; *s && isspace( *s ); s ++ ) {} + + if( !oauth_access_token( s, td->oauth_info ) ) { imcb_error( ic, "OAuth error: %s", "Failed to send access token request" ); imc_logout( ic, TRUE ); |