簡體   English   中英

這是什么意思:“無法發送消息,套接字未打開”?

[英]What does this mean: “unable to send message, socket is not open”?

我正在嘗試連接到ldap服務器,但是它似乎以某種方式或形式失敗:

import csv
from ldap3 import Server, Connection, ALL, NTLM, SUBTREE
import pandas as pd


server = Server('cybertest02.ad.arb.ca.gov', get_info=ALL)
c = Connection(server, user='myusername', password='mypassword')

c.search(search_base = 'o=test',
         search_filter = '(objectClass=inetOrgPerson)',
         search_scope = SUBTREE,
         attributes = ['cn', 'givenName'])

total_entries += len(c.response)
for entry in c.response:
    print(entry['dn'], entry['attributes'])

第12行錯誤:屬性在哪里,無法發送消息,套接字未打開

嘗試插入c.bind()的前c.search()和后Connection()語句。

根據LDAP3 Docs ,您必須bind()在服務器中建立新的授權狀態。

  • 如RFC4511中所指定,綁定操作是“身份驗證”操作。

  • 當您打開與LDAP服務器的連接時,您處於匿名連接狀態。 確切的含義是由服務器實現定義的,而不是由協議定義的。

  • 如果尚未打開, bind()方法將打開連接。

  • 綁定操作與套接字無關,而是執行用戶的身份驗證。

另外,您應該使用c.unbind()關閉連接。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM