Package org.nasutekds.server.types

Examples of org.nasutekds.server.types.Entry


          if (preloadEntry == null) {
            continue;
          }
          long entryID =
            JebFormat.entryIDFromDatabase(preloadEntry.entryIDBytes);
          Entry entry =
            ID2Entry.entryFromDatabase(ByteString.wrap(preloadEntry.entryBytes),
            jeb.getRootContainer().getCompressedSchema());
          try {
            // Even if the entry does not end up in the cache its still
            // treated as a processed entry anyways.
            DirectoryServer.getEntryCache().putEntry(entry, jeb, entryID);
            processedEntries.getAndIncrement();
          } catch (Exception ex) {
            if (debugEnabled()) {
              TRACER.debugCaught(DebugLogLevel.ERROR, ex);
            }
            Message message = ERR_CACHE_PRELOAD_ENTRY_FAILED.get(
              entry.getDN().toNormalizedString(),
              (ex.getCause() != null ? ex.getCause().getMessage() :
                stackTraceToSingleLineString(ex)));
            logError(message);
          }
        } catch (Exception ex) {
View Full Code Here


          }

          ProxiedAuthV1Control proxyControl =
              getRequestControl(ProxiedAuthV1Control.DECODER);

          Entry authorizationEntry = proxyControl.getAuthorizationEntry();
          setAuthorizationEntry(authorizationEntry);
          if (authorizationEntry == null)
          {
            setProxiedAuthorizationDN(DN.nullDN());
          }
          else
          {
            setProxiedAuthorizationDN(authorizationEntry.getDN());
          }
        }
        else if (oid.equals(OID_PROXIED_AUTH_V2))
        {
          // The requester must have the PROXIED_AUTH privilige in order to
          // be able to use this control.
          if (! clientConnection.hasPrivilege(Privilege.PROXIED_AUTH, this))
          {
            throw new DirectoryException(ResultCode.AUTHORIZATION_DENIED,
                           ERR_PROXYAUTH_INSUFFICIENT_PRIVILEGES.get());
          }

          ProxiedAuthV2Control proxyControl =
              getRequestControl(ProxiedAuthV2Control.DECODER);

          Entry authorizationEntry = proxyControl.getAuthorizationEntry();
          setAuthorizationEntry(authorizationEntry);
          if (authorizationEntry == null)
          {
            setProxiedAuthorizationDN(DN.nullDN());
          }
          else
          {
            setProxiedAuthorizationDN(authorizationEntry.getDN());
          }
        }

        // NYI -- Add support for additional controls.
