Howard Bullock
(KiX Supporter)
2003-08-26 07:32 PM
COM Bug still unresolved in 4.22rc1

This issue existed in 4.02 to present.
GetInfoEx does not return error and does not fill property cache.

Code that demostrates this issue (both vbs and KiXtart) is avaialble at this link:
COM Bug - ADSI GetInfoEx


Ruud van Velsen
(Hey THIS is FUN)
2003-08-28 02:14 PM
Re: COM Bug still unresolved in 4.22rc1

Thanks for the headsup.

The thing is that it's not KiXtart, or KiXtart COM that is failing here. What's wrong is that 'canonicalName' is a display-name, not the actual property-name (which is 'cn').

If you change your sample to use 'cn', you will see it works fine.

Apparently vbs does some name-translation before querying AD.

More later, thanks again!

Ruud


Howard Bullock
(KiX Supporter)
2003-08-28 03:17 PM
Re: COM Bug still unresolved in 4.22rc1

I really think that the issue is with KiXtart COM & GetInfoEX. this is demonstrated by the fact that the property cache is NOT overwritten in my example code. The count of 33 (IIRC) values from GetInfo should be reduced to 1 if GetInfoEx actually worked.

quote:
Non-stored, constructed properties
A user object also has constructed properties that are not stored in the directory but are calculated by the domain controller (such as canonicalName, distinguishedName, allowedAttributes, ADsPath, and so on). Note that distinguishedName and ADsPath are not defined in the schema. All the constructed properties can be retrieved by IDirectoryObject and IDirectorySearch methods. Most are automatically retrieved and cached with a IADs::GetInfo call on the user object (Note IADs::Get does an implicit IADs::GetInfo call if the cache is empty). However, some constructed properties are not and therefore require a IADs::GetInfoEx call to explicitly retrieve them. For example, canonicalName is not retrieved with a IADs::GetInfo call and therefore IADs::Get will return a E_ADS_PROPERTY_NOT_FOUND error and enumeration of all properties using IADsPropertyList will not include the canonicalName property.

quote:
Example Code for Reading a Constructed Property
[This is preliminary documentation and subject to change.]

The following code fragments read the canonicalName property of the Administrator.


code:
'Read the canonicalName of Administrator
Dim rootDSE As IADs
Dim user As IADs

sPrefix = "LDAP://"
Set rootDSE = GetObject(sPrefix & "rootDSE")
If (Err.Number <> 0) Then
BailOnFailure Err.Number, "on GetObject method"
End If
sDomain = rootDSE.Get("defaultNamingContext")
If (Err.Number <> 0) Then
BailOnFailure Err.Number, "on Get method"
End If
sUserDN = "cn=Administrator,cn=users," + sDomain
'''''''''''''''''''''''''''''''''''''''
'Bind to the Administrator user
'''''''''''''''''''''''''''''''''''''''
Set user = GetObject(sPrefix & sUserDN)
user.GetInfoEx Array("canonicalName"), 0
strText = "Canonical Name: " & user.Get("canonicalName")
If (Err.Number <> 0) Then
BailOnFailure Err.Number, "on Get method"
End If
show_items strText, sComputer

'''''''''''''''''''''''''''''''''''''''
'Display subroutines
'''''''''''''''''''''''''''''''''''''''
Sub show_items(strText, strName)
MsgBox strText, vbInformation, "Get canonicalName for Administrator"
End Sub

Sub BailOnFailure(ErrNum, ErrText) strText = "Error 0x" & Hex(ErrNum) & " " & ErrText
MsgBox strText, vbInformation, "ADSI Error"
WScript.Quit
End Sub



[ 28. August 2003, 15:19: Message edited by: Howard Bullock ]


Ruud van Velsen
(Hey THIS is FUN)
2003-09-02 05:54 PM
Re: COM Bug still unresolved in 4.22rc1

In short: thanks very much for your persistence! You are very right, this was broken in KiXtart, and is now fixed in the final build of 4.22.

Thanks again!

Ruud