You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2007/12/29 03:53:40 UTC
svn commit: r607363 [3/3] - in /directory:
apacheds/branches/bigbang/core-entry/
apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/
apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/c...
Modified: directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java Fri Dec 28 18:53:20 2007
@@ -55,6 +55,12 @@
import org.apache.directory.server.core.schema.SchemaInterceptor;
import org.apache.directory.server.core.subtree.SubentryInterceptor;
import org.apache.directory.server.core.collective.CollectiveAttributeInterceptor;
+import org.apache.directory.server.core.entry.DefaultServerAttribute;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerBinaryValue;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerValue;
import org.apache.directory.server.core.event.EventInterceptor;
import org.apache.directory.server.core.trigger.TriggerInterceptor;
import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
@@ -64,6 +70,7 @@
import org.apache.directory.server.kerberos.shared.io.encoder.EncryptionKeyEncoder;
import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
import org.apache.directory.server.kerberos.shared.store.KerberosAttribute;
+import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapAuthenticationException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -127,47 +134,39 @@
{
LdapDN normName = addContext.getDn();
- Attributes entry = addContext.getEntry();
+ ServerEntry entry = addContext.getEntry();
- if ( entry.get( "userPassword" ) != null && entry.get( KerberosAttribute.PRINCIPAL ) != null )
+ if ( ( entry.get( SchemaConstants.USER_PASSWORD_AT ) != null ) &&
+ ( entry.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ) != null ) )
{
- log.debug( "Adding the entry '{}' for DN '{}'.", AttributeUtils.toString( entry ), normName.getUpName() );
+ log.debug( "Adding the entry '{}' for DN '{}'.", entry, normName.getUpName() );
- Object firstValue = entry.get( "userPassword" ).get();
+ ServerBinaryValue userPassword = (ServerBinaryValue)entry.get( SchemaConstants.USER_PASSWORD_AT ).get();
+ String strUserPassword = StringTools.utf8ToString( userPassword.get() );
- if ( firstValue instanceof String )
- {
- log.debug( "Adding Attribute id : 'userPassword', Values : [ '{}' ]", firstValue );
- }
- else if ( firstValue instanceof byte[] )
+ if ( log.isDebugEnabled() )
{
- String string = StringTools.utf8ToString( ( byte[] ) firstValue );
-
- if ( log.isDebugEnabled() )
- {
- StringBuffer sb = new StringBuffer();
- sb.append( "'" + string + "' ( " );
- sb.append( StringTools.dumpBytes( ( byte[] ) firstValue ).trim() );
- sb.append( " )" );
- log.debug( "Adding Attribute id : 'userPassword', Values : [ {} ]", sb.toString() );
- }
-
- firstValue = string;
+ StringBuffer sb = new StringBuffer();
+ sb.append( "'" + strUserPassword + "' ( " );
+ sb.append( userPassword );
+ sb.append( " )" );
+ log.debug( "Adding Attribute id : 'userPassword', Values : [ {} ]", sb.toString() );
}
- String userPassword = ( String ) firstValue;
- String principalName = ( String ) entry.get( KerberosAttribute.PRINCIPAL ).get();
+ ServerValue<?> principalNameValue = entry.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ).get();
+
+ String principalName = (String)principalNameValue.get();
- log.debug( "Got principal '{}' with userPassword '{}'.", principalName, userPassword );
+ log.debug( "Got principal '{}' with userPassword '{}'.", principalName, strUserPassword );
- Map<EncryptionType, EncryptionKey> keys = generateKeys( principalName, userPassword );
+ Map<EncryptionType, EncryptionKey> keys = generateKeys( principalName, strUserPassword );
- entry.put( KerberosAttribute.PRINCIPAL, principalName );
- entry.put( KerberosAttribute.VERSION, Integer.toString( 0 ) );
+ entry.put( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principalName );
+ entry.put( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, "0" );
- entry.put( getKeyAttribute( keys ) );
+ entry.put( getKeyAttribute( addContext.getRegistries(), keys ) );
- log.debug( "Adding modified entry '{}' for DN '{}'.", AttributeUtils.toString( entry ), normName
+ log.debug( "Adding modified entry '{}' for DN '{}'.", entry, normName
.getUpName() );
}
@@ -245,7 +244,7 @@
Attribute attr = mod.getAttribute();
String attrId = attr.getID();
- if ( attrId.equalsIgnoreCase( "userPassword" ) )
+ if ( attrId.equalsIgnoreCase( SchemaConstants.USER_PASSWORD_AT ) )
{
Object firstValue = attr.get();
@@ -273,7 +272,7 @@
log.debug( "Got userPassword '{}'.", subContext.getUserPassword() );
}
- if ( attrId.equalsIgnoreCase( KerberosAttribute.PRINCIPAL ) )
+ if ( attrId.equalsIgnoreCase( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ) )
{
subContext.setPrincipalName( ( String ) attr.get() );
log.debug( "Got principal '{}'.", subContext.getPrincipalName() );
@@ -299,7 +298,7 @@
Attributes userEntry;
LookupOperationContext lookupContext = new LookupOperationContext( new String[]
- { SchemaConstants.OBJECT_CLASS_AT, KerberosAttribute.PRINCIPAL, KerberosAttribute.VERSION } );
+ { SchemaConstants.OBJECT_CLASS_AT, KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT } );
lookupContext.setDn( principalDn );
userEntry = proxy.lookup( lookupContext, USERLOOKUP_BYPASS );
@@ -323,13 +322,13 @@
if ( subContext.getPrincipalName() == null )
{
- Attribute principalAttribute = userEntry.get( KerberosAttribute.PRINCIPAL );
+ Attribute principalAttribute = userEntry.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT );
String principalName = ( String ) principalAttribute.get();
subContext.setPrincipalName( principalName );
log.debug( "Found principal '{}' from lookup.", principalName );
}
- Attribute keyVersionNumberAttr = userEntry.get( KerberosAttribute.VERSION );
+ Attribute keyVersionNumberAttr = userEntry.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT );
if ( keyVersionNumberAttr == null )
{
@@ -354,7 +353,7 @@
* @param modContext
* @param subContext
*/
- void deriveKeys( ModifyOperationContext modContext, ModifySubContext subContext )
+ void deriveKeys( ModifyOperationContext modContext, ModifySubContext subContext ) throws NamingException
{
List<ModificationItemImpl> mods = modContext.getModItems();
@@ -376,18 +375,22 @@
// Add our modification items.
newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, new AttributeImpl(
- KerberosAttribute.PRINCIPAL, principalName ) ) );
+ KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principalName ) ) );
newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, new AttributeImpl(
- KerberosAttribute.VERSION, Integer.toString( kvno ) ) ) );
- newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, getKeyAttribute( keys ) ) );
+ KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, Integer.toString( kvno ) ) ) );
+
+ Attribute attribute = ServerEntryUtils.toAttributeImpl( getKeyAttribute( modContext.getRegistries(), keys ) );
+ newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attribute ) );
modContext.setModItems( newModsList );
}
- private Attribute getKeyAttribute( Map<EncryptionType, EncryptionKey> keys )
+ private ServerAttribute getKeyAttribute( Registries registries, Map<EncryptionType, EncryptionKey> keys ) throws NamingException
{
- Attribute keyAttribute = new AttributeImpl( KerberosAttribute.KEY );
+ ServerAttribute keyAttribute =
+ new DefaultServerAttribute( KerberosAttribute.KRB5_KEY_AT,
+ registries.getAttributeTypeRegistry().lookup( KerberosAttribute.KRB5_KEY_AT ) );
Iterator<EncryptionKey> it = keys.values().iterator();
Modified: directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java Fri Dec 28 18:53:20 2007
@@ -20,6 +20,9 @@
package org.apache.directory.server.core.kerberos;
+import org.apache.directory.server.core.entry.ServerBinaryValue;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerStringValue;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.Interceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -28,14 +31,12 @@
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
import org.apache.directory.shared.ldap.util.StringTools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
import javax.naming.directory.ModificationItem;
import java.util.ArrayList;
@@ -70,48 +71,36 @@
{
LdapDN normName = addContext.getDn();
- Attributes entry = addContext.getEntry();
+ ServerEntry entry = addContext.getEntry();
- log.debug( "Adding the entry '{}' for DN '{}'.", AttributeUtils.toString( entry ), normName.getUpName() );
-
- Object attr = null;
+ log.debug( "Adding the entry '{}' for DN '{}'.", entry, normName.getUpName() );
if ( entry.get( SchemaConstants.USER_PASSWORD_AT ) != null )
{
- String userPassword = "";
- String username = "";
-
- attr = entry.get( SchemaConstants.USER_PASSWORD_AT ).get();
+ String username = null;
- if ( attr instanceof String )
- {
- log.debug( "Adding Attribute id : 'userPassword', Values : [ '{}' ]", attr );
- userPassword = ( String ) attr;
- }
- else if ( attr instanceof byte[] )
- {
- String string = StringTools.utf8ToString( ( byte[] ) attr );
+ ServerBinaryValue userPassword = (ServerBinaryValue)entry.get( SchemaConstants.USER_PASSWORD_AT ).get();
- if ( log.isDebugEnabled() )
- {
- StringBuffer sb = new StringBuffer();
- sb.append( "'" + string + "' ( " );
- sb.append( StringTools.dumpBytes( ( byte[] ) attr ).trim() );
- sb.append( " )" );
- log.debug( "Adding Attribute id : 'userPassword', Values : [ {} ]", sb.toString() );
- }
+ // The password is stored in a non H/R attribute, but it's a String
+ String strUserPassword = StringTools.utf8ToString( userPassword.get() );
- userPassword = string;
+ if ( log.isDebugEnabled() )
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append( "'" + strUserPassword + "' ( " );
+ sb.append( userPassword );
+ sb.append( " )" );
+ log.debug( "Adding Attribute id : 'userPassword', Values : [ {} ]", sb.toString() );
}
if ( entry.get( SchemaConstants.CN_AT ) != null )
{
- attr = entry.get( SchemaConstants.CN_AT ).get();
- username = ( String ) attr;
+ ServerStringValue attr = (ServerStringValue)entry.get( SchemaConstants.CN_AT ).get();
+ username = attr.get();
}
// If userPassword fails checks, throw new NamingException.
- check( username, userPassword );
+ check( username, strUserPassword );
}
next.add( addContext );
Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/KerberosAttribute.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/KerberosAttribute.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/KerberosAttribute.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/KerberosAttribute.java Fri Dec 28 18:53:20 2007
@@ -29,19 +29,33 @@
// ------------------------------------------------------------------------
// Krb5 Schema Attributes
// ------------------------------------------------------------------------
-
- /** the krb5kdc schema key for a krb5KDCEntry */
- public static final String KEY = "krb5Key";
/** the krb5kdc schema principal name for a krb5KDCEntry */
- public static final String PRINCIPAL = "krb5PrincipalName";
+ public static final String KRB5_PRINCIPAL_NAME_AT = "krb5PrincipalName";
+ public static final String KRB5_PRINCIPAL_NAME_AT_OID = "1.3.6.1.4.1.5322.10.1.1";
+
+ /** the krb5kdc schema key for a krb5KDCEntry */
+ public static final String KRB5_KEY_AT = "krb5Key";
+ public static final String KRB5_KEY_AT_OID = "1.3.6.1.4.1.5322.10.1.10";
+
/** the krb5kdc schema key version identifier for a krb5KDCEntry */
- public static final String VERSION = "krb5KeyVersionNumber";
- /** the Apache specific SAM type attribute */
- public static final String SAM_TYPE = "apacheSamType";
+ public static final String KRB5_KEY_VERSION_NUMBER_AT = "krb5KeyVersionNumber";
+ public static final String KRB5_KEY_VERSION_NUMBER_AT_OID = "1.3.6.1.4.1.5322.10.1.2";
+
/** the disabled boolean LDAP attribute for a Kerberos account */
- public static final String ACCOUNT_DISABLED = "krb5AccountDisabled";
+ public static final String KRB5_ACCOUNT_DISABLED_AT = "krb5AccountDisabled";
+ public static final String KRB5_ACCOUNT_DISABLED_AT_OID = "1.3.6.1.4.1.5322.10.1.13";
+
/** the lockedout boolean LDAP attribute for a Kerberos account */
- public static final String ACCOUNT_LOCKEDOUT = "krb5AccountLockedOut";
+ public static final String KRB5_ACCOUNT_LOCKEDOUT_AT = "krb5AccountLockedOut";
+ public static final String KRB5_ACCOUNT_LOCKEDOUT_AT_OID = "1.3.6.1.4.1.5322.10.1.14";
+
/** the expiration time attribute LDAP attribute for a Kerberos account */
- public static final String ACCOUNT_EXPIRATION_TIME = "krb5AccountExpirationTime";
+ public static final String KRB5_ACCOUNT_EXPIRATION_TIME_AT = "krb5AccountExpirationTime";
+ public static final String KRB5_ACCOUNT_EXPIRATION_TIME_AT_OID = "1.3.6.1.4.1.5322.10.1.15";
+
+
+ /** the Apache specific SAM type attribute */
+ public static final String APACHE_SAM_TYPE_AT = "apacheSamType";
+ public static final String APACHE_SAM_TYPE_AT_OID = "1.3.6.1.4.1.18060.0.4.1.2.9";
+
}
Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/ChangePassword.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/ChangePassword.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/ChangePassword.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/ChangePassword.java Fri Dec 28 18:53:20 2007
@@ -34,6 +34,7 @@
import org.apache.directory.server.kerberos.shared.store.KerberosAttribute;
import org.apache.directory.server.protocol.shared.store.ContextOperation;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
@@ -76,7 +77,7 @@
}
ModificationItemImpl[] mods = new ModificationItemImpl[2];
- Attribute newPasswordAttribute = new AttributeImpl( "userPassword", newPassword );
+ Attribute newPasswordAttribute = new AttributeImpl( SchemaConstants.USER_PASSWORD_AT, newPassword );
mods[0] = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, newPasswordAttribute );
Attribute principalAttribute = new AttributeImpl( "krb5PrincipalName", principal.getName() );
mods[1] = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, principalAttribute );
@@ -94,16 +95,16 @@
private String search( DirContext ctx, String principal ) throws NamingException
{
String[] attrIDs =
- { KerberosAttribute.PRINCIPAL, KerberosAttribute.VERSION, KerberosAttribute.KEY };
+ { KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, KerberosAttribute.KRB5_KEY_AT };
Attributes matchAttrs = new AttributesImpl( true );
- matchAttrs.put( new AttributeImpl( KerberosAttribute.PRINCIPAL, principal ) );
+ matchAttrs.put( new AttributeImpl( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principal ) );
- NamingEnumeration answer = ctx.search( "", matchAttrs, attrIDs );
+ NamingEnumeration<SearchResult> answer = ctx.search( "", matchAttrs, attrIDs );
if ( answer.hasMore() )
{
- SearchResult sr = ( SearchResult ) answer.next();
+ SearchResult sr = answer.next();
if ( sr != null )
{
return sr.getName();
Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/DeletePrincipal.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/DeletePrincipal.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/DeletePrincipal.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/DeletePrincipal.java Fri Dec 28 18:53:20 2007
@@ -91,17 +91,17 @@
private String search( DirContext ctx, Name searchBaseDn, String principal ) throws NamingException
{
String[] attrIDs =
- { KerberosAttribute.PRINCIPAL, KerberosAttribute.VERSION, KerberosAttribute.KEY };
+ { KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, KerberosAttribute.KRB5_KEY_AT };
Attributes matchAttrs = new AttributesImpl( true );
- matchAttrs.put( new AttributeImpl( KerberosAttribute.PRINCIPAL, principal ) );
+ matchAttrs.put( new AttributeImpl( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principal ) );
// Search for objects that have those matching attributes
- NamingEnumeration answer = ctx.search( searchBaseDn, matchAttrs, attrIDs );
+ NamingEnumeration<SearchResult> answer = ctx.search( searchBaseDn, matchAttrs, attrIDs );
if ( answer.hasMore() )
{
- SearchResult sr = ( SearchResult ) answer.next();
+ SearchResult sr = answer.next();
if ( sr != null )
{
return sr.getName();
Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetAllPrincipals.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetAllPrincipals.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetAllPrincipals.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetAllPrincipals.java Fri Dec 28 18:53:20 2007
@@ -70,11 +70,11 @@
{
Attributes attrs = null;
- NamingEnumeration answer = ctx.search( searchBaseDn, filter, controls );
+ NamingEnumeration<SearchResult> answer = ctx.search( searchBaseDn, filter, controls );
while ( answer.hasMore() )
{
- SearchResult result = ( SearchResult ) answer.next();
+ SearchResult result = answer.next();
attrs = result.getAttributes();
PrincipalStoreEntry entry = getEntry( attrs );
answers.add( entry );
@@ -106,21 +106,21 @@
{
PrincipalStoreEntryModifier modifier = new PrincipalStoreEntryModifier();
- String principal = ( String ) attrs.get( KerberosAttribute.PRINCIPAL ).get();
- String keyVersionNumber = ( String ) attrs.get( KerberosAttribute.VERSION ).get();
+ String principal = ( String ) attrs.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ).get();
+ String keyVersionNumber = ( String ) attrs.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ).get();
String commonName = ( String ) attrs.get( SchemaConstants.CN_AT ).get();
- if ( attrs.get( "apacheSamType" ) != null )
+ if ( attrs.get( KerberosAttribute.APACHE_SAM_TYPE_AT ) != null )
{
- String samType = ( String ) attrs.get( "apacheSamType" ).get();
+ String samType = ( String ) attrs.get( KerberosAttribute.APACHE_SAM_TYPE_AT ).get();
modifier.setSamType( SamType.getTypeByOrdinal( Integer.parseInt( samType ) ) );
}
- if ( attrs.get( KerberosAttribute.KEY ) != null )
+ if ( attrs.get( KerberosAttribute.KRB5_KEY_AT ) != null )
{
- Attribute krb5key = attrs.get( KerberosAttribute.KEY );
+ Attribute krb5key = attrs.get( KerberosAttribute.KRB5_KEY_AT );
try
{
Map<EncryptionType, EncryptionKey> keyMap = modifier.reconstituteKeyMap( krb5key );
@@ -128,7 +128,7 @@
}
catch ( IOException ioe )
{
- throw new InvalidAttributeValueException( "Account Kerberos key attribute '" + KerberosAttribute.KEY
+ throw new InvalidAttributeValueException( "Account Kerberos key attribute '" + KerberosAttribute.KRB5_KEY_AT
+ "' contained an invalid value for krb5key." );
}
}
Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetPrincipal.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetPrincipal.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetPrincipal.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetPrincipal.java Fri Dec 28 18:53:20 2007
@@ -83,22 +83,26 @@
}
String[] attrIDs =
- { KerberosAttribute.PRINCIPAL, KerberosAttribute.VERSION, KerberosAttribute.KEY,
- KerberosAttribute.SAM_TYPE, KerberosAttribute.ACCOUNT_DISABLED,
- KerberosAttribute.ACCOUNT_EXPIRATION_TIME, KerberosAttribute.ACCOUNT_LOCKEDOUT };
+ { KerberosAttribute.KRB5_PRINCIPAL_NAME_AT,
+ KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT,
+ KerberosAttribute.KRB5_KEY_AT,
+ KerberosAttribute.APACHE_SAM_TYPE_AT,
+ KerberosAttribute.KRB5_ACCOUNT_DISABLED_AT,
+ KerberosAttribute.KRB5_ACCOUNT_EXPIRATION_TIME_AT,
+ KerberosAttribute.KRB5_ACCOUNT_LOCKEDOUT_AT };
Attributes matchAttrs = new AttributesImpl( true );
- matchAttrs.put( new AttributeImpl( KerberosAttribute.PRINCIPAL, principal.getName() ) );
+ matchAttrs.put( new AttributeImpl( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principal.getName() ) );
PrincipalStoreEntry entry = null;
try
{
- NamingEnumeration answer = ctx.search( "", matchAttrs, attrIDs );
+ NamingEnumeration<SearchResult> answer = ctx.search( "", matchAttrs, attrIDs );
if ( answer.hasMore() )
{
- SearchResult result = ( SearchResult ) answer.next();
+ SearchResult result = answer.next();
Attributes attrs = result.getAttributes();
@@ -134,27 +138,27 @@
modifier.setDistinguishedName( distinguishedName );
- String principal = ( String ) attrs.get( KerberosAttribute.PRINCIPAL ).get();
+ String principal = ( String ) attrs.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ).get();
modifier.setPrincipal( new KerberosPrincipal( principal ) );
- String keyVersionNumber = ( String ) attrs.get( KerberosAttribute.VERSION ).get();
+ String keyVersionNumber = ( String ) attrs.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ).get();
modifier.setKeyVersionNumber( Integer.parseInt( keyVersionNumber ) );
- if ( attrs.get( KerberosAttribute.ACCOUNT_DISABLED ) != null )
+ if ( attrs.get( KerberosAttribute.KRB5_ACCOUNT_DISABLED_AT ) != null )
{
- String val = ( String ) attrs.get( KerberosAttribute.ACCOUNT_DISABLED ).get();
+ String val = ( String ) attrs.get( KerberosAttribute.KRB5_ACCOUNT_DISABLED_AT ).get();
modifier.setDisabled( "true".equalsIgnoreCase( val ) );
}
- if ( attrs.get( KerberosAttribute.ACCOUNT_LOCKEDOUT ) != null )
+ if ( attrs.get( KerberosAttribute.KRB5_ACCOUNT_LOCKEDOUT_AT ) != null )
{
- String val = ( String ) attrs.get( KerberosAttribute.ACCOUNT_LOCKEDOUT ).get();
+ String val = ( String ) attrs.get( KerberosAttribute.KRB5_ACCOUNT_LOCKEDOUT_AT ).get();
modifier.setLockedOut( "true".equalsIgnoreCase( val ) );
}
- if ( attrs.get( KerberosAttribute.ACCOUNT_EXPIRATION_TIME ) != null )
+ if ( attrs.get( KerberosAttribute.KRB5_ACCOUNT_EXPIRATION_TIME_AT ) != null )
{
- String val = ( String ) attrs.get( KerberosAttribute.ACCOUNT_EXPIRATION_TIME ).get();
+ String val = ( String ) attrs.get( KerberosAttribute.KRB5_ACCOUNT_EXPIRATION_TIME_AT ).get();
try
{
modifier.setExpiration( KerberosTime.getTime( val ) );
@@ -162,20 +166,20 @@
catch ( ParseException e )
{
throw new InvalidAttributeValueException( "Account expiration attribute "
- + KerberosAttribute.ACCOUNT_EXPIRATION_TIME + " contained an invalid value for generalizedTime: "
+ + KerberosAttribute.KRB5_ACCOUNT_EXPIRATION_TIME_AT + " contained an invalid value for generalizedTime: "
+ val );
}
}
- if ( attrs.get( KerberosAttribute.SAM_TYPE ) != null )
+ if ( attrs.get( KerberosAttribute.APACHE_SAM_TYPE_AT ) != null )
{
- String samType = ( String ) attrs.get( KerberosAttribute.SAM_TYPE ).get();
+ String samType = ( String ) attrs.get( KerberosAttribute.APACHE_SAM_TYPE_AT ).get();
modifier.setSamType( SamType.getTypeByOrdinal( Integer.parseInt( samType ) ) );
}
- if ( attrs.get( KerberosAttribute.KEY ) != null )
+ if ( attrs.get( KerberosAttribute.KRB5_KEY_AT ) != null )
{
- Attribute krb5key = attrs.get( KerberosAttribute.KEY );
+ Attribute krb5key = attrs.get( KerberosAttribute.KRB5_KEY_AT );
try
{
Map<EncryptionType, EncryptionKey> keyMap = modifier.reconstituteKeyMap( krb5key );
@@ -183,7 +187,7 @@
}
catch ( IOException ioe )
{
- throw new InvalidAttributeValueException( "Account Kerberos key attribute '" + KerberosAttribute.KEY
+ throw new InvalidAttributeValueException( "Account Kerberos key attribute '" + KerberosAttribute.KRB5_KEY_AT
+ "' contained an invalid value for krb5key." );
}
}
Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalObjectFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalObjectFactory.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalObjectFactory.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalObjectFactory.java Fri Dec 28 18:53:20 2007
@@ -62,12 +62,12 @@
modifier.setUserId( ( String ) attrs.get( SchemaConstants.UID_AT ).get() );
modifier.setCommonName( ( String ) attrs.get( SchemaConstants.CN_AT ).get() );
- KerberosPrincipal principal = new KerberosPrincipal( ( String ) attrs.get( KerberosAttribute.PRINCIPAL ).get() );
+ KerberosPrincipal principal = new KerberosPrincipal( ( String ) attrs.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ).get() );
modifier.setPrincipal( principal );
- if ( attrs.get( KerberosAttribute.KEY ) != null )
+ if ( attrs.get( KerberosAttribute.KRB5_KEY_AT ) != null )
{
- Attribute krb5key = attrs.get( KerberosAttribute.KEY );
+ Attribute krb5key = attrs.get( KerberosAttribute.KRB5_KEY_AT );
try
{
Map<EncryptionType, EncryptionKey> keyMap = modifier.reconstituteKeyMap( krb5key );
@@ -75,12 +75,12 @@
}
catch ( IOException ioe )
{
- throw new InvalidAttributeValueException( "Account Kerberos key attribute '" + KerberosAttribute.KEY
+ throw new InvalidAttributeValueException( "Account Kerberos key attribute '" + KerberosAttribute.KRB5_KEY_AT
+ "' contained an invalid value for krb5key." );
}
}
- modifier.setKeyVersionNumber( Integer.parseInt( ( String ) attrs.get( KerberosAttribute.VERSION ).get() ) );
+ modifier.setKeyVersionNumber( Integer.parseInt( ( String ) attrs.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ).get() ) );
return modifier.getEntry();
}
Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalStateFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalStateFactory.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalStateFactory.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalStateFactory.java Fri Dec 28 18:53:20 2007
@@ -101,7 +101,7 @@
if ( !AttributeUtils.containsValueCaseIgnore( oc, SchemaConstants.EXTENSIBLE_OBJECT_OC ) )
{
oc.add( SchemaConstants.EXTENSIBLE_OBJECT_OC );
- outAttrs.put( "apacheSamType", "7" );
+ outAttrs.put( KerberosAttribute.APACHE_SAM_TYPE_AT, "7" );
}
if ( !( AttributeUtils.containsValueCaseIgnore( oc, SchemaConstants.PERSON_OC ) || oc
@@ -141,7 +141,7 @@
try
{
- outAttrs.put( KerberosAttribute.KEY, EncryptionKeyEncoder.encode( encryptionKey ) );
+ outAttrs.put( KerberosAttribute.KRB5_KEY_AT, EncryptionKeyEncoder.encode( encryptionKey ) );
}
catch ( IOException ioe )
{
@@ -150,8 +150,8 @@
int keyVersion = encryptionKey.getKeyVersion();
- outAttrs.put( KerberosAttribute.PRINCIPAL, principal );
- outAttrs.put( KerberosAttribute.VERSION, Integer.toString( keyVersion ) );
+ outAttrs.put( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principal );
+ outAttrs.put( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, Integer.toString( keyVersion ) );
}
Result r = new Result( obj, outAttrs );
Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java Fri Dec 28 18:53:20 2007
@@ -23,6 +23,7 @@
import org.apache.directory.mitosis.common.CSN;
import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -61,11 +62,11 @@
}
- protected void execute1( PartitionNexus nexus ) throws NamingException
+ protected void execute1( PartitionNexus nexus, Registries registries ) throws NamingException
{
Attributes attrs = new AttributesImpl( true );
attrs.put( getAttribute() );
List<ModificationItemImpl> items = ModifyOperationContext.createModItems( attrs, DirContext.ADD_ATTRIBUTE );
- nexus.modify( new ModifyOperationContext( getName(), items ) );
+ nexus.modify( new ModifyOperationContext( registries, getName(), items ) );
}
}
Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java Fri Dec 28 18:53:20 2007
@@ -28,12 +28,13 @@
import org.apache.directory.mitosis.common.CSN;
import org.apache.directory.mitosis.operation.support.EntryUtil;
import org.apache.directory.mitosis.store.ReplicationStore;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
import org.apache.directory.server.core.interceptor.context.ListOperationContext;
import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -73,7 +74,7 @@
}
- protected void execute0( PartitionNexus nexus, ReplicationStore store, AttributeTypeRegistry registry )
+ protected void execute0( PartitionNexus nexus, ReplicationStore store, Registries registries )
throws NamingException
{
if ( !EntryUtil.isEntryUpdatable( nexus, normalizedName, getCSN() ) )
@@ -81,22 +82,22 @@
return;
}
- EntryUtil.createGlueEntries( nexus, normalizedName, false );
+ EntryUtil.createGlueEntries( registries, nexus, normalizedName, false );
// Replace the entry if an entry with the same name exists.
Attributes oldEntry = nexus.lookup( new LookupOperationContext( normalizedName ) );
if ( oldEntry != null )
{
- recursiveDelete( nexus, normalizedName, registry );
+ recursiveDelete( nexus, normalizedName, registries );
}
- nexus.add( new AddOperationContext( normalizedName, entry ) );
+ nexus.add( new AddOperationContext( registries, normalizedName, ServerEntryUtils.toServerEntry( entry, normalizedName, registries ) ) );
}
@SuppressWarnings("unchecked")
- private void recursiveDelete( PartitionNexus nexus, LdapDN normalizedName, AttributeTypeRegistry registry )
+ private void recursiveDelete( PartitionNexus nexus, LdapDN normalizedName, Registries registries )
throws NamingException
{
NamingEnumeration<SearchResult> ne = nexus.list( new ListOperationContext( normalizedName ) );
@@ -110,8 +111,8 @@
{
SearchResult sr = ne.next();
LdapDN dn = new LdapDN( sr.getName() );
- dn.normalize( registry.getNormalizerMapping() );
- recursiveDelete( nexus, dn, registry );
+ dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+ recursiveDelete( nexus, dn, registries );
}
nexus.delete( new DeleteOperationContext( normalizedName ) );
Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java Fri Dec 28 18:53:20 2007
@@ -24,7 +24,7 @@
import javax.naming.directory.Attribute;
import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.mitosis.common.CSN;
import org.apache.directory.mitosis.operation.support.EntryUtil;
@@ -78,20 +78,20 @@
}
- protected final void execute0( PartitionNexus nexus, ReplicationStore store, AttributeTypeRegistry registry )
+ protected final void execute0( PartitionNexus nexus, ReplicationStore store, Registries registries )
throws NamingException
{
if ( !EntryUtil.isEntryUpdatable( nexus, name, getCSN() ) )
{
return;
}
- EntryUtil.createGlueEntries( nexus, name, true );
+ EntryUtil.createGlueEntries( registries, nexus, name, true );
- execute1( nexus );
+ execute1( nexus, registries );
}
- protected abstract void execute1( PartitionNexus nexus ) throws NamingException;
+ protected abstract void execute1( PartitionNexus nexus, Registries registries ) throws NamingException;
/**
Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java Fri Dec 28 18:53:20 2007
@@ -29,7 +29,7 @@
import org.apache.directory.mitosis.store.ReplicationStore;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.server.schema.registries.Registries;
import javax.naming.Name;
import javax.naming.NamingException;
@@ -160,12 +160,12 @@
}
- protected void execute0( PartitionNexus nexus, ReplicationStore store, AttributeTypeRegistry registry )
+ protected void execute0( PartitionNexus nexus, ReplicationStore store, Registries registries )
throws NamingException
{
for ( Operation op : children )
{
- op.execute( nexus, DUMMY_STORE, registry );
+ op.execute( nexus, DUMMY_STORE, registries );
}
}
Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java Fri Dec 28 18:53:20 2007
@@ -23,6 +23,7 @@
import org.apache.directory.mitosis.common.CSN;
import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -61,12 +62,12 @@
}
- protected void execute1( PartitionNexus nexus ) throws NamingException
+ protected void execute1( PartitionNexus nexus, Registries registries ) throws NamingException
{
Attributes attrs = new AttributesImpl( true );
attrs.put( getAttribute() );
List<ModificationItemImpl> items = ModifyOperationContext.createModItems( attrs, DirContext.REMOVE_ATTRIBUTE );
- nexus.modify( new ModifyOperationContext( getName(), items ) );
+ nexus.modify( new ModifyOperationContext( registries, getName(), items ) );
}
}
Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/Operation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/Operation.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/Operation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/Operation.java Fri Dec 28 18:53:20 2007
@@ -30,7 +30,7 @@
import org.apache.directory.mitosis.store.ReplicationStore;
import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -100,18 +100,18 @@
/**
* Exeutes this operation on the specified nexus.
*/
- public final void execute( PartitionNexus nexus, ReplicationStore store, AttributeTypeRegistry registry )
+ public final void execute( PartitionNexus nexus, ReplicationStore store, Registries registries )
throws NamingException
{
synchronized ( nexus )
{
- execute0( nexus, store, registry );
+ execute0( nexus, store, registries );
store.putLog( this );
}
}
@SuppressWarnings("unused")
- protected void execute0( PartitionNexus nexus, ReplicationStore store, AttributeTypeRegistry registry )
+ protected void execute0( PartitionNexus nexus, ReplicationStore store, Registries registries )
throws NamingException
{
throw new OperationNotSupportedException( nexus.getSuffixDn().toString() );
Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java Fri Dec 28 18:53:20 2007
@@ -23,6 +23,7 @@
import org.apache.directory.mitosis.common.CSN;
import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -63,12 +64,12 @@
}
- protected void execute1( PartitionNexus nexus ) throws NamingException
+ protected void execute1( PartitionNexus nexus, Registries registries ) throws NamingException
{
Attributes attrs = new AttributesImpl( true );
attrs.put( getAttribute() );
List<ModificationItemImpl> items = ModifyOperationContext.createModItems( attrs, DirContext.REPLACE_ATTRIBUTE );
- nexus.modify( new ModifyOperationContext( getName(), items ) );
+ nexus.modify( new ModifyOperationContext( registries, getName(), items ) );
}
}
Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java Fri Dec 28 18:53:20 2007
@@ -25,15 +25,18 @@
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.util.NamespaceTools;
+import org.apache.directory.shared.ldap.util.StringTools;
import org.apache.directory.mitosis.common.CSN;
import org.apache.directory.mitosis.common.Constants;
import org.apache.directory.mitosis.common.DefaultCSN;
@@ -63,7 +66,16 @@
try
{
- oldCSN = new DefaultCSN( String.valueOf( entryCSNAttr.get() ) );
+ Object val = entryCSNAttr.get();
+
+ if ( val instanceof byte[] )
+ {
+ oldCSN = new DefaultCSN( StringTools.utf8ToString( (byte[])val ) );
+ }
+ else
+ {
+ oldCSN = new DefaultCSN( (String)val );
+ }
}
catch ( IllegalArgumentException e )
{
@@ -75,24 +87,24 @@
}
- public static void createGlueEntries( PartitionNexus nexus, LdapDN name, boolean includeLeaf )
+ public static void createGlueEntries( Registries registries, PartitionNexus nexus, LdapDN name, boolean includeLeaf )
throws NamingException
{
assert name.size() > 0;
for ( int i = name.size() - 1; i > 0; i-- )
{
- createGlueEntry( nexus, ( LdapDN ) name.getSuffix( i ) );
+ createGlueEntry( registries, nexus, ( LdapDN ) name.getSuffix( i ) );
}
if ( includeLeaf )
{
- createGlueEntry( nexus, name );
+ createGlueEntry( registries, nexus, name );
}
}
- private static void createGlueEntry( PartitionNexus nexus, LdapDN name ) throws NamingException
+ private static void createGlueEntry( Registries registries, PartitionNexus nexus, LdapDN name ) throws NamingException
{
try
{
@@ -123,7 +135,7 @@
entry.put( objectClassAttr );
// And add it to the nexus.
- nexus.add( new AddOperationContext( name, entry ) );
+ nexus.add( new AddOperationContext( registries, name, ServerEntryUtils.toServerEntry( entry, name, registries ) ) );
}
Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java Fri Dec 28 18:53:20 2007
@@ -33,6 +33,7 @@
import org.apache.directory.mitosis.service.protocol.handler.ReplicationServerProtocolHandler;
import org.apache.directory.mitosis.store.ReplicationStore;
import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.Interceptor;
@@ -51,6 +52,7 @@
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -163,7 +165,7 @@
private ReplicationStore store;
private IoAcceptor registry;
private final ClientConnectionManager clientConnectionManager = new ClientConnectionManager( this );
- private AttributeTypeRegistry attrRegistry;
+ private Registries registries;
public ReplicationInterceptor()
@@ -198,10 +200,10 @@
configuration.validate();
// and then preserve frequently used ones
this.directoryService = directoryService;
+ registries = directoryService.getRegistries();
nexus = directoryService.getPartitionNexus();
store = configuration.getStore();
operationFactory = new OperationFactory( directoryService, configuration );
- attrRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
// Initialize store and service
store.open( directoryService, configuration );
@@ -340,7 +342,7 @@
contextName = new LdapDN( String.valueOf( value ) );
}
- contextName.normalize( attrRegistry.getNormalizerMapping() );
+ contextName.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
LOG.info( "[Replica-{}] Purging aged data under '{}'", configuration.getReplicaId(), contextName );
purgeAgedData( contextName, filter );
}
@@ -381,7 +383,7 @@
{
try
{
- name.normalize( attrRegistry.getNormalizerMapping() );
+ name.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
Attributes entry = nexus.lookup( new LookupOperationContext( name ) );
LOG.info( "[Replica-{}] Purge: " + name + " (" + entry + ')', configuration.getReplicaId() );
nexus.delete( new DeleteOperationContext( name ) );
@@ -396,8 +398,8 @@
public void add( NextInterceptor nextInterceptor, AddOperationContext addContext ) throws NamingException
{
- Operation op = operationFactory.newAdd( addContext.getDn(), addContext.getEntry() );
- op.execute( nexus, store, attrRegistry );
+ Operation op = operationFactory.newAdd( addContext.getDn(), ServerEntryUtils.toAttributesImpl( addContext.getEntry() ) );
+ op.execute( nexus, store, registries );
}
@@ -405,14 +407,14 @@
public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws NamingException
{
Operation op = operationFactory.newDelete( opContext.getDn() );
- op.execute( nexus, store, attrRegistry );
+ op.execute( nexus, store, registries );
}
public void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws NamingException
{
Operation op = operationFactory.newModify( modifyContext );
- op.execute( nexus, store, attrRegistry );
+ op.execute( nexus, store, registries );
}
@@ -420,7 +422,7 @@
public void move( NextInterceptor next, MoveOperationContext moveOpContext ) throws NamingException
{
Operation op = operationFactory.newMove( moveOpContext.getDn(), moveOpContext.getParent() );
- op.execute( nexus, store, attrRegistry );
+ op.execute( nexus, store, registries );
}
@@ -430,7 +432,7 @@
Operation op = operationFactory.newMove( moveAndRenameOpContext.getDn(),
moveAndRenameOpContext.getParent(), moveAndRenameOpContext.getNewRdn(),
moveAndRenameOpContext.getDelOldDn() );
- op.execute( nexus, store, attrRegistry );
+ op.execute( nexus, store, registries );
}
@@ -438,7 +440,7 @@
public void rename( NextInterceptor next, RenameOperationContext renameOpContext ) throws NamingException
{
Operation op = operationFactory.newModifyRn( renameOpContext.getDn(), renameOpContext.getNewRdn(), renameOpContext.getDelOldDn() );
- op.execute( nexus, store, attrRegistry );
+ op.execute( nexus, store, registries );
}
Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java Fri Dec 28 18:53:20 2007
@@ -48,6 +48,7 @@
import org.apache.directory.shared.ldap.message.AliasDerefMode;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.OidNormalizer;
+import org.apache.directory.shared.ldap.util.StringTools;
import org.apache.mina.common.IdleStatus;
import org.apache.mina.common.WriteFuture;
import org.apache.mina.util.SessionLog;
@@ -412,7 +413,16 @@
CSN csn;
try
{
- csn = new DefaultCSN( String.valueOf( entryCSNAttr.get() ) );
+ Object val = entryCSNAttr.get();
+
+ if ( val instanceof byte[] )
+ {
+ csn = new DefaultCSN( StringTools.utf8ToString( (byte[])val ) );
+ }
+ else
+ {
+ csn = new DefaultCSN( (String)val );
+ }
}
catch ( IllegalArgumentException ex )
{
Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerContextHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerContextHandler.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerContextHandler.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerContextHandler.java Fri Dec 28 18:53:20 2007
@@ -192,7 +192,7 @@
try
{
op.execute( ctx.getDirectoryService().getPartitionNexus(), ctx.getConfiguration().getStore(),
- ctx.getDirectoryService().getRegistries().getAttributeTypeRegistry() );
+ ctx.getDirectoryService().getRegistries() );
ack = new LogEntryAckMessage( message.getSequence(), Constants.OK );
}
catch ( Exception e )
Modified: directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java (original)
+++ directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java Fri Dec 28 18:53:20 2007
@@ -29,6 +29,7 @@
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
import org.apache.directory.server.kerberos.shared.store.KerberosAttribute;
import org.apache.directory.server.unit.AbstractServerTest;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
@@ -201,9 +202,9 @@
attrs.put( "cn", cn );
attrs.put( "sn", sn );
attrs.put( "uid", uid );
- attrs.put( "userPassword", userPassword );
- attrs.put( KerberosAttribute.PRINCIPAL, principal );
- attrs.put( KerberosAttribute.VERSION, "0" );
+ attrs.put( SchemaConstants.USER_PASSWORD_AT, userPassword );
+ attrs.put( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principal );
+ attrs.put( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, "0" );
return attrs;
}
Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/bind/GetBindDn.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/bind/GetBindDn.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/bind/GetBindDn.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/bind/GetBindDn.java Fri Dec 28 18:53:20 2007
@@ -29,6 +29,7 @@
import javax.naming.directory.SearchResult;
import org.apache.directory.server.protocol.shared.store.ContextOperation;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.util.StringTools;
@@ -96,7 +97,7 @@
}
String[] attrIDs =
- { "userPassword" };
+ { SchemaConstants.USER_PASSWORD_AT };
Attributes matchAttrs = new AttributesImpl( true );
matchAttrs.put( new AttributeImpl( "uid", username ) );
@@ -120,7 +121,7 @@
}
Object userPassword;
- Attribute userPasswordAttr = attrs.get( "userPassword" );
+ Attribute userPasswordAttr = attrs.get( SchemaConstants.USER_PASSWORD_AT );
if ( userPasswordAttr == null )
{
Modified: directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java (original)
+++ directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java Fri Dec 28 18:53:20 2007
@@ -190,18 +190,18 @@
public AttributeType lookup( String id ) throws NamingException
{
- id = oidRegistry.getOid( id );
+ String oid = oidRegistry.getOid( id );
- if ( !byOid.containsKey( id ) )
+ if ( !byOid.containsKey( oid ) )
{
- throw new NamingException( "attributeType w/ OID " + id + " not registered!" );
+ throw new NamingException( "attributeType w/ OID " + oid + " not registered!" );
}
- AttributeType attributeType = byOid.get( id );
+ AttributeType attributeType = byOid.get( oid );
if ( IS_DEBUG )
{
- LOG.debug( "lookup with id" + id + "' of attributeType: " + attributeType );
+ LOG.debug( "lookup with id" + oid + "' of attributeType: " + attributeType );
}
return attributeType;
Modified: directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultObjectClassRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultObjectClassRegistry.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultObjectClassRegistry.java (original)
+++ directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultObjectClassRegistry.java Fri Dec 28 18:53:20 2007
@@ -27,6 +27,7 @@
import javax.naming.NamingException;
import org.apache.directory.shared.ldap.schema.ObjectClass;
+import org.apache.directory.shared.ldap.util.StringTools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -101,18 +102,23 @@
public ObjectClass lookup( String id ) throws NamingException
{
- id = oidRegistry.getOid( id );
+ if ( StringTools.isEmpty( id ) )
+ {
+ throw new NamingException( "name should not be empty" );
+ }
+
+ String oid = oidRegistry.getOid( id.toLowerCase() );
- if ( !byOid.containsKey( id ) )
+ if ( !byOid.containsKey( oid ) )
{
- throw new NamingException( "objectClass w/ OID " + id + " not registered!" );
+ throw new NamingException( "objectClass w/ OID " + oid + " not registered!" );
}
- ObjectClass objectClass = byOid.get( id );
+ ObjectClass objectClass = byOid.get( oid );
if ( IS_DEBUG )
{
- LOG.debug( "looked objectClass with OID '" + id + "' and got back " + objectClass );
+ LOG.debug( "looked objectClass with OID '" + oid + "' and got back " + objectClass );
}
return objectClass;
}
Modified: directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java (original)
+++ directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java Fri Dec 28 18:53:20 2007
@@ -36,6 +36,7 @@
import org.apache.directory.daemon.AvailablePortFinder;
import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.message.AttributesImpl;
@@ -143,7 +144,7 @@
attrs.put( "cn", RandomStringUtils.randomAlphabetic( 15 ) );
attrs.put( "initials", RandomStringUtils.randomAlphabetic( 2 ) );
attrs.put( "mail", RandomStringUtils.randomAlphabetic( 15 ) );
- attrs.put( "userPassword", "password" );
+ attrs.put( SchemaConstants.USER_PASSWORD_AT, "password" );
attrs.put( "telephoneNumber", RandomStringUtils.randomNumeric( 10 ) );
attrs.put( "homePhone", RandomStringUtils.randomNumeric( 10 ) );
attrs.put( "pager", RandomStringUtils.randomNumeric( 10 ) );
Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java (original)
+++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java Fri Dec 28 18:53:20 2007
@@ -175,7 +175,7 @@
DirContext ctx = new InitialDirContext( env );
String[] attrIDs =
- { "uid", "userPassword", KerberosAttribute.KEY, KerberosAttribute.VERSION };
+ { "uid", "userPassword", KerberosAttribute.KRB5_KEY_AT, KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT };
Attributes attributes = ctx.getAttributes( RDN, attrIDs );
@@ -202,7 +202,7 @@
{ ( byte ) 0x73, ( byte ) 0x65, ( byte ) 0x63, ( byte ) 0x72, ( byte ) 0x65, ( byte ) 0x74 };
assertTrue( Arrays.equals( userPassword, testPasswordBytes ) );
- Attribute krb5key = attributes.get( KerberosAttribute.KEY );
+ Attribute krb5key = attributes.get( KerberosAttribute.KRB5_KEY_AT );
Map<EncryptionType, EncryptionKey> map = reconstituteKeyMap( krb5key );
EncryptionKey encryptionKey = map.get( EncryptionType.DES_CBC_MD5 );
@@ -215,9 +215,9 @@
int keyVersionNumber = -1;
- if ( attributes.get( KerberosAttribute.VERSION ) != null )
+ if ( attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ) != null )
{
- keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.VERSION ).get() );
+ keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ).get() );
}
assertEquals( "Key version number", 0, keyVersionNumber );
@@ -251,7 +251,7 @@
Attributes attributes = new AttributesImpl( true );
Attribute attr = new AttributeImpl( "userPassword", newUserPassword );
attributes.put( attr );
- attr = new AttributeImpl( KerberosAttribute.PRINCIPAL, newPrincipalName );
+ attr = new AttributeImpl( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, newPrincipalName );
attributes.put( attr );
DirContext person = ( DirContext ) ctx.lookup( RDN );
@@ -289,9 +289,9 @@
int keyVersionNumber = -1;
- if ( attributes.get( KerberosAttribute.VERSION ) != null )
+ if ( attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ) != null )
{
- keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.VERSION ).get() );
+ keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ).get() );
}
assertEquals( "Key version number", 1, keyVersionNumber );
@@ -302,7 +302,7 @@
attributes = new AttributesImpl( true );
attr = new AttributeImpl( "userPassword", newUserPassword );
attributes.put( attr );
- attr = new AttributeImpl( KerberosAttribute.PRINCIPAL, newPrincipalName );
+ attr = new AttributeImpl( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, newPrincipalName );
attributes.put( attr );
person = ( DirContext ) ctx.lookup( RDN );
@@ -320,9 +320,9 @@
assertEquals( "password length", 18, userPassword.length );
- if ( attributes.get( KerberosAttribute.VERSION ) != null )
+ if ( attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ) != null )
{
- keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.VERSION ).get() );
+ keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ).get() );
}
assertEquals( "Key version number", 2, keyVersionNumber );
@@ -333,7 +333,7 @@
attributes = new AttributesImpl( true );
attr = new AttributeImpl( "userPassword", newUserPassword );
attributes.put( attr );
- attr = new AttributeImpl( KerberosAttribute.PRINCIPAL, newPrincipalName );
+ attr = new AttributeImpl( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, newPrincipalName );
attributes.put( attr );
person = ( DirContext ) ctx.lookup( RDN );
@@ -351,9 +351,9 @@
assertEquals( "password length", 24, userPassword.length );
- if ( attributes.get( KerberosAttribute.VERSION ) != null )
+ if ( attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ) != null )
{
- keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.VERSION ).get() );
+ keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ).get() );
}
assertEquals( "Key version number", 3, keyVersionNumber );
@@ -423,9 +423,9 @@
int keyVersionNumber = -1;
- if ( attributes.get( KerberosAttribute.VERSION ) != null )
+ if ( attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ) != null )
{
- keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.VERSION ).get() );
+ keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ).get() );
}
assertEquals( "Key version number", 1, keyVersionNumber );
@@ -452,9 +452,9 @@
assertEquals( "password length", 18, userPassword.length );
- if ( attributes.get( KerberosAttribute.VERSION ) != null )
+ if ( attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ) != null )
{
- keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.VERSION ).get() );
+ keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ).get() );
}
assertEquals( "Key version number", 2, keyVersionNumber );
@@ -481,9 +481,9 @@
assertEquals( "password length", 24, userPassword.length );
- if ( attributes.get( KerberosAttribute.VERSION ) != null )
+ if ( attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ) != null )
{
- keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.VERSION ).get() );
+ keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ).get() );
}
assertEquals( "Key version number", 3, keyVersionNumber );
@@ -630,8 +630,8 @@
attrs.put( "sn", sn );
attrs.put( "uid", uid );
attrs.put( "userPassword", userPassword );
- attrs.put( KerberosAttribute.PRINCIPAL, principal );
- attrs.put( KerberosAttribute.VERSION, "0" );
+ attrs.put( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principal );
+ attrs.put( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, "0" );
return attrs;
}
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractBinaryValue.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractBinaryValue.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractBinaryValue.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractBinaryValue.java Fri Dec 28 18:53:20 2007
@@ -287,6 +287,21 @@
@Override
public String toString()
{
- return "BinaryValue : " + StringTools.dumpBytes( wrapped );
+ if ( wrapped == null )
+ {
+ return "null";
+ }
+ else if ( wrapped.length > 16 )
+ {
+ byte[] copy = new byte[16];
+
+ System.arraycopy( wrapped, 0, copy, 0, 16 );
+
+ return "'" + StringTools.dumpBytes( copy ) + "...'";
+ }
+ else
+ {
+ return "'" + StringTools.dumpBytes( wrapped ) + "'";
+ }
}
}
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractStringValue.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractStringValue.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractStringValue.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractStringValue.java Fri Dec 28 18:53:20 2007
@@ -105,7 +105,7 @@
*/
public String toString()
{
- return "StringValue : " + wrapped;
+ return "'" + wrapped + "'";
}
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java Fri Dec 28 18:53:20 2007
@@ -38,7 +38,7 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public interface Entry<T extends EntryAttribute<?>>
+public interface Entry<T extends EntryAttribute<?>> extends Cloneable
{
/**
* Removes all the attributes.
@@ -97,6 +97,50 @@
List<T> remove( T... attributes ) throws NamingException;
+ /**
+ * Checks if an entry contains an attribute with a given value.
+ *
+ * @param attribute The Attribute we are looking for
+ * @param value The searched value
+ * @return <code>true</code> if the value is found within the attribute
+ * @throws NamingException If the attribute does not exist
+ */
+ boolean contains( T attribute, Value<?> value ) throws NamingException;
+
+
+ /**
+ * Checks if an entry contains an attribute with a given value.
+ *
+ * @param id The Attribute ID we are looking for
+ * @param value The searched value
+ * @return <code>true</code> if the value is found within the attribute
+ * @throws NamingException If the attribute does not exist
+ */
+ boolean contains( String id, Value<?> value ) throws NamingException;
+
+
+ /**
+ * Checks if an entry contains an attribute with a given value.
+ *
+ * @param id The Attribute ID we are looking for
+ * @param value The searched value
+ * @return <code>true</code> if the value is found within the attribute
+ * @throws NamingException If the attribute does not exist
+ */
+ boolean contains( String id, String value ) throws NamingException;
+
+
+ /**
+ * Checks if an entry contains an attribute with a given value.
+ *
+ * @param id The Attribute ID we are looking for
+ * @param value The searched value
+ * @return <code>true</code> if the value is found within the attribute
+ * @throws NamingException If the attribute does not exist
+ */
+ boolean contains( String id, byte[] value ) throws NamingException;
+
+
/**
* Returns the number of attributes.
*