View Full Code Here

   */
  protected void processReadEntryControls()
  {
    if (preReadRequest != null)
    {
      Entry entry = currentEntry.duplicate(true);

      if (! preReadRequest.allowsAttribute(
                 DirectoryServer.getObjectClassAttributeType()))
      {
        entry.removeAttribute(
             DirectoryServer.getObjectClassAttributeType());
      }

      if (! preReadRequest.returnAllUserAttributes())
      {
        Iterator<AttributeType> iterator =
             entry.getUserAttributes().keySet().iterator();
        while (iterator.hasNext())
        {
          AttributeType attrType = iterator.next();
          if (! preReadRequest.allowsAttribute(attrType))
          {
            iterator.remove();
          }
        }
      }

      if (! preReadRequest.returnAllOperationalAttributes())
      {
        Iterator<AttributeType> iterator =
             entry.getOperationalAttributes().keySet().iterator();
        while (iterator.hasNext())
        {
          AttributeType attrType = iterator.next();
          if (! preReadRequest.allowsAttribute(attrType))
          {
            iterator.remove();
          }
        }
      }

      // Check access controls on the entry and strip out
      // any not allowed attributes.
      SearchResultEntry searchEntry =
        AccessControlConfigManager.getInstance().
        getAccessControlHandler().filterEntry(this, entry);
      LDAPPreReadResponseControl responseControl =
           new LDAPPreReadResponseControl(preReadRequest.isCritical(),
                                          searchEntry);

      addResponseControl(responseControl);
    }

    if (postReadRequest != null)
    {
      Entry entry = newEntry.duplicate(true);

      if (! postReadRequest.allowsAttribute(
                 DirectoryServer.getObjectClassAttributeType()))
      {
        entry.removeAttribute(
             DirectoryServer.getObjectClassAttributeType());
      }

      if (! postReadRequest.returnAllUserAttributes())
      {
        Iterator<AttributeType> iterator =
             entry.getUserAttributes().keySet().iterator();
        while (iterator.hasNext())
        {
          AttributeType attrType = iterator.next();
          if (! postReadRequest.allowsAttribute(attrType))
          {
            iterator.remove();
          }
        }
      }

      if (! postReadRequest.returnAllOperationalAttributes())
      {
        Iterator<AttributeType> iterator =
             entry.getOperationalAttributes().keySet().iterator();
        while (iterator.hasNext())
        {
          AttributeType attrType = iterator.next();
          if (! postReadRequest.allowsAttribute(attrType))
          {
View Full Code Here

                getRequestControl(LDAPAssertionRequestControl.DECODER);

          try
          {
            SearchFilter assertionFilter = assertControl.getSearchFilter();
            Entry entry;
            try
            {
              entry = DirectoryServer.getEntry(baseDN);
            }
            catch (DirectoryException de)
            {
              if (debugEnabled())
              {
                TRACER.debugCaught(DebugLogLevel.ERROR, de);
              }

              throw new DirectoryException(de.getResultCode(),
                             ERR_SEARCH_CANNOT_GET_ENTRY_FOR_ASSERTION.get(
                                  de.getMessageObject()));
            }

            if (entry == null)
            {
              throw new DirectoryException(ResultCode.NO_SUCH_OBJECT,
                             ERR_SEARCH_NO_SUCH_ENTRY_FOR_ASSERTION.get());
            }

            // Check if the current user has permission to make
            // this determination.
            if (!AccessControlConfigManager.getInstance().
              getAccessControlHandler().isAllowed(this, entry, assertionFilter))
            {
              throw new DirectoryException(
                ResultCode.INSUFFICIENT_ACCESS_RIGHTS,
                ERR_CONTROL_INSUFFICIENT_ACCESS_RIGHTS.get(oid));
            }

            if (! assertionFilter.matchesEntry(entry))
            {
              throw new DirectoryException(ResultCode.ASSERTION_FAILED,
                                           ERR_SEARCH_ASSERTION_FAILED.get());
            }
          }
          catch (DirectoryException de)
          {
            if (de.getResultCode() == ResultCode.ASSERTION_FAILED)
            {
              throw de;
            }

            if (debugEnabled())
            {
              TRACER.debugCaught(DebugLogLevel.ERROR, de);
            }

            throw new DirectoryException(ResultCode.PROTOCOL_ERROR,
                           ERR_SEARCH_CANNOT_PROCESS_ASSERTION_FILTER.get(
                                de.getMessageObject()), de);
          }
        }
        else if (oid.equals(OID_PROXIED_AUTH_V1))
        {
          // The requester must have the PROXIED_AUTH privilige in order to be
          // able to use this control.
          if (! clientConnection.hasPrivilege(Privilege.PROXIED_AUTH, this))
          {
            throw new DirectoryException(ResultCode.AUTHORIZATION_DENIED,
                           ERR_PROXYAUTH_INSUFFICIENT_PRIVILEGES.get());
          }

          ProxiedAuthV1Control proxyControl =
              getRequestControl(ProxiedAuthV1Control.DECODER);

          Entry authorizationEntry = proxyControl.getAuthorizationEntry();
          setAuthorizationEntry(authorizationEntry);
          if (authorizationEntry == null)
          {
            setProxiedAuthorizationDN(DN.nullDN());
          }
          else
          {
            setProxiedAuthorizationDN(authorizationEntry.getDN());
          }
        }
        else if (oid.equals(OID_PROXIED_AUTH_V2))
        {
          // The requester must have the PROXIED_AUTH privilige in order to be
          // able to use this control.
          if (! clientConnection.hasPrivilege(Privilege.PROXIED_AUTH, this))
          {
            throw new DirectoryException(ResultCode.AUTHORIZATION_DENIED,
                           ERR_PROXYAUTH_INSUFFICIENT_PRIVILEGES.get());
          }

          ProxiedAuthV2Control proxyControl =
              getRequestControl(ProxiedAuthV2Control.DECODER);

          Entry authorizationEntry = proxyControl.getAuthorizationEntry();
          setAuthorizationEntry(authorizationEntry);
          if (authorizationEntry == null)
          {
            setProxiedAuthorizationDN(DN.nullDN());
          }
          else
          {
            setProxiedAuthorizationDN(authorizationEntry.getDN());
          }
        }
        else if (oid.equals(OID_LDAP_SUBENTRIES))
        {
          SubentriesControl subentriesControl =
View Full Code Here

      // perform add operation
      sendAddMsg(true, fractionalConf);

      // check that entry has been created and that it does not contain
      // forbidden attributes
      Entry newEntry = null;
      try
      {
        newEntry = getEntry(DN.decode(ENTRY_DN), TIMEOUT, true);
      } catch(Exception e)
      {
        fail("Entry has not been added: " + e.getMessage());
      }
      checkEntryFilteredAfterAdd(newEntry, EXCLUDE_FRAC_MODE, fractionalConf);

      // perform modify operation (modify forbidden attributes +
      // modify authorized attribute (not a no op))
      sendModifyMsg(true, fractionalConf);

      // Wait for modify operation being replayed and
      // check that entry does not contain forbidden attributes
      Entry entry = null;
      boolean synchroAttrFound = false;
      int timeout = TIMEOUT;
      while(timeout>0)
      {
        try
        {
          entry = getEntry(DN.decode(ENTRY_DN), TIMEOUT, true);
          if (entry.hasAttribute(DirectoryServer.getAttributeType(SYNCHRO_OPTIONAL_ATTR.toLowerCase())))
          {
            synchroAttrFound = true;
            break;
          }
          Thread.sleep(1000);
View Full Code Here

      // perform add operation
      sendAddMsg(true, fractionalConf);

      // check that entry has been created and that it does not contain
      // forbidden attributes
      Entry newEntry = null;
      try
      {
        newEntry = getEntry(DN.decode(ENTRY_DN), TIMEOUT, true);
      } catch(Exception e)
      {
        fail("Entry has not been added: " + e.getMessage());
      }
      checkEntryFilteredAfterAdd(newEntry, INCLUDE_FRAC_MODE, fractionalConf);

      // perform modify operation (modify forbidden attributes +
      // modify authorized attribute (not a no op))
      sendModifyMsg(true, fractionalConf);

      // Wait for modify operation being replayed and
      // check that entry does not contain forbidden attributes
      Entry entry = null;
      boolean synchroAttrFound = false;
      int timeout = TIMEOUT;
      while(timeout>0)
      {
        try
        {
          entry = getEntry(DN.decode(ENTRY_DN), TIMEOUT, true);
          if (entry.hasAttribute(DirectoryServer.getAttributeType(SYNCHRO_OPTIONAL_ATTR.toLowerCase())))
          {
            synchroAttrFound = true;
            break;
          }
          Thread.sleep(1000);
View Full Code Here

  {
    long genId=-1;
    try
    {
      DN baseDn = DN.decode(rootDn);
      Entry resultEntry = getEntry(baseDn, 1000, true);
      if (resultEntry==null)
      {
        debugInfo("Entry not found <" + rootDn + ">");
      }
      else
      {
        debugInfo("Entry found <" + rootDn + ">");

        AttributeType synchronizationGenIDType =
          DirectoryServer.getAttributeType(REPLICATION_GENERATION_ID);
        List<Attribute> attrs =
          resultEntry.getAttribute(synchronizationGenIDType);
        if (attrs != null)
        {
          Attribute attr = attrs.get(0);
          if (attr.size() == 1)
          {
View Full Code Here

          entryLdif += fracCfgValue + ": " + fracCfgValue + "Value\n";
        }
        first = false;
      }

      Entry entry = null;
      try
      {
        entry = TestCaseUtils.entryFromLdifString(entryLdif);
      } catch (Exception e)
      {
        fail(e.getMessage());
      }

      // Create an update message to add an entry.
      AddMsg addMsg = new AddMsg(gen.newChangeNumber(),
        entry.getDN().toString(),
        ENTRY_UUID,
        null,
        entry.getObjectClassAttribute(),
        entry.getAttributes(), new ArrayList<Attribute>());

      replicationDomain.publish(addMsg);
    }
View Full Code Here

      waitForDomainStatus(fractionalReplicationDomain,
        ServerStatus.NORMAL_STATUS, 15);

      // check that entry has been created and that it does not contain
      // forbidden attributes
      Entry newEntry = null;
      try
      {
        newEntry = getEntry(DN.decode(ENTRY_DN2), TIMEOUT, true);
      } catch(Exception e)
      {
        fail("Entry has not been created: " + e.getMessage());
      }
      checkEntryFilteredAfterAdd(newEntry, EXCLUDE_FRAC_MODE, fractionalConf);

      // perform modify operation (modify forbidden attributes +
      // modify authorized attribute (not a no op))
      sendModifyMsg(false, fractionalConf);

      // Wait for modify operation being replayed and
      // check that entry does not contain forbidden attributes
      Entry entry = null;
      boolean synchroAttrFound = false;
      int timeout = TIMEOUT;
      while(timeout>0)
      {
        try
        {
          entry = getEntry(DN.decode(ENTRY_DN2), TIMEOUT, true);
          if (entry.hasAttribute(DirectoryServer.getAttributeType(SYNCHRO_OPTIONAL_ATTR.toLowerCase())))
          {
            synchroAttrFound = true;
            break;
          }
          Thread.sleep(1000);
View Full Code Here

      waitForDomainStatus(fractionalReplicationDomain,
        ServerStatus.NORMAL_STATUS, 15);

      // check that entry has been created and that it does not contain
      // forbidden attributes
      Entry newEntry = null;
      try
      {
        newEntry = getEntry(DN.decode(ENTRY_DN2), TIMEOUT, true);
      } catch(Exception e)
      {
        fail("Entry has not been created: " + e.getMessage());
      }
      checkEntryFilteredAfterAdd(newEntry, INCLUDE_FRAC_MODE, fractionalConf);

      // perform modify operation (modify forbidden attributes +
      // modify authorized attribute (not a no op))
      sendModifyMsg(false, fractionalConf);

      // Wait for modify operation being replayed and
      // check that entry does not contain forbidden attributes
      Entry entry = null;
      boolean synchroAttrFound = false;
      int timeout = TIMEOUT;
      while(timeout>0)
      {
        try
        {
          entry = getEntry(DN.decode(ENTRY_DN2), TIMEOUT, true);
          if (entry.hasAttribute(DirectoryServer.getAttributeType(SYNCHRO_OPTIONAL_ATTR.toLowerCase())))
          {
            synchroAttrFound = true;
            break;
          }
          Thread.sleep(1000);
View Full Code Here

TOP

Related Classes of org.nasutekds.server.types.Entry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.