// if nis is disabled then enable it
if ( isNisDisabled )
{
Attribute disabled = new BasicAttribute( "m-disabled" );
ModificationItem[] mods = new ModificationItem[] {
new ModificationItem( DirContext.REMOVE_ATTRIBUTE, disabled ) };
schemaRoot.modifyAttributes( "cn=nis", mods );
}
// -------------------------------------------------------------------
// Enable the krb5kdc schema
// -------------------------------------------------------------------
// Check if krb5kdc is loaded
if ( !service.getSchemaManager().isSchemaLoaded( "krb5kdc" ) )
{
service.getSchemaManager().load( "krb5kdc" );
}
// check if krb5kdc is disabled
Attributes krb5kdcAttrs = schemaRoot.getAttributes( "cn=krb5kdc" );
boolean isKrb5kdcDisabled = false;
if ( krb5kdcAttrs.get( "m-disabled" ) != null )
{
isKrb5kdcDisabled = ( ( String ) krb5kdcAttrs.get( "m-disabled" ).get() ).equalsIgnoreCase( "TRUE" );
}
// if krb5kdc is disabled then enable it
if ( isKrb5kdcDisabled )
{
Attribute disabled = new BasicAttribute( "m-disabled" );
ModificationItem[] mods = new ModificationItem[] {
new ModificationItem( DirContext.REMOVE_ATTRIBUTE, disabled ) };
schemaRoot.modifyAttributes( "cn=krb5kdc", mods );
}
}