使用“坏”连接ADO到LDAP服务器证书 [英] Connecting via ADO to LDAP Server with "bad" certificate
问题描述
在Excel 2016中,我正在尝试查询在开发Linux服务器上运行的LDAP目录。服务器仅允许通过端口636进行SSL连接。 我知道服务器正在使用自签名临时证书,但是,我能找到的所有LDAP
实用程序都可以连接到目录,就好了。 然而,ADO拒绝连接。 我猜它不喜欢证书。 我收到的错误是"VB-ERROR#-2147217865: 服务器无法运行。"
From Excel 2016, I'm trying to query an LDAP directory running on a development Linux server. The server is only allowing SSL connects over port 636. I know the server is using a self-signed temporary certificate, but none the less, all the LDAP Utilities I can find are able to connect to the directory, just fine. ADO, however, is refusing to connect. I'm guessing it does not like the certificate. The error I'm receiving is "VB-ERROR #-2147217865: The server is not operational."
我知道如何才能让它工作?
Any idea how I can get this to work?
这是我的代码......
Here is my code...
Const ADS_USE_SSL =& H2
Const ADS_USE_SSL = &H2
设置g_LdapConn = CreateObject(" ADODB.Connection")
g_LdapConn.Provider =" ADsDSOObject"
g_LdapConn.Properties(" User ID")= dbLogin
g_LdapConn .Properties(" Password")= dbPassword
g_LdapConn.Properties(" Encrypt Password")= True
g_LdapConn.Properties(" ADSI Flag")= ADS_USE_SSL
g_LdapConn.Open" Active Directory Provider"
Set g_LdapConn = CreateObject("ADODB.Connection")
g_LdapConn.Provider = "ADsDSOObject"
g_LdapConn.Properties("User ID") = dbLogin
g_LdapConn.Properties("Password") = dbPassword
g_LdapConn.Properties("Encrypt Password") = True
g_LdapConn.Properties("ADSI Flag") = ADS_USE_SSL
g_LdapConn.Open "Active Directory Provider"
设置g_LdapCmd = CreateObject(" ADODB.Command")
设置g_LdapCmd .ActiveConnection = g_LdapConn
g_LdapCmd.Properties(" Page Size")= 1000
g_LdapCmd.Properties(" Chase referrals")= ADS_CHASE_REFERRALS_ALWAYS
g_LdapCmd.Properties(" Searchs cope")= ADS_SCOPE_SUBTREE
Set g_LdapCmd = CreateObject("ADODB.Command")
Set g_LdapCmd.ActiveConnection = g_LdapConn
g_LdapCmd.Properties("Page Size") = 1000
g_LdapCmd.Properties("Chase referrals") = ADS_CHASE_REFERRALS_ALWAYS
g_LdapCmd.Properties("Searchscope") = ADS_SCOPE_SUBTREE
SQL =" SELECT FullName FROM'LDAP://11.0.5.240/ou=Persons,ou=Customer,o=TESTDB'"
SQL ="<< a href =" ldap://11.0.5.240:636 / ou = Persons,ou = Customer,o = TESTDB> ;;; FullName"> LDAP://11.0 .5.240:636 / OU =人,OU =顾客,O = TESTDB> ;;;全名;"&NBSP; "&NBSP;&NBSP;两个语句都给出相同的错误
SQL = "SELECT FullName FROM 'LDAP://11.0.5.240/ou=Persons,ou=Customer,o=TESTDB'"
SQL = "<<a href="ldap://11.0.5.240:636/ou=Persons,ou=Customer,o=TESTDB>;;FullName">LDAP://11.0.5.240:636/ou=Persons,ou=Customer,o=TESTDB>;;FullName;" ' both statements give same error
g_LdapCmd.CommandText = SQL
g_LdapCmd.CommandText = SQL
设置m_rsADO = g_LdapCmd.Execute
Set m_rsADO = g_LdapCmd.Execute
推荐答案
您必须为服务器设置正确的端口。
You will have to set the correct port for the server.
。
这篇关于使用“坏”连接ADO到LDAP服务器证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!