文書番号: 842637 - 最終更新日: 2007年6月22日 - リビジョン: 1.2

Windows 2000 または Windows Server 2003 で distinguishedName 属性を使用して LDAP クエリで並べ替えを行えない

お知らせお使いのオペレーティング システムには適用しない情報が含まれている場合があります。
すべて展開する | すべて折りたたむ

現象

distinguishedName 属性を使用して LDAP (Lightweight Directory Access Protocol) クエリの結果を並べ替えようとしても、正常に実行できません。ただし、この操作を Microsoft Windows 2000 Server で実行したときと Microsoft Windows Server 2003 で実行したときでは、発生する現象が異なります。Windows 2000 Server ではエラーは返されず、並べ替えられていない結果セットが返されます。Windows Server 2003 ではエラー コードが返され、結果セットは空になります。

詳細

ネットワーク トレースを使用すると、この問題の原因が並べ替え操作であるかどうかを確認できます。並べ替え操作の要求は、ネットワーク モニタの [詳細] ウィンドウでは、次のパケット例の太文字で示したように表示されます。
LDAP: ProtocolOp: SearchRequest (3)
    LDAP: SASL Signature
    LDAP: MessageID = 157 (0x9D)
LDAP: ProtocolOp = SearchRequest
        LDAP: Base Object =DC=ticehurst,DC=com
        LDAP: Scope = Whole Subtree
LDAP: Deref Aliases = Never Deref Aliases
        LDAP: Size Limit = 0x00000BB8
        LDAP: Time Limit = 0x00000002
LDAP: Attrs Only = 0 (0x0)
        LDAP: Filter
            LDAP: Filter Type = And
                LDAP: Filter Type = Equality Match
                    LDAP: Attribute Type =objectCategory
                    LDAP: Attribute Value =OrganizationalUnit
                LDAP: Filter Type = And
LDAP: Filter Type = Present
                        LDAP: Attribute Type =postalCode
        LDAP: Attribute Description List
            LDAP: Attribute Type =objectGUID
            LDAP: Attribute Type =ou
            LDAP: Attribute Type =postalCode
            LDAP: Attribute Type =distinguishedName
        LDAP: Controls
            LDAP: Sort Request Control
                LDAP: Criticality = 255 (0xFF)
                LDAP: Sort Request Attribute Type =distinguishedName
                LDAP: Sort Reverse Order = 0 (0x0) LDAP: Domain Scope Control LDAP: Criticality = 0 (0x0) LDAP: Paged Control LDAP: Criticality = 255 (0xFF) LDAP: Page Size = 11 (0xB) 
Windows 2000 Server に対してこのクエリを実行すると、クエリが実行され、サーバーから結果セットが返されます。ただし、この結果は要求とは異なり、distinguishedName 属性に基づいて並べ替えが行われていません。

この同じクエリを Windows Server 2003 に対して実行すると、"Unavailable Critical Extension" ("限界の拡張を利用できません") エラーが返されます。次に記載しているエラー説明のテキストは、ネットワーク モニタに表示される LDAP 応答パケットの一部です。
LDAP: ProtocolOp: SearchResponse (simple) (5)
    LDAP: SASL Signature
    LDAP: MessageID = 25 (0x19)
    LDAP: ProtocolOp = SearchResponse (simple)
        LDAP: Result Code = Unavailable Critical Extension
        LDAP: Error Message =0000217A: SvcErr: DSID-031401A2, problem 5010 (UNAVAIL_EXTENSION)
        LDAP: Controls
            LDAP: Sort Response Control
                LDAP: Criticality = 0 (0x0)
                LDAP: Sort Result Code = Inappropriate Matching
            LDAP: Paged Control
                LDAP: Criticality = 0 (0x0)
                LDAP: Page Size = 0 (0x0)

回避策

distinguishedName 属性に基づいて並べ替えを行うには、次のコード例のように、サーバー側ではなくクライアント側で並べ替え操作を実行します。
Const adUseClient = 3
Const adCmdText = 1
Const adSecureAuthentication = 1
Const adLockReadOnly = 1
 
Dim szQuery, g_oCon, g_oCmd, g_oRS
 
szQuery = "<LDAP://billtivpc01.ticehurst.com>;" + _
     "(&(objectCategory=group)(&(distinguishedName=*)));" + _
     "objectGUID, ou, distinguishedName;subtree"
 
Set g_oCon = CreateObject("ADODB.Connection")
Set g_oRS = CreateObject("ADODB.Recordset")
 
g_oCon.Provider = "ADsDSOObject"
g_oCon.Properties("Encrypt Password") = True
g_oCon.Properties("ADSI Flag") = adSecureAuthentication
g_oCon.Open "Active Directory Provider"
 
 
'*** The following server-side sort does not return any results.
'Set g_oCmd = CreateObject("ADODB.Command")
'Set g_oCmd.ActiveConnection = g_oCon
'g_oCmd.Properties("Sort On") = "distinguishedname"
'g_oCmd.CommandType = adCmdText
'g_oCmd.CommandText = szQuery
'g_oRS.Open g_oCmd, , adUseClient, adLockReadOnly
 
 
'*** Instead, the following client-side sort succeeds.
g_oRS.CursorLocation = adUseClient
g_oRS.Sort = "distinguishedname"
g_oRS.Open szQuery, g_oCon, , , adCmdText
 
 
While Not g_oRS.EOF
    WScript.Echo g_oRS.Fields("distinguishedName").Value
    g_oRS.MoveNext
Wend
 
WScript.Quit

状況

マイクロソフトでは、この問題をこの資料の対象製品として記載されているマイクロソフト製品の問題として認識しています。

この資料は以下の製品について記述したものです。
  • Microsoft Windows Server 2003, Standard Edition (32-bit x86)
  • Microsoft Windows 2000 Server
キーワード:?
kbprb KB842637
"Microsoft Knowledge Baseに含まれている情報は、いかなる保証もない現状ベースで提供されるものです。Microsoft Corporation及びその関連会社は、市場性および特定の目的への適合性を含めて、明示的にも黙示的にも、一切の保証をいたしません。さらに、Microsoft Corporation及びその関連会社は、本文書に含まれている情報の使用及び使用結果につき、正確性、真実性等、いかなる表明・保証も行ないません。Microsoft Corporation、その関連会社及びこれらの権限ある代理人による口頭または書面による一切の情報提供またはアドバイスは、保証を意味するものではなく、かつ上記免責条項の範囲を狭めるものではありません。Microsoft Corporation、その関連会社 及びこれらの者の供給者は、直接的、間接的、偶発的、結果的損害、逸失利益、懲罰的損害、または特別損害を含む全ての損害に対して、状況のいかんを問わず一切責任を負いません。(Microsoft Corporation、その関連会社 またはこれらの者の供給者がかかる損害の発生可能性を了知している場合を含みます。) 結果的損害または偶発的損害に対する責任の免除または制限を認めていない地域においては、上記制限が適用されない場合があります。なお、本文書においては、文書の体裁上の都合により製品名の表記において商標登録表示、その他の商標表示を省略している場合がありますので、予めご了解ください。"