/**
* auth.php
*
- * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* Contains functions used to do authentication.
*
- * $Id$
+ * @version $Id$
* @package squirrelmail
*/
if ( sqsession_is_registered('user_is_logged_in') ) {
return;
} else {
- global $PHP_SELF, $session_expired_post,
- $session_expired_location;
+ global $PHP_SELF, $session_expired_post,
+ $session_expired_location, $squirrelmail_language;
/* First we store some information in the new session to prevent
* information-loss.
*/
-
- $session_expired_post = $_POST;
+
+ $session_expired_post = $_POST;
$session_expired_location = $PHP_SELF;
- if (!sqsession_is_registered('session_expired_post')) {
+ if (!sqsession_is_registered('session_expired_post')) {
sqsession_register($session_expired_post,'session_expired_post');
}
if (!sqsession_is_registered('session_expired_location')) {
sqsession_register($session_expired_location,'session_expired_location');
}
include_once( SM_PATH . 'functions/display_messages.php' );
+ set_up_language($squirrelmail_language, true);
logout_error( _("You must be logged in to access this page.") );
exit;
}
*/
function digest_md5_response ($username,$password,$challenge,$service,$host) {
$result=digest_md5_parse_challenge($challenge);
-
+
// verify server supports qop=auth
// $qop = explode(",",$result['qop']);
//if (!in_array("auth",$qop)) {
/* This can be auth (authentication only), auth-int (integrity protection), or
auth-conf (confidentiality protection). Right now only auth is supported.
- DO NOT CHANGE THIS VALUE */
+ DO NOT CHANGE THIS VALUE */
$qop_value = "auth";
$digest_uri_value = $service . '/' . $host;
$reply .= ',qop=' . $qop_value;
$reply = base64_encode($reply);
return $reply . "\r\n";
-
+
}
/**
// We're in a "simple" value - explode to next comma
$val=explode(',',$challenge,2);
if (isset($val[1])) {
- $challenge=$val[1];
- } else {
- unset($challenge);
- }
+ $challenge=$val[1];
+ } else {
+ unset($challenge);
+ }
$value=$val[0];
}
$parsed["$key"]=$value;
return $hmac;
}
-?>
+/**
+ * Fillin user and password based on SMTP auth settings.
+ *
+ * @param string $user Reference to SMTP username
+ * @param string $pass Reference to SMTP password (unencrypted)
+ */
+function get_smtp_user(&$user, &$pass) {
+ global $username, $smtp_auth_mech,
+ $smtp_sitewide_user, $smtp_sitewide_pass;
+
+ if ($smtp_auth_mech == 'none') {
+ $user = '';
+ $pass = '';
+ } elseif ( isset($smtp_sitewide_user) && isset($smtp_sitewide_pass) ) {
+ $user = $smtp_sitewide_user;
+ $pass = $smtp_sitewide_pass;
+ } else {
+ global $key, $onetimepad;
+ $user = $username;
+ $pass = OneTimePadDecrypt($key, $onetimepad);
+ }
+}
+
+?>
\ No newline at end of file