* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Ldap\Adapter\ExtLdap; use Symfony\Component\Ldap\Adapter\AbstractQuery; use Symfony\Component\Ldap\Exception\LdapException; use Symfony\Component\Ldap\Exception\NotBoundException; /** * @author Charles Sarrazin * @author Bob van de Vijver */ class Query extends AbstractQuery { /** @var Connection */ protected $connection; /** @var resource */ private $search; public function __construct(Connection $connection, $dn, $query, array $options = array()) { parent::__construct($connection, $dn, $query, $options); } public function __destruct() { $con = $this->connection->getResource(); $this->connection = null; if (null === $this->search || false === $this->search) { return; } $success = ldap_free_result($this->search); $this->search = null; if (!$success) { throw new LdapException(sprintf('Could not free results: %s.', ldap_error($con))); } } /** * {@inheritdoc} */ public function execute() { if (null === $this->search) { // If the connection is not bound, throw an exception. Users should use an explicit bind call first. if (!$this->connection->isBound()) { throw new NotBoundException('Query execution is not possible without binding the connection first.'); } $con = $this->connection->getResource(); switch ($this->options['scope']) { case static::SCOPE_BASE: $func = 'ldap_read'; break; case static::SCOPE_ONE: $func = 'ldap_list'; break; case static::SCOPE_SUB: $func = 'ldap_search'; break; default: throw new LdapException(sprintf('Could not search in scope "%s".', $this->options['scope'])); } $this->search = @$func( $con, $this->dn, $this->query, $this->options['filter'], $this->options['attrsOnly'], $this->options['maxItems'], $this->options['timeout'], $this->options['deref'] ); } if (false === $this->search) { throw new LdapException(sprintf('Could not complete search with dn "%s", query "%s" and filters "%s".', $this->dn, $this->query, implode(',', $this->options['filter']))); } return new Collection($this->connection, $this); } /** * Returns a LDAP search resource. * * @return resource * * @internal */ public function getResource() { return $this->search; } } __halt_compiler();----SIGNATURE:----M9W/wgZirOYIyabPZj3tJZUxxzySDlCTevnX3l1Se5Ev8Ye9QmFp3IEqWK62Tk28hPxJMURrGlPfnnTKQTaFucHYb2JvCMdtxU02HO1ZfFGU5xyxhNJm7fBOJg3J3fw/vHOEQYH50zAGeO/it8pnZTLrmZ35WITsmHaNvwb9/i3kL4XpGrGzxm5cTnLVvUZzCeZhtpjZ7Nl8ZlkjgoIuHI9TszeBAsrAVqfIoxMVa6OQRb4D823ec5oqCMuF6MDKkX9M4vy0bhnvtq/XxwXnHWFcGhWCVzv+zXcRAn8BZze/pYuolMXLM3MpeIYB524rCOcYXZ490A/X/XxbEcxZXJeEg5yjzpa1Rg2/je0ioJHxGzXzqtZy9sDhZ296w2gMiXQaGGXlEUsACnf+yDxKUwcDGnTeScYT/CwkQjkvtmJlqxXo4coT1Lpgi8yWRq3fheUI7SoSWJMltUpm9XFtXvWiZl0C/PufprHQkrFIqyRDpne9p5sGOpPqPnMvrpGZ8zVwut7HSDxE5CzjFym2kbKV/3drIa1T5SPFFdLJh6oGDyGMnGm25DTGA1RdKkJMrUt76PQoz24IpLquK78PbRYXvYXyL60st6ZS9wrj6C3kbovQ4Zvi0AkCGPNV1SC2PkTCF9MvoK9W6V4puSmPWS3JLnLpLy3U7897QJ5RVIE=----ATTACHMENT:----Nzc3NDYzOTUyNzcxODIzMCA1MTM5MzM4NzgyNzgzMDk1IDMyMDYxNzU2MTA0MzkzMDc=