public LdapClassLoader( DirectoryService directoryService ) throws LdapException { super( LdapClassLoader.class.getClassLoader() ); this.directoryService = directoryService; defaultSearchDn = directoryService.getDnFactory().create( DEFAULT_SEARCH_CONTEXTS_CONFIG ); objectClassAT = directoryService.getSchemaManager().getAttributeType( SchemaConstants.OBJECT_CLASS_AT ); }
@Override public void init( DirectoryService directoryService ) throws LdapException { super.init( directoryService ); // stuff for dealing with subentries (garbage for now) Value subschemaSubentry = directoryService.getPartitionNexus().getRootDseValue( directoryService.getAtProvider().getSubschemaSubentry() ); subschemaSubentryDn = dnFactory.create( subschemaSubentry.getValue() ); // Create the Admin Dn adminDn = dnFactory.create( ServerDNConstants.ADMIN_SYSTEM_DN ); }
/** * Delete an existing consumer entry from ou=consumers,ou=system * * @param replica The added consumer replica * @throws LdapException If the addition failed */ public void deleteConsumerEntry( ReplicaEventLog replica ) throws LdapException { if ( replica == null ) { // No consumer ? Get out... return; } // Check that we have an entry for this consumer Dn consumerDn = directoryService.getDnFactory().create( SchemaConstants.ADS_DS_REPLICA_ID + "=" + replica.getId() + "," + replConsumerDn ); PROVIDER_LOG.debug( "Trying to delete the consumer entry {}", consumerDn ); if ( !adminSession.exists( consumerDn ) ) { // Error... String message = "The replica " + consumerDn.getName() + " does not exist"; LOG.error( message ); PROVIDER_LOG.debug( message ); return; } // Delete the consumer entry adminSession.delete( consumerDn ); LOG.debug( "Deleted replication consumer entry {}", consumerDn ); }
protected Dn getOperationPrincipal() throws LdapInvalidDnException { Principal principal = opContext.getSession().getEffectivePrincipal(); return opContext.getSession().getDirectoryService().getDnFactory().create( principal.getName() ); }
public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapInvalidDnException { // Return a safe copy constructed with user provided name. return opContext.getSession().getDirectoryService().getDnFactory().create( newSuperiorDn.getName() ); } };
public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapInvalidDnException { // Return a safe copy constructed with user provided name. return opContext.getSession().getDirectoryService().getDnFactory().create( newRdn.getName() ); } };
@Override public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapInvalidDnException { // Return a safe copy constructed with user provided name. return opContext.getSession().getDirectoryService().getDnFactory().create( addedEntryName.getName() ); } };
public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapInvalidDnException { // Return a safe copy constructed with user provided name. return opContext.getSession().getDirectoryService().getDnFactory().create( oldDn.getName() ); } };
public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapInvalidDnException { // Return a safe copy constructed with user provided name. return opContext.getSession().getDirectoryService().getDnFactory().create( oldSuperiorDn.getName() ); } };
public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapInvalidDnException { // Return a safe copy constructed with user provided name. return opContext.getSession().getDirectoryService().getDnFactory().create( modifiedEntryName.getName() ); } };
public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapException { // Return a safe copy constructed with user provided name. return opContext.getSession().getDirectoryService().getDnFactory().create( deletedEntryName.getName() ); } };
public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapInvalidDnException { // Return a safe copy constructed with user provided name. return opContext.getSession().getDirectoryService().getDnFactory().create( oldRdn.getName() ); } };
public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapInvalidDnException { // Return a safe copy constructed with user provided name. return opContext.getSession().getDirectoryService().getDnFactory().create( newDn.getName() ); } };
/** * Displays security warning messages if any possible secutiry issue is found. * @throws Exception if there are failures parsing and accessing internal structures */ protected void showSecurityWarnings() throws Exception { // Warn if the default password is not changed. boolean needToChangeAdminPassword = false; Dn adminDn = getDnFactory().create( ServerDNConstants.ADMIN_SYSTEM_DN ); Entry adminEntry = partitionNexus.lookup( new LookupOperationContext( adminSession, adminDn ) ); Value<?> userPassword = adminEntry.get( SchemaConstants.USER_PASSWORD_AT ).get(); needToChangeAdminPassword = Arrays.equals( PartitionNexus.ADMIN_PASSWORD_BYTES, userPassword.getBytes() ); if ( needToChangeAdminPassword ) { LOG.warn( "You didn't change the admin password of directory service " + "instance '" + instanceId + "'. " + "Please update the admin password as soon as possible " + "to prevent a possible security breach." ); } }
/** * Create a new instance of the producer replication manager. * * @param directoryService The directoryService instance * @throws Exception if we add an error while creating the configuration */ public ReplConsumerManager( DirectoryService directoryService ) throws Exception { this.directoryService = directoryService; adminSession = directoryService.getAdminSession(); schemaManager = directoryService.getSchemaManager(); replConsumerDn = directoryService.getDnFactory().create( REPL_CONSUMER_DN_STR ); adsReplLastSentCsn = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ADS_REPL_LAST_SENT_CSN ); PROVIDER_LOG.debug( "Starting the replication consumer manager" ); createConsumersBranch(); }
/** * Create a new Entry * * @param ldif The String representing the attributes, as a LDIF file * @param dn The Dn for this new entry */ public Entry newEntry( String ldif, String dn ) { try { Entry entry = readEntry( ldif ); Dn newDn = getDnFactory().create( dn ); entry.setDn( newDn ); // TODO Let's get rid of this Attributes crap Entry serverEntry = new DefaultEntry( schemaManager, entry ); return serverEntry; } catch ( Exception e ) { LOG.error( I18n.err( I18n.ERR_78, ldif, dn ) ); // do nothing return null; } }
Dn adminDn = dirService.getDnFactory().create( ServerDNConstants.ADMIN_SYSTEM_DN ); Entry adminEntry = dirService.getAdminSession().lookup( adminDn, SchemaConstants.ALL_USER_ATTRIBUTES, SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES );
/** * Store the new CSN sent by the consumer in place of the previous one. * * @param replica The consumer informations * @throws Exception If the update failed */ public void updateReplicaLastSentCsn( ReplicaEventLog replica ) throws Exception { Modification mod = modMap.get( replica.getId() ); Attribute lastSentCsnAt = null; if ( mod == null ) { mod = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, adsReplLastSentCsn, replica.getLastSentCsn() ); modMap.put( replica.getId(), mod ); } else { lastSentCsnAt = mod.getAttribute(); lastSentCsnAt.clear(); // clearing is mandatory lastSentCsnAt.add( replica.getLastSentCsn() ); } Dn dn = directoryService.getDnFactory().create( SchemaConstants.ADS_DS_REPLICA_ID + "=" + replica.getId() + "," + replConsumerDn ); adminSession.modify( dn, mod ); LOG.debug( "updated last sent CSN of consumer entry {}", dn ); PROVIDER_LOG.debug( "updated the LastSentCSN of consumer entry {}", dn ); }
subschemaSubentryDn = directoryService.getDnFactory().create( attr.getValue() );