X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;ds=sidebyside;f=functions%2Fauth.php;h=eafc41e9cd6337859b8f69d1172db200502fa9ed;hb=22387c8d44f3ab104db6e19180d3775a45762359;hp=47e6c04c4988467ab39aac8cac1dbc0e4d1e9359;hpb=7350889b45590aee831ba1150ee94efb95b03992;p=squirrelmail.git diff --git a/functions/auth.php b/functions/auth.php index 47e6c04c..eafc41e9 100644 --- a/functions/auth.php +++ b/functions/auth.php @@ -1,34 +1,374 @@ 64) + $key = pack("H*", md5($key)); + + $k_ipad = $key ^ str_repeat(chr(0x36), 64); + $k_opad = $key ^ str_repeat(chr(0x5c), 64); + + $hmac = hmac_md5($k_opad . pack('H*', md5($k_ipad . $data))); + + return $hmac; - set_up_language($squirrelmail_language, true); +} - displayHtmlHeader( 'SquirrelMail', '', FALSE ); +/** + * Fillin user and password based on SMTP auth settings. + * + * @param string $user Reference to SMTP username + * @param string $pass Reference to SMTP password (unencrypted) + * @since 1.4.11 + */ +function get_smtp_user(&$user, &$pass) { + global $username, $smtp_auth_mech, + $smtp_sitewide_user, $smtp_sitewide_pass; - echo "\n" . - '

'. - _("You must be logged in to access this page.").'

'. - ""._("Go to the login page")."\n". - "
\n"; - exit; + if ($smtp_auth_mech == 'none') { + $user = ''; + $pass = ''; + } elseif ( isset($smtp_sitewide_user) && isset($smtp_sitewide_pass) && + !empty($smtp_sitewide_user)) { + $user = $smtp_sitewide_user; + $pass = $smtp_sitewide_pass; + } else { + $user = $username; + $pass = sqauth_read_password(); } -?> + // plugin authors note: override $user or $pass by + // directly changing the arguments array contents + // in your plugin e.g., $args[0] = 'new_username'; + // + // NOTE: there is another hook in class/deliver/Deliver_SMTP.class.php + // called "smtp_authenticate" that allows a plugin to run its own + // custom authentication routine - this hook here is thus slightly + // mis-named but is too old to change. Be careful that you do not + // confuse your hook names. + // + $temp = array(&$user, &$pass); + do_hook('smtp_auth', $temp); +}