From 65aa7520e2605784c0d300368ae0ecdd26ec2f3d Mon Sep 17 00:00:00 2001 From: Ben Klang Date: Wed, 30 Dec 2009 18:48:06 -0500 Subject: [PATCH] Deprecate former Horde_LDAP library --- framework/Ldap/lib/Horde/Ldap.php | 96 ----------------------------- framework/Ldap/package.xml | 92 --------------------------- framework/Ldap/test/Horde/Ldap/quoteDN.phpt | 44 ------------- 3 files changed, 232 deletions(-) delete mode 100644 framework/Ldap/lib/Horde/Ldap.php delete mode 100644 framework/Ldap/package.xml delete mode 100644 framework/Ldap/test/Horde/Ldap/quoteDN.phpt diff --git a/framework/Ldap/lib/Horde/Ldap.php b/framework/Ldap/lib/Horde/Ldap.php deleted file mode 100644 index 08d4b4866..000000000 --- a/framework/Ldap/lib/Horde/Ldap.php +++ /dev/null @@ -1,96 +0,0 @@ - - * @category Horde - * @package Horde_Ldap - */ -class Horde_Ldap -{ - /** - * Return a boolean expression using the specified operator. - * - * @param string $lhs The attribute to test. - * @param string $op The operator. - * @param string $rhs The comparison value. - * @param array $params Any additional parameters for the operator. - * - * @return string The LDAP search fragment. - */ - static public function buildClause($lhs, $op, $rhs, $params = array()) - { - switch ($op) { - case 'LIKE': - if (empty($rhs)) { - return '(' . $lhs . '=*)'; - } elseif (!empty($params['begin'])) { - return sprintf('(|(%s=%s*)(%s=* %s*))', $lhs, self::quote($rhs), $lhs, self::quote($rhs)); - } elseif (!empty($params['approximate'])) { - return sprintf('(%s=~%s)', $lhs, self::quote($rhs)); - } - return sprintf('(%s=*%s*)', $lhs, self::quote($rhs)); - - default: - return sprintf('(%s%s%s)', $lhs, $op, self::quote($rhs)); - } - } - - /** - * Escape characters with special meaning in LDAP searches. - * - * @param string $clause The string to escape. - * - * @return string The escaped string. - */ - static public function quote($clause) - { - return str_replace(array('\\', '(', ')', '*', "\0"), - array('\\5c', '\(', '\)', '\*', "\\00"), - $clause); - } - - /** - * Take an array of DN elements and properly quote it according to RFC - * 1485. - * - * @param array $parts An array of tuples containing the attribute - * name and that attribute's value which make - * up the DN. Example: - *
-     * $parts = array(
-     *     0 => array('cn', 'John Smith'),
-     *     1 => array('dc', 'example'),
-     *     2 => array('dc', 'com')
-     * );
-     * 
- * - * @return string The properly quoted string DN. - */ - static public function quoteDN($parts) - { - $dn = ''; - - for ($i = 0, $cnt = count($parts); $i < $cnt; ++$i) { - if ($i > 0) { - $dn .= ','; - } - $dn .= $parts[$i][0] . '='; - - // See if we need to quote the value. - if (preg_match('/^\s|\s$|\s\s|[,+="\r\n<>#;]/', $parts[$i][1])) { - $dn .= '"' . str_replace('"', '\\"', $parts[$i][1]) . '"'; - } else { - $dn .= $parts[$i][1]; - } - } - - return $dn; - } - -} diff --git a/framework/Ldap/package.xml b/framework/Ldap/package.xml deleted file mode 100644 index 52e4a286f..000000000 --- a/framework/Ldap/package.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - Ldap - pear.horde.org - Ldap Utility Class - This package contains utility functions for dealing with LDAP servers and data. - - - Chuck Hagenbuch - chuck - chuck@horde.org - yes - - 2010-02-02 - - 0.1.0 - 0.1.0 - - - beta - beta - - LGPL - * Initial Horde 4 package. - - - - - - - - - - - - - - - - - - - - - 5.2.0 - - - 1.5.0 - - - - - - - - - - - 2006-05-08 - - - 0.0.2 - 0.0.2 - - - alpha - alpha - - LGPL - * Converted to package.xml 2.0 for pear.horde.org - * Support approximate LDAP searches (requires openldap or another supported server). - - - - - 0.0.1 - 0.0.1 - - - alpha - alpha - - 2004-01-12 - LGPL - Initial release as a PEAR package - - - - diff --git a/framework/Ldap/test/Horde/Ldap/quoteDN.phpt b/framework/Ldap/test/Horde/Ldap/quoteDN.phpt deleted file mode 100644 index a58ffcb14..000000000 --- a/framework/Ldap/test/Horde/Ldap/quoteDN.phpt +++ /dev/null @@ -1,44 +0,0 @@ ---TEST-- -Horde_Ldap::quoteDN() tests ---FILE-- - ---EXPECT-- -cn=John Smith,dc=example,dc=com -cn="Smith, John",dc=example,dc=com -cn=" John Smith",dc=example,dc=com -cn="John Smith ",dc=example,dc=com -cn="John Smith",dc=example,dc=com -cn="John+Smith",dc=example,dc=com -cn="John \"Bugsy\" Smith",dc=example,dc=com -- 2.11.0