Untrimmed Yahoo messenger email address creates malformed API call

toemaz - June 10, 2008 - 19:04
Project:Onlinestatus Indicator
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Description

In case the email address submitted in the Yahoo! messenger field is not trimmed, i.e. starts or ends with a space, Yahoo will return a 400 Bad Request.

Sorry, Bad Request.
Your browser sent a request that this server could not understand.

The request line contained invalid characters following the protocol string.

Please check the URL for proper spelling and capitalization. If you\'re having trouble locating a destination on Yahoo!, try visiting the Yahoo! home page or look through a list of Yahoo!\'s online services. Also, you may find what you\'re looking for if you try searching below.

Reproduce: submit an email address with a trailing space which will form the following bad request: GET /online?u=mail@provider.com &m=t

Solution: the validation procedure for the onlinestatus_messenger_aim functions has to be revised:

<?php
   
case 'validate' :
      if (
preg_match('/^([a-zA-Z][a-zA-Z0-9]{3,16}(@mac\.com)?)$/', $account)) {
        return
true;
      }
      else {
        return
false;
      }
?>

 
 

Drupal is a registered trademark of Dries Buytaert.