RoundCube Webmail Forum  

Go Back   RoundCube Webmail Forum > Miscellaneous > Roundcube Discussion

For more information about the ads and why they're here, please see the FAQ
Reply
  #1  
Old 07-22-2006, 01:10 AM
Registered User
 
Join Date: Jul 2006
Posts: 3
Downloads: 0
Uploads: 0
Default Is this safe?

I have more than one site on different servers, and I want to do 1 installation instead of having multiple ones.
So in main.inc.php, I changed:
Code:
// the mail host chosen to perform the log-in
// leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
// To use SSL connection, enter ssl://hostname:993
$rcmail_config['default_host'] = 'mail.mydomain.com';
to:
Code:
// the mail host chosen to perform the log-in
// leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
// To use SSL connection, enter ssl://hostname:993
if((isset($_SESSION['username'])&&$_SESSION['username']!="")||(isset($_POST['_user'])&&$_POST['_user']!="")){
	$email_parts = $_SESSION['username'] ? explode("@",$_SESSION['username']) : explode("@",$_POST['_user']);
	$rcmail_config['default_host'] = 'mail.'.$email_parts[1];
	
}else{
	$rcmail_config['default_host'] = 'mail.mydomain.com';
}
Is this dangerous?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 07-22-2006, 04:44 AM
bpat1434's Avatar
Administrator
 
Join Date: Jun 2006
Location: Maryland, USA
Posts: 599
Downloads: 17
Uploads: 0
Send a message via ICQ to bpat1434 Send a message via AIM to bpat1434 Send a message via MSN to bpat1434 Send a message via Yahoo to bpat1434 Send a message via Skype™ to bpat1434
Default Re: Is this safe?

Not really.... although nothing is really not dangerous.

A hacker could find a way to use this against you, but the odds of someone exploiting it are slim. Plus, it would most likely just give you a parse error if something was awry. So one thing they could get is possibly the path to your server. Unless error reporting (in PHP) is turned down, an error will show up.

So really, the question should be: If my server is secure, will this code pose any threat?
And the answer to that question is most likely not. If your server is properly secured, there's not a whole not a hacker can do.
__________________

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 08-05-2006, 03:42 AM
Registered User
 
Join Date: Jul 2006
Posts: 49
Downloads: 0
Uploads: 0
Default Re: Is this safe?

Since you know the server possibilities, you should compare $email_parts[1] to the known list of servers. That would avoid any potential issues. Just set up an array of valid domains, then see if $email_parts[1] is in the array (a simple in_array() one liner). If not, then you could just issue a header() to return to the login or do what ever you want. That would also be more user friendly in the event of typos (the way you have it you will get a connection failure).

EDIT >> or just use the config file
$rcmail_config['username_domain'] = array( . . .
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

For more information about the ads and why they're here, please see the FAQ

All times are GMT. The time now is 11:50 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright © 2006-2008 RoundCube Webmail Community