First off try and make sure you can sign in to yahoo servers, they have a web based version of the yahoo messenger which just uses your browser:http://messenger.yahoo.com/web
If it works here, then you know your user/pass are correct and we then need to start looking for a "Deny/Block" rule in a firewall that may have accidentally enabled.
What version of windows are you using
What model of Router are you using
Whats the model of your DSL modem? (Is your DSL modem also your Router?)