OPENLDAP supportedControl上市:1.3.6.1.4.1.42.2.27.8.5.1(密碼策略)OPENLDAP supportedControl密碼策略
使用.net DirectoryServices.Protocols,我已經用盡提供檢索響應信息的所有可能的方法通過這種控制。
我使用的是最新的OpenLDAP源建/在Cygwin環境與構建啓用的所有PPolicy相關配置,並配置和工作/測試PPolicy本地運行。
通過從目錄服務編程指南修改例如,鏈接: http://dunnry.com/blog/2006/05/11/DotNetDevGuideToDirectoryServicesCompanionSiteLaunched.aspx
,使用填充有配置爲請求
密碼策略DirectoryControl一個SearchRequest,讓我什麼都沒有。 一切看起來不錯的服務器源: http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob_plain;f=servers/slapd/overlays/ppolicy.c;hb=HEAD
有沒有人有使用的.Net DirectoryControls在SearchRequest任何運氣?
下面是一些代碼,我一直在努力:
_authConnect.AuthType = AuthType.Basic;
// credentials.UserName is a user DN format, w/password and null domain
_authConnect.Credential = credentials;
Debug.WriteLine("PV: " + _authConnect.SessionOptions.ProtocolVersion);
var sr = //new ExtendedRequest();
new SearchRequest(credentials.UserName, "(objectclass=*)", SearchScope.Base, null);
//new DsmlAuthRequest(credentials.UserName);
var isCritical = false;
var ppolicy = "1.3.6.1.4.1.42.2.27.8.5.1";
// ppolicy request and response control is referred to by the same OID
sr.Controls.Add(new DirectoryControl(ppolicy, null, isCritical, true));
sr.Controls.Add(new DirectoryControl(ppolicy, new byte[8], isCritical, false));
try
{
var response = (SearchResponse)_authConnect.SendRequest(sr);
DirectoryControl[] c = response.Controls;
if (c.Rank > 0 && c.GetLength(0) > 0)
{
Debug.WriteLine(c[0].Type + " value: " + c[0].GetValue());
}
SearchResultEntry entry = response.Entries[0];
c = entry.Controls;
if (c.Rank > 0 && c.GetLength(0) > 0)
{
Debug.WriteLine(c[0].Type + " value: " + c[0].GetValue());
}
return true;
}
catch (LdapException ex)
{
Debug.WriteLine(ex.Message);
}
是否確定了身份驗證使用設置授權狀態(使用綁定)被允許使用該請求控制? – 2011-08-05 16:30:07
沒有從輸出「的slapd -d -1」表明存在一個權限問題 – ticktock 2011-08-06 14:47:36
我應該更清楚:做目錄服務器日誌表明,請求失敗,因爲授權狀態不必使用控制權限?順便說一句,請不要在請求中包含響應控制OID。響應控制(如果存在)顯示在來自服務器的響應中。 – 2011-08-08 10:43:35