? .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:25:31 -0000 @@ -847,34 +847,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. @@ -952,15 +924,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:25:33 -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:25:33 -0000 @@ -1243,10 +1243,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 +1480,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 +1489,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) {