From: centaurix Date: Fri, 19 Jul 2002 22:20:17 +0000 (+0000) Subject: integrated patch 403567 (from januar 2001 !!) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;ds=sidebyside;h=bd9829d7713f10ee8cc8918bf152d156a5af9b22;p=squirrelmail.git integrated patch 403567 (from januar 2001 !!) it enables sysadmins to specify a function in $imap_server_address. This function gets the users imapserver. There is an example function map_yp_alias that gets the server from yellowpages (NIS) thanks to karenb@cc.gatech.edu. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3106 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/imap_general.php b/functions/imap_general.php index a672b574..11586a18 100755 --- a/functions/imap_general.php +++ b/functions/imap_general.php @@ -155,6 +155,8 @@ function sqimap_read_data ($imap_stream, $pre, $handle_errors, &$response, &$mes function sqimap_login ($username, $password, $imap_server_address, $imap_port, $hide) { global $color, $squirrelmail_language, $HTTP_ACCEPT_LANGUAGE, $onetimepad; + $imap_server_address = sqimap_get_user_server($imap_server_address, $username); + $imap_stream = fsockopen ( $imap_server_address, $imap_port, $error_number, $error_string, 15); if ( !$imap_stream ) { return false; @@ -396,4 +398,24 @@ function sqimap_append_done ($imap_stream) { $tmp = fgets ($imap_stream, 1024); } +function sqimap_get_user_server ($imap_server, $username) { + + if (substr($imap_server, 0, 4) != "map:") { + return $imap_server; + } + + $function = substr($imap_server, 4); + return $function($username); +} + +/* This is an example that gets imapservers from yellowpages (NIS). + * you can simple put map:map_yp_alias in your $imap_server_address + * in config.php use your own function instead map_yp_alias to map your + * LDAP whatever way to find the users imapserver. */ + +function map_yp_alias($username) { + $yp = `ypmatch $username aliases`; + return chop(substr($yp, strlen($username)+1)); +} + ?>