/** * {@inheritDoc} */ @Override public ModifyRequest setName( Dn name ) { getDecorated().setName( name ); return this; }
/** * {@inheritDoc} */ @Override public ModifyRequest addModification( Attribute attr, ModificationOperation modOp ) { getDecorated().addModification( attr, modOp ); return this; }
/** * {@inheritDoc} */ @Override public Dn getName() { return getDecorated().getName(); }
/** * {@inheritDoc} */ @Override public void modify( Entry entry, ModificationOperation modOp ) throws LdapException { if ( entry == null ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04140_NULL_ENTRY_MODIFY ) ); } throw new IllegalArgumentException( I18n.err( I18n.ERR_04133_NULL_MODIFIED_ENTRY ) ); } ModifyRequest modReq = new ModifyRequestImpl(); modReq.setName( entry.getDn() ); Iterator<Attribute> itr = entry.iterator(); while ( itr.hasNext() ) { modReq.addModification( itr.next(), modOp ); } ModifyResponse modifyResponse = modify( modReq ); processResponse( modifyResponse ); }
( modifyRequestDecorator.getDecorated() ).setName( object ); LOG.error( I18n.err( I18n.ERR_05114_ERROR_MESSAGE, msg, ine.getMessage() ) ); ModifyResponseImpl response = new ModifyResponseImpl( modifyRequest.getMessageId() ); throw new ResponseCarryingException( msg, response, ResultCodeEnum.INVALID_DN_SYNTAX, Dn.EMPTY_DN, ine ); modifyRequest.setName( object ); LOG.debug( I18n.msg( I18n.MSG_05132_DN_MODIFICATION, modifyRequest.getName() ) );
/** * {@inheritDoc} */ @Override public void modify( Dn dn, Modification... modifications ) throws LdapException { if ( dn == null ) { LOG.debug( "received a null dn for modification" ); throw new IllegalArgumentException( "The Dn to be modified cannot be null" ); } if ( ( modifications == null ) || ( modifications.length == 0 ) ) { String msg = "Cannot process a ModifyRequest without any modification"; LOG.debug( msg ); throw new IllegalArgumentException( msg ); } int newId = messageId.incrementAndGet(); ModifyRequest modifyRequest = new ModifyRequestImpl(); modifyRequest.setMessageId( newId ); modifyRequest.setName( dn ); for ( Modification modification : modifications ) { modifyRequest.addModification( modification ); } ModifyResponse modifyResponse = modify( modifyRequest ); processResponse( modifyResponse ); }
modifyRequest.setName( userDn ); modifyRequest.addControl( ppolicyControl ); SchemaConstants.USER_PASSWORD_AT, oldPassword ); modifyRequest.addModification( modification ); modifyRequest.addModification( modification ); req.getMessageId(), ResultCodeEnum.SUCCESS ); ppolicyControl = modifyRequest.getResultResponse().getControl( PasswordPolicy.OID ); + userDn + ", exception : " + errorMessage ); ppolicyControl = modifyRequest.getResultResponse().getControl( PasswordPolicy.OID );
request.setName( new Dn( dn ) ); Modification[] modifications = convertModificationItems( modificationItems ); if ( modifications != null ) request.addModification( modification ); request.addAllControls( convertControls( controls ) );
if ( name != null && req.getName() == null ) if ( name == null && req.getName() != null ) if ( name != null && req.getName() != null && !name.equals( req.getName() ) ) if ( req.getModifications().size() != mods.size() ) Iterator<Modification> list = req.getModifications().iterator();
if ( modRequest.getName() == null ) modRequest.setMessageId( newId );
/** * {@inheritDoc} */ @Override public ModifyRequest replace( String attributeName ) { getDecorated().replace( attributeName ); return this; }
Dn dn = toDn(principalName); ModifyRequest modifyRequest = new ModifyRequestImpl(); modifyRequest.setName(dn); modifyRequest.replace(KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, "" + identity.getKeyVersion()); modifyRequest.replace(KerberosAttribute.KRB5_KEY_AT, keysInfo.getKeys()); modifyRequest.replace("krb5EncryptionType", keysInfo.getEtypes()); modifyRequest.replace(KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, identity.getPrincipalName()); modifyRequest.replace(KerberosAttribute.KRB5_ACCOUNT_EXPIRATION_TIME_AT, toGeneralizedTime(identity.getExpireTime())); modifyRequest.replace(KerberosAttribute.KRB5_ACCOUNT_DISABLED_AT, "" + identity.isDisabled()); modifyRequest.replace("krb5KDCFlags", "" + identity.getKdcFlags()); modifyRequest.replace(KerberosAttribute.KRB5_ACCOUNT_LOCKEDOUT_AT, "" + identity.isLocked()); connection.modify(modifyRequest);
LOG.error( msg ); ModifyResponseImpl response = new ModifyResponseImpl( modifyRequest.getMessageId() ); throw new ResponseCarryingException( msg, response, ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, modifyRequest.getName(), null );
@Override public ResultResponse process() throws PasswordException, LdapException { // Can't use Password Modify: // https://issues.apache.org/jira/browse/DIRSERVER-1935 // So revert to regular Modify MemoryClearingBuffer newPasswordBuffer = MemoryClearingBuffer.newInstance( newPassword ); try { ModifyRequest modifyRequest = new ModifyRequestImpl() .setName( userDn ) .replace( "userPassword", newPasswordBuffer.getComputedBytes() ) .addControl( passwordPolicyRequestControl ); return connection.modify( modifyRequest ); } finally { newPasswordBuffer.clear(); } } } );
/** * Creates a new instance of ModifyOperationContext. * * @param session The session to use * @param modifyRequest The ModifyRequest to process * @throws LdapException If the modify failed */ public ModifyOperationContext( CoreSession session, ModifyRequest modifyRequest ) throws LdapException { super( session, modifyRequest.getName() ); if ( session != null ) { setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.MODIFY ) ); } else { throw new LdapOperationErrorException( "Cannot proceed the operation with no session" ); } modItems = ServerEntryUtils.toServerModification( modifyRequest.getModifications().toArray( new DefaultModification[0] ), session.getDirectoryService().getSchemaManager() ); requestControls = modifyRequest.getControls(); if ( requestControls.containsKey( ManageDsaIT.OID ) ) { ignoreReferral(); } else { throwReferral(); } }
/** * {@inheritDoc} */ @Override public ModifyRequest remove( Attribute attr ) { getDecorated().remove( attr ); return this; }
/** * {@inheritDoc} */ public ModifyRequest add( String attributeName, byte[]... attributeValue ) { getDecorated().add( attributeName, attributeValue ); return this; }
/** * {@inheritDoc} */ @Override public Collection<Modification> getModifications() { return getDecorated().getModifications(); }
/** * {@inheritDoc} */ @Override public void action( LdapMessageContainer<ModifyRequestDecorator> container ) { // Now, we can allocate the ModifyRequest Object ModifyRequest internalModifyRequest = new ModifyRequestImpl(); internalModifyRequest.setMessageId( container.getMessageId() ); ModifyRequestDecorator modifyRequestDecorator = new ModifyRequestDecorator( container.getLdapCodecService(), internalModifyRequest ); container.setMessage( modifyRequestDecorator ); } }
abandon( modRequest.getMessageId() );