Resolved #118: Support for ntds.dit files with conflicting defunct attributes.
This commit is contained in:
parent
b33d915110
commit
677b76bb81
|
@ -7,6 +7,7 @@
|
||||||
using Microsoft.Isam.Esent.Interop;
|
using Microsoft.Isam.Esent.Interop;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -25,7 +26,6 @@
|
||||||
private IDictionary<string, SchemaAttribute> attributesByName;
|
private IDictionary<string, SchemaAttribute> attributesByName;
|
||||||
private IDictionary<string, int> classesByName;
|
private IDictionary<string, int> classesByName;
|
||||||
|
|
||||||
// TODO: Internal?
|
|
||||||
// TODO: ISchema
|
// TODO: ISchema
|
||||||
public DirectorySchema(IsamDatabase database)
|
public DirectorySchema(IsamDatabase database)
|
||||||
{
|
{
|
||||||
|
@ -41,17 +41,6 @@
|
||||||
// TODO: Load Ext-Int Map from hiddentable
|
// TODO: Load Ext-Int Map from hiddentable
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the partition name.
|
|
||||||
/// </summary>
|
|
||||||
public string Name
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the OID prefix map.
|
/// Gets the OID prefix map.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -112,15 +101,6 @@
|
||||||
return this.FindAttribute(attributeName).Index;
|
return this.FindAttribute(attributeName).Index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Refreshes the schema cache.
|
|
||||||
/// </summary>
|
|
||||||
public void RefreshSchema()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Rename to CategoryDNT
|
// TODO: Rename to CategoryDNT
|
||||||
public int FindClassId(string className)
|
public int FindClassId(string className)
|
||||||
{
|
{
|
||||||
|
@ -229,6 +209,7 @@
|
||||||
// Some built-in attributes do not have internal id set, which means it is equal to the public id
|
// Some built-in attributes do not have internal id set, which means it is equal to the public id
|
||||||
int id = internalId ?? attributeId;
|
int id = internalId ?? attributeId;
|
||||||
SchemaAttribute attribute;
|
SchemaAttribute attribute;
|
||||||
|
|
||||||
bool found = this.attributesByInternalId.TryGetValue(id, out attribute);
|
bool found = this.attributesByInternalId.TryGetValue(id, out attribute);
|
||||||
if (! found)
|
if (! found)
|
||||||
{
|
{
|
||||||
|
@ -236,6 +217,7 @@
|
||||||
attribute = new SchemaAttribute();
|
attribute = new SchemaAttribute();
|
||||||
attribute.InternalId = internalId;
|
attribute.InternalId = internalId;
|
||||||
}
|
}
|
||||||
|
|
||||||
attribute.Id = dataTableCursor.RetrieveColumnAsInt(attributeIdCol).Value;
|
attribute.Id = dataTableCursor.RetrieveColumnAsInt(attributeIdCol).Value;
|
||||||
attribute.Name = dataTableCursor.RetrieveColumnAsString(ldapDisplayNameCol);
|
attribute.Name = dataTableCursor.RetrieveColumnAsString(ldapDisplayNameCol);
|
||||||
attribute.CommonName = dataTableCursor.RetrieveColumnAsString(cnCol);
|
attribute.CommonName = dataTableCursor.RetrieveColumnAsString(cnCol);
|
||||||
|
@ -251,8 +233,13 @@
|
||||||
attribute.IsSystemOnly = dataTableCursor.RetrieveColumnAsBoolean(systemOnlyCol);
|
attribute.IsSystemOnly = dataTableCursor.RetrieveColumnAsBoolean(systemOnlyCol);
|
||||||
attribute.Syntax = dataTableCursor.RetrieveColumnAsAttributeSyntax(syntaxCol);
|
attribute.Syntax = dataTableCursor.RetrieveColumnAsAttributeSyntax(syntaxCol);
|
||||||
attribute.OmSyntax = dataTableCursor.RetrieveColumnAsAttributeOmSyntax(omSyntaxCol);
|
attribute.OmSyntax = dataTableCursor.RetrieveColumnAsAttributeOmSyntax(omSyntaxCol);
|
||||||
// Make it case-insensitive by always lowering the name:
|
|
||||||
this.attributesByName.Add(attribute.Name.ToLower(), attribute);
|
// Only index non-defunct attributes by name. A name conflict could arise otherwise.
|
||||||
|
if(!attribute.IsDefunct)
|
||||||
|
{
|
||||||
|
// Make the attribute name lookup case-insensitive by always lowercasing the name:
|
||||||
|
this.attributesByName.Add(attribute.Name.ToLower(CultureInfo.InvariantCulture), attribute);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue