+
+
= user_count_level( ADMINISTRATOR ) ) ) ) { ?>
@@ -132,11 +153,13 @@
Index: manage_user_update.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/manage_user_update.php,v
retrieving revision 1.38
diff -u -r1.38 manage_user_update.php
--- manage_user_update.php 26 Mar 2006 10:35:33 -0000 1.38
+++ manage_user_update.php 4 Oct 2006 10:08:55 -0000
@@ -24,6 +24,7 @@
$f_email = gpc_get_string( 'email', '' );
$f_username = gpc_get_string( 'username', '' );
$f_realname = gpc_get_string( 'realname', '' );
+ $f_login_method = gpc_get_string( 'login_method', '' );
$f_access_level = gpc_get_int( 'access_level' );
$f_user_id = gpc_get_int( 'user_id' );
@@ -49,6 +50,7 @@
$c_enabled = db_prepare_bool( $f_enabled );
$c_user_id = db_prepare_int( $f_user_id );
$c_access_level = db_prepare_int( $f_access_level );
+ $c_login_method = db_prepare_int( $f_login_method );
$t_user_table = config_get( 'mantis_user_table' );
@@ -67,7 +69,7 @@
}
# if the user is already protected and the admin is not removing the
- # protected flag then don't update the access level and enabled flag.
+ # protected flag then don't update the access level, login_method and enabled flag.
# If the user was unprotected or the protected flag is being turned off
# then proceed with a full update.
if ( $f_protected && $t_old_protected ) {
@@ -77,7 +79,7 @@
WHERE id='$c_user_id'";
} else {
$query = "UPDATE $t_user_table
- SET username='$c_username', email='$c_email',
+ SET username='$c_username', email='$c_email', login_method='$c_login_method',
access_level='$c_access_level', enabled='$c_enabled',
protected='$c_protected', realname='$c_realname'
WHERE id='$c_user_id'";
Index: admin/schema.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/admin/schema.php,v
retrieving revision 1.11
diff -u -r1.11 schema.php
--- admin/schema.php 14 Aug 2006 08:32:57 -0000 1.11
+++ admin/schema.php 4 Oct 2006 08:46:28 -0000
@@ -303,7 +303,8 @@
login_count I NOTNULL DEFAULT '0',
lost_password_request_count I2 NOTNULL DEFAULT '0',
failed_login_count I2 NOTNULL DEFAULT '0',
- cookie_string C(64) NOTNULL DEFAULT \" '' \"
+ cookie_string C(64) NOTNULL DEFAULT \" '' \",
+ login_method I2 NOTNULL DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_user_cookie_string',config_get('mantis_user_table'),'cookie_string',Array('UNIQUE')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_user_username',config_get('mantis_user_table'),'username',Array('UNIQUE')));
@@ -325,4 +326,4 @@
body XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_email_id',config_get('mantis_email_table'),'email_id'));
-?>
\ No newline at end of file
+?>
Index: core/authentication_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/authentication_api.php,v
retrieving revision 1.55
diff -u -r1.55 authentication_api.php
--- core/authentication_api.php 23 Apr 2006 12:32:59 -0000 1.55
+++ core/authentication_api.php 4 Oct 2006 09:33:30 -0000
@@ -74,7 +74,7 @@
function auth_attempt_login( $p_username, $p_password, $p_perm_login=false ) {
$t_user_id = user_get_id_by_name( $p_username );
- $t_login_method = config_get( 'login_method' );
+ $t_login_method = user_get_field($t_user_id, 'login_method');
if ( false === $t_user_id ) {
if ( BASIC_AUTH == $t_login_method ) {
@@ -118,7 +118,7 @@
if ( !( ( ON == $t_anon_allowed ) && ( $t_anon_account == $p_username) ) ) {
# anonymous login didn't work, so check the password
- if ( !auth_does_password_match( $t_user_id, $p_password ) ) {
+ if ( !auth_does_password_match( $t_user_id, $p_password ) ) {
user_increment_failed_login_count( $t_user_id );
return false;
}
@@ -201,22 +201,25 @@
# Return true if the password for the user id given matches the given
# password (taking into account the global login method)
function auth_does_password_match( $p_user_id, $p_test_password ) {
- $t_configured_login_method = config_get( 'login_method' );
-
- if ( LDAP == $t_configured_login_method ) {
- return ldap_authenticate( $p_user_id, $p_test_password );
- }
+ $t_user_login_method = user_get_field( $p_user_id, 'login_method' );
+ switch ($t_user_login_method)
+ {
+ case ADS: return ads_authenticate( $p_user_id, $p_test_password ); break;
+ case LDAP: return ldap_authenticate( $p_user_id, $p_test_password ); break;
+ default: break;
+ }
+
$t_password = user_get_field( $p_user_id, 'password' );
$t_login_methods = Array(MD5, CRYPT, PLAIN);
foreach ( $t_login_methods as $t_login_method ) {
# pass the stored password in as the salt
- if ( auth_process_plain_password( $p_test_password, $t_password, $t_login_method ) == $t_password ) {
+ if ( auth_process_plain_password( $p_test_password, $t_login_method, $t_password) == $t_password ) {
# Check for migration to another login method and test whether the password was encrypted
# with our previously insecure implemention of the CRYPT method
- if ( ( $t_login_method != $t_configured_login_method ) ||
- ( ( CRYPT == $t_configured_login_method ) && substr( $t_password, 0, 2 ) == substr( $p_test_password, 0, 2 ) ) ) {
+ if ( ( $t_login_method != $t_user_login_method ) ||
+ ( ( CRYPT == $t_user_login_method ) && substr( $t_password, 0, 2 ) == substr( $p_test_password, 0, 2 ) ) ) {
user_set_password( $p_user_id, $p_test_password, true );
}
@@ -235,13 +238,9 @@
# When encrypting a password to compare to a stored password, the stored
# password should be passed in as salt. If the auth method is CRYPT then
# crypt() will extract the appropriate portion of the stored password as its salt
- function auth_process_plain_password( $p_password, $p_salt=null, $p_method=null ) {
- $t_login_method = config_get( 'login_method' );
- if ( $p_method !== null ) {
- $t_login_method = $p_method;
- }
+ function auth_process_plain_password( $p_password, $p_login_method, $p_salt=null ) {
- switch ( $t_login_method ) {
+ switch ( $p_login_method ) {
case CRYPT:
# a null salt is the same as no salt, which causes a salt to be generated
# otherwise, use the salt given
Index: core/constant_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/constant_inc.php,v
retrieving revision 1.58
diff -u -r1.58 constant_inc.php
--- core/constant_inc.php 12 Aug 2006 08:04:13 -0000 1.58
+++ core/constant_inc.php 22 Sep 2006 12:46:27 -0000
@@ -103,8 +103,9 @@
define( 'LDAP', 4 );
define( 'BASIC_AUTH', 5 );
define( 'HTTP_AUTH', 6 );
-
- # file upload methods
+ define( 'ADS', 7 );
+
+ # file upload methods
define( 'DISK', 1 );
define( 'DATABASE', 2 );
define( 'FTP', 3 );
@@ -286,6 +287,9 @@
define( 'ERROR_SIGNUP_NOT_MATCHING_CAPTCHA', 1904 );
define( 'ERROR_LOST_PASSWORD_MAX_IN_PROGRESS_ATTEMPTS_REACHED', 1905 );
+ # ERROR_ADS_*
+ define( 'ERROR_ADS_SERVER_CONNECT_FAILED', 2000 );
+
# ERROR_FILTER_NOT_FOUND
define( 'ERROR_FILTER_NOT_FOUND', 2000 );
define( 'ERROR_FILTER_TOO_OLD', 2001 );
Index: core/custom_function_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/custom_function_api.php,v
retrieving revision 1.27
diff -u -r1.27 custom_function_api.php
--- core/custom_function_api.php 18 May 2006 05:53:44 -0000 1.27
+++ core/custom_function_api.php 22 Sep 2006 09:31:40 -0000
@@ -128,9 +128,9 @@
# --------------------
# Hook for authentication
# can Mantis update the password
- function custom_function_default_auth_can_change_password( ) {
+ function custom_function_default_auth_can_change_password( $p_login_method ) {
$t_can_change = array( PLAIN, CRYPT, CRYPT_FULL_SALT, MD5 );
- if ( in_array( config_get( 'login_method' ), $t_can_change ) ) {
+ if ( in_array( $p_login_method, $t_can_change ) ) {
return true;
} else {
return false;
@@ -347,4 +347,4 @@
# html_api.php. For each button, this function needs to generate the enclosing '
' and ' | '.
function custom_function_default_print_bug_view_page_custom_buttons( $p_bug_id ) {
}
-?>
\ No newline at end of file
+?>
Index: core/ldap_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/ldap_api.php,v
retrieving revision 1.19
diff -u -r1.19 ldap_api.php
--- core/ldap_api.php 22 Apr 2006 01:52:14 -0000 1.19
+++ core/ldap_api.php 4 Oct 2006 08:26:42 -0000
@@ -153,4 +153,5 @@
# --------------------
# Change the user's password in the LDAP Directory
+
?>
Index: core/user_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/user_api.php,v
retrieving revision 1.107
diff -u -r1.107 user_api.php
--- core/user_api.php 29 Oct 2005 09:52:52 -0000 1.107
+++ core/user_api.php 22 Sep 2006 13:01:37 -0000
@@ -13,6 +13,7 @@
require_once( $t_core_dir . 'email_api.php' );
require_once( $t_core_dir . 'ldap_api.php' );
+ require_once( $t_core_dir . 'ads_api.php' );
### User API ###
@@ -326,17 +327,18 @@
# --------------------
# Create a user.
# returns false if error, the generated cookie string if ok
- function user_create( $p_username, $p_password, $p_email='', $p_access_level=null, $p_protected=false, $p_enabled=true, $p_realname='' ) {
+ function user_create( $p_username, $p_password, $p_email='', $p_login_method=MD5, $p_access_level=null, $p_protected=false, $p_enabled=true, $p_realname='' ) {
if ( null === $p_access_level ) {
$p_access_level = config_get( 'default_new_account_access_level');
}
- $t_password = auth_process_plain_password( $p_password );
+ $t_password = auth_process_plain_password( $p_password, 'MD5' );
$c_username = db_prepare_string( $p_username );
$c_realname = db_prepare_string( $p_realname );
$c_password = db_prepare_string( $t_password );
$c_email = db_prepare_string( $p_email );
+ $c_login_method = db_prepare_int( $p_login_method );
$c_access_level = db_prepare_int( $p_access_level );
$c_protected = db_prepare_bool( $p_protected );
$c_enabled = db_prepare_bool( $p_enabled );
@@ -352,10 +354,10 @@
$query = "INSERT INTO $t_user_table
( username, email, password, date_created, last_visit,
- enabled, access_level, login_count, cookie_string, realname )
+ enabled, access_level, login_count, cookie_string, realname, login_method )
VALUES
( '$c_username', '$c_email', '$c_password', " . db_now() . "," . db_now() . ",
- $c_enabled, $c_access_level, 0, '$t_cookie_string', '$c_realname')";
+ $c_enabled, $c_access_level, 0, '$t_cookie_string', '$c_realname', '$c_login_method')";
db_query( $query );
# Create preferences for the user
@@ -1054,12 +1056,13 @@
# Set the user's password to the given string, encoded as appropriate
function user_set_password( $p_user_id, $p_password, $p_allow_protected=false ) {
$c_user_id = db_prepare_int( $p_user_id );
+ $t_user_login_method = user_get_field( $p_user_id, 'login_method' );
if ( !$p_allow_protected ) {
user_ensure_unprotected( $p_user_id );
}
- $t_password = auth_process_plain_password( $p_password );
+ $t_password = auth_process_plain_password( $p_password, $t_user_login_method );
$t_user_table = config_get( 'mantis_user_table' );
$query = "UPDATE $t_user_table
SET password='$t_password'
@@ -1120,8 +1123,9 @@
if ( ( ON == config_get( 'send_reset_password' ) ) && ( ON == config_get( 'enable_email_notification' ) ) ) {
# Create random password
$t_email = user_get_field( $p_user_id, 'email' );
+ $t_user_login_method = user_get_field ( $p_user_id, 'login_method' );
$t_password = auth_generate_random_password( $t_email );
- $t_password2 = auth_process_plain_password( $t_password );
+ $t_password2 = auth_process_plain_password( $t_password, $t_user_login_method );
user_set_field( $p_user_id, 'password', $t_password2 );
@@ -1132,7 +1136,8 @@
}
} else {
# use blank password, no emailing
- $t_password = auth_process_plain_password( '' );
+ $t_user_login_method = user_get_field( $p_user_id, 'login_method' );
+ $t_password = auth_process_plain_password( '', $t_user_login_method );
user_set_field( $p_user_id, 'password', $t_password );
# reset the failed login count because in this mode there is no emailing
user_reset_failed_login_count_to_zero( $p_user_id );
Index: lang/strings_dutch.txt
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_dutch.txt,v
retrieving revision 1.108
diff -u -r1.108 strings_dutch.txt
--- lang/strings_dutch.txt 25 Sep 2006 05:16:48 -0000 1.108
+++ lang/strings_dutch.txt 5 Oct 2006 09:10:27 -0000
@@ -384,6 +384,7 @@
$s_update_user_button = 'Gebruiker aanpassen';
$s_verify_warning = 'Uw account is gecontroleerd. Het accountbevestigingsbericht dat u heeft ontvangen is niet langer bruikbaar.';
$s_verify_change_password = 'Hier dient een wachtwoord ingegeven te worden om opnieuw te kunnen aanmelden.';
+$s_login_method = 'Aanmeldings-methode';
# account_prefs_page.php
$s_default_account_preferences_title = 'Standaard accountinstellingen';
Index: lang/strings_english.txt
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_english.txt,v
retrieving revision 1.281
diff -u -r1.281 strings_english.txt
--- lang/strings_english.txt 1 Oct 2006 09:04:57 -0000 1.281
+++ lang/strings_english.txt 5 Oct 2006 09:10:28 -0000
@@ -262,6 +262,7 @@
$MANTIS_ERROR[ERROR_PROJECT_RECURSIVE_HIERARCHY] = 'That operation would create a loop in the subproject hierarchy.';
$MANTIS_ERROR[ERROR_USER_CHANGE_LAST_ADMIN] = 'You cannot change the access level of the only ADMINISTRATOR in the system.';
$MANTIS_ERROR[ERROR_PAGE_REDIRECTION] = 'Page redirection error, ensure that there are no spaces outside the PHP block (<?php ?>) in config_inc.php or custom_*.php files.';
+$MANTIS_ERROR[ERROR_ADS_SERVER_CONNECT_FAILED] = 'ADS Server Connection Failed';
$s_login_error = 'Your account may be disabled or blocked or the username/password you entered is incorrect.';
$s_login_cookies_disabled = 'Your browser either doesn\'t know how to handle cookies, or refuses to handle them.';
@@ -380,6 +381,7 @@
$s_update_user_button = 'Update User';
$s_verify_warning = 'Your account information has been verified. The account confirmation message you have received is now invalid.';
$s_verify_change_password = 'You must set a password here to allow you to log in again.';
+$s_login_method = 'Authentication method';
# account_prefs_page.php
$s_default_account_preferences_title = 'Account Preferences';
Index: lang/strings_german.txt
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_german.txt,v
retrieving revision 1.146
diff -u -r1.146 strings_german.txt
--- lang/strings_german.txt 25 Sep 2006 11:23:30 -0000 1.146
+++ lang/strings_german.txt 5 Oct 2006 09:10:29 -0000
@@ -266,7 +266,11 @@
$MANTIS_ERROR[ERROR_LOST_PASSWORD_MAX_IN_PROGRESS_ATTEMPTS_REACHED] = 'Max. Anzahl der in Bearbeitung befindlichen Anfragen erreicht. Bitte setzen Sie sich mit Ihrem Systemadministrator in Verbindung.';
$MANTIS_ERROR[ERROR_PROJECT_RECURSIVE_HIERARCHY] = 'Diese Operation würde eine Schleife in der Unterprojekthierarchie erzeugen.';
$MANTIS_ERROR[ERROR_USER_CHANGE_LAST_ADMIN] = 'Sie können die Zugangsrechte des einzigen System-ADMINISTRATORS nicht ändern.';
+<<<<<<< strings_german.txt
+$MANTIS_ERROR[ERROR_ADS_SERVER_CONNECT_FAILED] = 'Verbindung zum ADS Server fehlgeschlagen';
+=======
$MANTIS_ERROR[ERROR_PAGE_REDIRECTION] = 'Page redirection error, ensure that there are no spaces outside the PHP block (<?php ?>) in config_inc.php or custom_*.php files.';
+>>>>>>> 1.146
$s_login_error = 'Ihr Konto ist deaktiviert oder gesperrt (aufgrund von zu vielen fehlgeschlagenen Anmeldeversuchen) oder der eigegebene Benutzer/Password ist falsch.';
$s_login_cookies_disabled = 'Ihr Web-Browser akzeptiert keine Cookies.';
@@ -385,6 +389,7 @@
$s_update_user_button = 'Benutzer aktualisieren';
$s_verify_warning = 'Ihre Kontoinformationen wurden überprüft. Die von Ihnen erhaltene Konto Bestätigungsmeldung ist jetzt ungültig.';
$s_verify_change_password = 'Sie müssen hier ein Paßwort vergeben, um sich wieder anmelden zu können.';
+$s_login_method = 'Authentifizierungs-Methode';
# account_prefs_page.php
$s_default_account_preferences_title = 'Kontoeinstellungen';