From d752aedee962294dd2bbc120557d6b6b79c970a9 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 14 Nov 2009 13:35:17 +0100 Subject: more work on user and group cleaning Ignore-this: b824c2941d3631bdf83350e325606d3e darcs-hash:20091114123517-7ad00-d32833a88cb5f654a8874542d4d59f1f401d4453.gz --- inc/auth/ad.class.php | 14 +++++++++----- inc/auth/plain.class.php | 10 ---------- 2 files changed, 9 insertions(+), 15 deletions(-) (limited to 'inc/auth') diff --git a/inc/auth/ad.class.php b/inc/auth/ad.class.php index 4365e75dc..8eb8b06d8 100644 --- a/inc/auth/ad.class.php +++ b/inc/auth/ad.class.php @@ -138,15 +138,13 @@ class auth_ad extends auth_basic { $info['mail'] = $result[0]['mail'][0]; $info['uid'] = $result[0]['samaccountname'][0]; $info['dn'] = $result[0]['dn']; - if(!$info['mail']) $info['mail'] = cleanID($user).'@projektron.de'; - // handle ActiveDirectory memberOf $info['grps'] = $this->adldap->user_groups($user); if (is_array($info['grps'])) { foreach ($info['grps'] as $ndx => $group) { - $info['grps'][$ndx] = $this->_sanitizeGroupName($group); + $info['grps'][$ndx] = $this->cleanGroup($group); } } @@ -163,15 +161,21 @@ class auth_ad extends auth_basic { * * Removes backslashes ('\'), pound signs ('#'), and converts spaces to underscores. * - * @author James Van Lommel (jamesvl@gmail.com) + * @author James Van Lommel (jamesvl@gmail.com) */ - function _sanitizeGroupName($name) { + function cleanGroup($name) { $sName = str_replace('\\', '', $name); $sName = str_replace('#', '', $sName); $sName = preg_replace('[\s]', '_', $sName); return $sName; } + /** + * Sanitize user names + */ + function cleanUser($name) { + return $this->cleanGroup($name); + } /** * Initialize the AdLDAP library and connect to the server diff --git a/inc/auth/plain.class.php b/inc/auth/plain.class.php index 0ff18d58a..3983a7d44 100644 --- a/inc/auth/plain.class.php +++ b/inc/auth/plain.class.php @@ -12,16 +12,6 @@ require_once(DOKU_AUTH.'/basic.class.php'); define('AUTH_USERFILE',DOKU_CONF.'users.auth.php'); -// we only accept page ids for auth_plain -if(isset($_REQUEST['u'])) - $_REQUEST['u'] = cleanID($_REQUEST['u']); -if(isset($_REQUEST['acl_user'])) - $_REQUEST['acl_user'] = cleanID($_REQUEST['acl_user']); -// the same goes for password reset requests -if(isset($_POST['login'])){ - $_POST['login'] = cleanID($_POST['login']); -} - class auth_plain extends auth_basic { var $users = null; -- cgit v1.2.3