? .DS_Store ? remove_drupal_is_denied.patch ? sites/all/modules ? sites/default/files ? sites/default/settings.php Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.206 diff -u -p -r1.206 bootstrap.inc --- includes/bootstrap.inc 10 Jan 2008 22:47:17 -0000 1.206 +++ includes/bootstrap.inc 18 Mar 2008 22:43:30 -0000 @@ -66,36 +66,31 @@ define('DRUPAL_BOOTSTRAP_EARLY_PAGE_CACH define('DRUPAL_BOOTSTRAP_DATABASE', 2); /** - * Fourth bootstrap phase: identify and reject banned hosts. + * Fourth bootstrap phase: initialize session handling. */ -define('DRUPAL_BOOTSTRAP_ACCESS', 3); +define('DRUPAL_BOOTSTRAP_SESSION', 3); /** - * Fifth bootstrap phase: initialize session handling. - */ -define('DRUPAL_BOOTSTRAP_SESSION', 4); - -/** - * Sixth bootstrap phase: load bootstrap.inc and module.inc, start + * Fifth bootstrap phase: load bootstrap.inc and module.inc, start * the variable system and try to serve a page from the cache. */ -define('DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE', 5); +define('DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE', 4); /** - * Seventh bootstrap phase: find out language of the page. + * Sixth bootstrap phase: find out language of the page. */ -define('DRUPAL_BOOTSTRAP_LANGUAGE', 6); +define('DRUPAL_BOOTSTRAP_LANGUAGE', 5); /** - * Eighth bootstrap phase: set $_GET['q'] to Drupal path of request. + * Seventh bootstrap phase: set $_GET['q'] to Drupal path of request. */ -define('DRUPAL_BOOTSTRAP_PATH', 7); +define('DRUPAL_BOOTSTRAP_PATH', 6); /** * Final bootstrap phase: Drupal is fully loaded; validate and fix * input data. */ -define('DRUPAL_BOOTSTRAP_FULL', 8); +define('DRUPAL_BOOTSTRAP_FULL', 7); /** * Role ID for anonymous users; should match what's in the "role" table. @@ -847,34 +842,6 @@ function drupal_get_messages($type = NUL } /** - * Perform an access check for a given mask and rule type. Rules are usually - * created via admin/user/rules page. - * - * If any allow rule matches, access is allowed. Otherwise, if any deny rule - * matches, access is denied. If no rule matches, access is allowed. - * - * @param $type string - * Type of access to check: Allowed values are: - * - 'host': host name or IP address - * - 'mail': e-mail address - * - 'user': username - * @param $mask string - * String or mask to test: '_' matches any character, '%' matches any - * number of characters. - * @return bool - * TRUE if access is denied, FALSE if access is allowed. - */ -function drupal_is_denied($type, $mask) { - // Because this function is called for every page request, both cached - // and non-cached pages, we tried to optimize it as much as possible. - // We deny access if the only matching records in the {access} table have - // status 0 (deny). If any have status 1 (allow), or if there are no - // matching records, we allow access. - $sql = "SELECT 1 FROM {access} WHERE type = '%s' AND LOWER('%s') LIKE LOWER(mask) AND status = %d"; - return db_result(db_query_range($sql, $type, $mask, 0, 0, 1)) && !db_result(db_query_range($sql, $type, $mask, 1, 0, 1)); -} - -/** * Generates a default anonymous $user object. * * @return Object - the user object. @@ -902,7 +869,6 @@ function drupal_anonymous_user($session * DRUPAL_BOOTSTRAP_CONFIGURATION: initialize configuration. * DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE: try to call a non-database cache fetch routine. * DRUPAL_BOOTSTRAP_DATABASE: initialize database layer. - * DRUPAL_BOOTSTRAP_ACCESS: identify and reject banned hosts. * DRUPAL_BOOTSTRAP_SESSION: initialize session handling. * DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE: load bootstrap.inc and module.inc, start * the variable system and try to serve a page from the cache. @@ -911,7 +877,7 @@ function drupal_anonymous_user($session * DRUPAL_BOOTSTRAP_FULL: Drupal is fully loaded, validate and fix input data. */ function drupal_bootstrap($phase) { - static $phases = array(DRUPAL_BOOTSTRAP_CONFIGURATION, DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE, DRUPAL_BOOTSTRAP_DATABASE, DRUPAL_BOOTSTRAP_ACCESS, DRUPAL_BOOTSTRAP_SESSION, DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE, DRUPAL_BOOTSTRAP_LANGUAGE, DRUPAL_BOOTSTRAP_PATH, DRUPAL_BOOTSTRAP_FULL), $phase_index = 0; + static $phases = array(DRUPAL_BOOTSTRAP_CONFIGURATION, DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE, DRUPAL_BOOTSTRAP_DATABASE, DRUPAL_BOOTSTRAP_SESSION, DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE, DRUPAL_BOOTSTRAP_LANGUAGE, DRUPAL_BOOTSTRAP_PATH, DRUPAL_BOOTSTRAP_FULL), $phase_index = 0; while ($phase >= $phase_index && isset($phases[$phase_index])) { $current_phase = $phases[$phase_index]; @@ -952,15 +918,6 @@ function _drupal_bootstrap($phase) { db_set_active(); break; - case DRUPAL_BOOTSTRAP_ACCESS: - // Deny access to hosts which were banned - t() is not yet available. - if (drupal_is_denied('host', ip_address())) { - header('HTTP/1.1 403 Forbidden'); - print 'Sorry, '. check_plain(ip_address()) .' has been banned.'; - exit(); - } - break; - case DRUPAL_BOOTSTRAP_SESSION: require_once variable_get('session_inc', './includes/session.inc'); session_set_save_handler('sess_open', 'sess_close', 'sess_read', 'sess_write', 'sess_destroy_sid', 'sess_gc'); Index: modules/user/user.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.admin.inc,v retrieving revision 1.19 diff -u -p -r1.19 user.admin.inc --- modules/user/user.admin.inc 20 Feb 2008 13:46:43 -0000 1.19 +++ modules/user/user.admin.inc 18 Mar 2008 22:43:32 -0000 @@ -807,7 +807,6 @@ function user_admin_check_user() { $form['user']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter a username to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => USERNAME_MAX_LENGTH); $form['user']['type'] = array('#type' => 'hidden', '#value' => 'user'); $form['user']['submit'] = array('#type' => 'submit', '#value' => t('Check username')); - $form['#submit'][] = 'user_admin_access_check_submit'; $form['#validate'][] = 'user_admin_access_check_validate'; $form['#theme'] = 'user_admin_access_check'; return $form; @@ -818,7 +817,6 @@ function user_admin_check_mail() { $form['mail']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter an e-mail address to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => EMAIL_MAX_LENGTH); $form['mail']['type'] = array('#type' => 'hidden', '#value' => 'mail'); $form['mail']['submit'] = array('#type' => 'submit', '#value' => t('Check e-mail')); - $form['#submit'][] = 'user_admin_access_check_submit'; $form['#validate'][] = 'user_admin_access_check_validate'; $form['#theme'] = 'user_admin_access_check'; return $form; @@ -835,37 +833,6 @@ function user_admin_check_host() { return $form; } -function user_admin_access_check_submit($form, &$form_state) { - switch ($form_state['values']['type']) { - case 'user': - if (drupal_is_denied('user', $form_state['values']['test'])) { - drupal_set_message(t('The username %name is not allowed.', array('%name' => $form_state['values']['test']))); - } - else { - drupal_set_message(t('The username %name is allowed.', array('%name' => $form_state['values']['test']))); - } - break; - case 'mail': - if (drupal_is_denied('mail', $form_state['values']['test'])) { - drupal_set_message(t('The e-mail address %mail is not allowed.', array('%mail' => $form_state['values']['test']))); - } - else { - drupal_set_message(t('The e-mail address %mail is allowed.', array('%mail' => $form_state['values']['test']))); - } - break; - case 'host': - if (drupal_is_denied('host', $form_state['values']['test'])) { - drupal_set_message(t('The hostname %host is not allowed.', array('%host' => $form_state['values']['test']))); - } - else { - drupal_set_message(t('The hostname %host is allowed.', array('%host' => $form_state['values']['test']))); - } - break; - default: - break; - } -} - /** * Menu callback: delete an access rule * Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.896 diff -u -p -r1.896 user.module --- modules/user/user.module 20 Feb 2008 13:46:43 -0000 1.896 +++ modules/user/user.module 18 Mar 2008 22:43:32 -0000 @@ -946,43 +946,6 @@ function user_menu() { 'type' => MENU_CALLBACK, 'file' => 'user.admin.inc', ); - $items['admin/user/rules'] = array( - 'title' => 'Access rules', - 'description' => 'List and create rules to disallow usernames, e-mail addresses, and IP addresses.', - 'page callback' => 'user_admin_access', - 'access arguments' => array('administer permissions'), - 'file' => 'user.admin.inc', - ); - $items['admin/user/rules/list'] = array( - 'title' => 'List', - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, - ); - $items['admin/user/rules/add'] = array( - 'title' => 'Add rule', - 'page callback' => 'user_admin_access_add', - 'type' => MENU_LOCAL_TASK, - 'file' => 'user.admin.inc', - ); - $items['admin/user/rules/check'] = array( - 'title' => 'Check rules', - 'page callback' => 'user_admin_access_check', - 'type' => MENU_LOCAL_TASK, - 'file' => 'user.admin.inc', - ); - $items['admin/user/rules/edit'] = array( - 'title' => 'Edit rule', - 'page callback' => 'user_admin_access_edit', - 'type' => MENU_CALLBACK, - 'file' => 'user.admin.inc', - ); - $items['admin/user/rules/delete'] = array( - 'title' => 'Delete rule', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('user_admin_access_delete_confirm'), - 'type' => MENU_CALLBACK, - 'file' => 'user.admin.inc', - ); $items['logout'] = array( 'title' => 'Log out', @@ -1243,10 +1206,6 @@ function user_login_name_validate($form, // blocked in user administration form_set_error('name', t('The username %name has not been activated or is blocked.', array('%name' => $form_state['values']['name']))); } - else if (drupal_is_denied('user', $form_state['values']['name'])) { - // denied by access controls - form_set_error('name', t('The name %name is a reserved username.', array('%name' => $form_state['values']['name']))); - } } } @@ -1484,9 +1443,6 @@ function _user_edit_validate($uid, &$edi else if (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE uid != %d AND LOWER(name) = LOWER('%s')", $uid, $edit['name'])) > 0) { form_set_error('name', t('The name %name is already taken.', array('%name' => $edit['name']))); } - else if (drupal_is_denied('user', $edit['name'])) { - form_set_error('name', t('The name %name has been denied access.', array('%name' => $edit['name']))); - } } // Validate the e-mail address: @@ -1496,9 +1452,6 @@ function _user_edit_validate($uid, &$edi else if (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $uid, $edit['mail'])) > 0) { form_set_error('mail', t('The e-mail address %email is already registered. Have you forgotten your password?', array('%email' => $edit['mail'], '@password' => url('user/password')))); } - else if (drupal_is_denied('mail', $edit['mail'])) { - form_set_error('mail', t('The e-mail address %email has been denied access.', array('%email' => $edit['mail']))); - } } function _user_edit_submit($uid, &$edit) { @@ -1833,8 +1786,6 @@ function user_help($path, $arg) { case 'admin/user/user/create': case 'admin/user/user/account/create': return '
'. t("This web page allows administrators to register new users. Users' e-mail addresses and usernames must be unique.") .'
'; - case 'admin/user/rules': - return ''. t('Set up username and e-mail address access rules for new and existing accounts (currently logged in accounts will not be logged out). If a username or e-mail address for an account matches any deny rule, but not an allow rule, then the account will not be allowed to be created or to log in. A host rule is effective for every page view, not just registrations.') .'
'; case 'admin/user/permissions': return ''. t('Permissions let you control what users can do on your site. Each user role (defined on the user roles page) has its own set of permissions. For example, you could give users classified as "Administrators" permission to "administer nodes" but deny this power to ordinary, "authenticated" users. You can use permissions to reveal new features to privileged users (those with subscriptions, for example). Permissions also allow trusted users to share the administrative burden of running a busy site.', array('@role' => url('admin/user/roles'))) .'
'; case 'admin/user/roles':