本文整理汇总了PHP中ldap_next_entry函数的典型用法代码示例。如果您正苦于以下问题:PHP ldap_next_entry函数的具体用法?PHP ldap_next_entry怎么用?PHP ldap_next_entry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ldap_next_entry函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: verify
function verify($cert, $dn)
{
$conn = ldap_connect($this->LDAP_HOST);
if (!$conn) {
return false;
}
if (!ldap_bind($conn)) {
return false;
}
$resultset = ldap_search($conn, "c=EE", "(serialNumber=38212200301)");
if (!$resultset) {
echo "No recs";
return false;
}
$rec = ldap_first_entry($conn, $resultset);
while ($rec !== false) {
$values = ldap_get_values($conn, $rec, 'usercertificate;binary');
$certificate = "-----BEGIN CERTIFICATE-----\n" . chunk_split(base64_encode($values[0]), 64, "\n") . "-----END CERTIFICATE-----\n";
if (strcmp($cert, $certificate) == 0) {
return "Found";
}
$rec = ldap_next_entry($conn, $rec);
}
// Not found a record with a matching certificate
return false;
}
示例2: fetchEntry
/**
* @return mixed resource
*/
public function fetchEntry()
{
if (!$this->result_resource) {
return null;
}
if (null === $this->entry_resource) {
$this->entry_resource = ldap_first_entry($this->resource, $this->result_resource);
} else {
$this->entry_resource = ldap_next_entry($this->resource, $this->entry_resource);
}
if (!$this->entry_resource) {
return null;
}
$dn = ldap_get_dn($this->resource, $this->entry_resource);
$rawAttributes = ldap_get_attributes($this->resource, $this->entry_resource);
$count = $rawAttributes['count'];
$attributes = array();
for ($i = 0; $i < $count; $i++) {
$attribute = $rawAttributes[$i];
$values = array();
$subCount = $rawAttributes[$attribute]['count'];
for ($j = 0; $j < $subCount; $j++) {
$values[] = $rawAttributes[$attribute][$j];
}
$attributes[$attribute] = $values;
}
$object = new Object($dn, $attributes);
return $object;
}
示例3: fetch_row
public function fetch_row()
{
if ($this->get_opt('fetch_pos')) {
return ldap_next_entry($this->handle, $this->resource);
} else {
return ldap_first_entry($this->handle, $this->resource);
}
}
示例4: nextEntry
/**
* @return Entry|null
* @throws EntryRetrievalFailureException
*/
public function nextEntry()
{
if (!($entry = ldap_next_entry($this->link, $this->entry))) {
if (0 !== ($errNo = ldap_errno($this->link))) {
throw new EntryRetrievalFailureException(ldap_error($this->link), $errNo);
}
return null;
}
return new Entry($this->link, $entry);
}
示例5: readUsers
public static function readUsers($ldapconn)
{
$users = array();
$search = ldap_list($ldapconn, USER_DN, User::FILTER_USERS, array("cn", "mail", "displayName", "sn", "givenName", "memberOf"));
if (ldap_count_entries($ldapconn, $search) > 0) {
$entry = ldap_first_entry($ldapconn, $search);
do {
$users[] = User::readFromLdapEntry($ldapconn, $entry);
} while ($entry = ldap_next_entry($ldapconn, $entry));
}
return $users;
}
示例6: getNextEntry
/**
* Returns the next entry in the result set or false wether there are no more entries.
*
* @return \gossi\ldap\LdapEntry The new LdapEntry.
*/
public function getNextEntry()
{
if ($this->pointer == null) {
return $this->getFirstEntry();
}
$this->pointer = ldap_next_entry($this->conn, $this->pointer);
if ($this->pointer) {
return new LdapEntry($this->conn, $this->pointer);
} else {
return false;
}
}
示例7: iterarEntradas
/**
* Auxiliar directo de busqueda. Dado un ldap result, itera por el para conseguir sus datos
*
* @param ldap result $busquedaLdap
* @param array $atributos
* @return boolean
*/
private function iterarEntradas($busquedaLdap, array $atributos)
{
$datos = array();
if ($entrada = ldap_first_entry($this->conexionLdap, $busquedaLdap)) {
do {
// Ejecutamos al menos una vez el mapeo de entradas con sus atributos, a menos
// que no haya nada
$datos[] = $this->mapa($atributos, $entrada);
} while ($entrada = ldap_next_entry($this->conexionLdap, $entrada));
return $datos;
} else {
return FALSE;
}
}
示例8: ldap_flatresults
function ldap_flatresults($ad, $sr, $key = false)
{
for ($entry = ldap_first_entry($ad, $sr); $entry != false; $entry = ldap_next_entry($ad, $entry)) {
$user = array();
$attributes = ldap_get_attributes($ad, $entry);
for ($i = $attributes['count']; $i-- > 0;) {
$user[strtolower($attributes[$i])] = $attributes[$attributes[$i]][0];
}
if ($key && $user[$key]) {
$users[strtolower($user[$key])] = $user;
} else {
$users[] = $user;
}
}
return $users;
}
示例9: getIterator
public function getIterator()
{
$con = $this->connection->getResource();
$search = $this->search->getResource();
$current = ldap_first_entry($con, $search);
if (0 === $this->count()) {
return;
}
if (false === $current) {
throw new LdapException(sprintf('Could not rewind entries array: %s', ldap_error($con)));
}
(yield $this->getSingleEntry($con, $current));
while (false !== ($current = ldap_next_entry($con, $current))) {
(yield $this->getSingleEntry($con, $current));
}
}
示例10: next
/**
* Retrieves next available entry from the search result set
*
* @return EntryInterface next entry if available, null otherwise
*/
public function next()
{
if ($this->isEndReached) {
return null;
}
if (null === $this->previous) {
$this->previous = @ldap_first_entry($this->connection, $this->resultSet);
} else {
$this->previous = @ldap_next_entry($this->connection, $this->previous);
}
if (false === $this->previous) {
$this->previous = null;
$this->isEndReached = true;
return null;
}
return new Entry($this->connection, $this->previous);
}
示例11: getUsers
public function getUsers($filter = null)
{
if ($filter !== null) {
$filter = "(&(objectClass=inetOrgPerson)(uid=" . addcslashes($filter, '()\\') . "))";
} else {
$filter = "(objectClass=inetOrgPerson)";
}
$resource = ldap_search($this->ldapconn, $this->ldapbasedn, $filter);
ldap_sort($this->ldapconn, $resource, "uid");
$entry = ldap_first_entry($this->ldapconn, $resource);
$users = array();
while ($entry) {
$attributes = ldap_get_attributes($this->ldapconn, $entry);
$users[] = $attributes["uid"][0];
$entry = ldap_next_entry($this->ldapconn, $entry);
}
return $users;
}
示例12: fetch
/**
* Fetch the next record or return false if there's none.
*
* @return Record
*/
public function fetch()
{
if (!isset($this->_numEntry)) {
$this->_numEntry = 0;
$this->_entryId = ldap_first_entry($this->_ldapConn->getLink(), $this->_searchId);
} else {
$this->_numEntry++;
$this->_entryId = ldap_next_entry($this->_ldapConn->getLink(), $this->_entryId);
}
if (!$this->_entryId) {
return false;
}
$record = new $this->fetchClass($this->_ldapConn, $this->_entryId);
if (!is_a($record, 'GO\\Base\\Ldap\\Record')) {
throw new Exception($this->fetchClass . ' is not a GO\\Base\\Ldap\\Record subclass');
}
return $record;
}
示例13: next
/**
* Get the next LDAP entry from search results.
*
* @return Entry|null
* Next LDAP entry or null if no entries left.
*/
public function next()
{
if ($this->entryID === null) {
$this->entryID = ldap_first_entry($this->ds, $this->sr);
} else {
$this->entryID = ldap_next_entry($this->ds, $this->entryID);
}
if (!$this->entryID) {
return null;
}
$data = Utils::readEntry($this->ds, $this->entryID, $this->binaryFields);
if (array_key_exists('nsRole', $data)) {
$data['roles'] = Utils::getRoles($this->ds, $data);
}
$dn = ldap_get_dn($this->ds, $this->entryID);
$rdn = Utils::getRDN($dn, $this->baseDN);
return new Entry($this->ds, $rdn, $dn, $data);
}
示例14: next
/**
* @see ResultSet::next()
*/
public function next()
{
if (!$this->entry) {
$this->entry = ldap_first_entry($this->conn->getResource(), $this->result);
}
$this->entry = ldap_next_entry($this->conn->getResource(), $this->entry);
if (!$this->entry) {
$errno = mysql_errno($this->conn->getResource());
if (!$errno) {
// We've advanced beyond end of recordset.
$this->afterLast();
return false;
} else {
throw new SQLException("Error fetching result", mysql_error($this->conn->getResource()));
}
}
$this->cursorPos++;
return $this->entry;
}
示例15: get_ldap_attribute_for_various_data
public function get_ldap_attribute_for_various_data($pAttributes, $ldapRequest)
{
$allResults = array();
$ldapc = $this->ldap_conn;
//ldap connection
if (!is_array($pAttributes)) {
throw new Exception("Argument is not an array", E_PARAM);
}
//search for multiple ldap attributes
//search string is prefix notation
$search = ldap_search($ldapc, LDAP_O . ", " . LDAP_C, $ldapRequest, $pAttributes);
//get ldap attributes
for ($entryID = ldap_first_entry($ldapc, $search); $entryID != false; $entryID = ldap_next_entry($ldapc, $entryID)) {
foreach ($pAttributes as $attribute) {
$value = ldap_get_values($ldapc, $entryID, $attribute);
$result[$attribute] = $value[0];
}
$allResults[] = $result;
}
return $allResults;
}