diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-06-01 20:21:35 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-06-01 20:21:35 +0000 |
commit | 263b7e230d51ea41589f3669f3192d456e4b89d0 (patch) | |
tree | 98687f133324dca0c8a0bd603f4c69d908bdcf65 /modules | |
parent | cb5b2f332cbdaadcc2802bd76b190d1b77b0b51b (diff) | |
download | brdo-263b7e230d51ea41589f3669f3192d456e4b89d0.tar.gz brdo-263b7e230d51ea41589f3669f3192d456e4b89d0.tar.bz2 |
- Fixed registration bug.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/user.module | 6 | ||||
-rw-r--r-- | modules/user/user.module | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/modules/user.module b/modules/user.module index e2da4465d..8db236288 100644 --- a/modules/user.module +++ b/modules/user.module @@ -1023,7 +1023,11 @@ function user_register($edit = array()) { // TODO: Is this necessary? Won't session_write() replicate this? unset($edit['session']); - $account = user_save('', array_merge(array('name' => $edit['name'], 'pass' => $pass, 'init' => $edit['mail'], 'mail' => $edit['mail'], 'roles' => array(_user_authenticated_id()), 'status' => (variable_get('user_register', 1) == 1 ? 1 : 0)), $edit)); + if (array_intersect(array_keys($edit), array('uid', 'roles', 'init', 'session', 'status'))) { + watchdog('security', t('Detected malicious attempt to alter protected user fields.'), WATCHDOG_WARNING); + drupal_goto('user/register'); + } + $account = user_save('', array_merge($edit, array('pass' => $pass, 'init' => $edit['mail'], 'roles' => array(_user_authenticated_id()), 'status' => (variable_get('user_register', 1) == 1 ? 1 : 0)))); watchdog('user', t('New user: %name %email.', array('%name' => theme('placeholder', $edit['name']), '%email' => theme('placeholder', '<'. $edit['mail'] .'>'))), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $account->uid .'/edit')); $variables = array('%username' => $edit['name'], '%site' => variable_get('site_name', 'drupal'), '%password' => $pass, '%uri' => $base_url, '%uri_brief' => substr($base_url, strlen('http://')), '%mailto' => $edit['mail'], '%date' => format_date(time()), '%login_uri' => url('user', NULL, NULL, TRUE), '%edit_uri' => url('user/'. $account->uid .'/edit', NULL, NULL, TRUE), '%login_url' => user_pass_reset_url($account)); diff --git a/modules/user/user.module b/modules/user/user.module index e2da4465d..8db236288 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -1023,7 +1023,11 @@ function user_register($edit = array()) { // TODO: Is this necessary? Won't session_write() replicate this? unset($edit['session']); - $account = user_save('', array_merge(array('name' => $edit['name'], 'pass' => $pass, 'init' => $edit['mail'], 'mail' => $edit['mail'], 'roles' => array(_user_authenticated_id()), 'status' => (variable_get('user_register', 1) == 1 ? 1 : 0)), $edit)); + if (array_intersect(array_keys($edit), array('uid', 'roles', 'init', 'session', 'status'))) { + watchdog('security', t('Detected malicious attempt to alter protected user fields.'), WATCHDOG_WARNING); + drupal_goto('user/register'); + } + $account = user_save('', array_merge($edit, array('pass' => $pass, 'init' => $edit['mail'], 'roles' => array(_user_authenticated_id()), 'status' => (variable_get('user_register', 1) == 1 ? 1 : 0)))); watchdog('user', t('New user: %name %email.', array('%name' => theme('placeholder', $edit['name']), '%email' => theme('placeholder', '<'. $edit['mail'] .'>'))), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $account->uid .'/edit')); $variables = array('%username' => $edit['name'], '%site' => variable_get('site_name', 'drupal'), '%password' => $pass, '%uri' => $base_url, '%uri_brief' => substr($base_url, strlen('http://')), '%mailto' => $edit['mail'], '%date' => format_date(time()), '%login_uri' => url('user', NULL, NULL, TRUE), '%edit_uri' => url('user/'. $account->uid .'/edit', NULL, NULL, TRUE), '%login_url' => user_pass_reset_url($account)); |