LDAP ADsGetObject C ++ - & gt;用户ID搜索错误 [英] LDAP ADsGetObject C++ -> search error with User ID

查看:73
本文介绍了LDAP ADsGetObject C ++ - & gt;用户ID搜索错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

PLZ我需要帮助来设置一个程序来拦截我的使用"ADsGetObject"检索用户信息的AD目录。使用"用户ID"

所以当我使用"WinNT:"时它在这里工作是一个有用的例子:
$


HRESULT hr = ADsGetObject(L" WinNT:// DmaineName.local / UserID",IID_IADsUser, (void **)& pUser);

  WCHAR * UserFullName = NULL;

    WCHAR * UserFisrtName = NULL;

    WCHAR * UserLastName = NULL;



  pUser-> get_FullName(& UserFullName); //作品

    pUser-> get_FirstName(& UserFisrtName); //无效(使用WinNT正常)

  pUser-> get_LastName(& UserLastName); // Not Works(WinNT正常)



-------- ------------------------------------------ -------- -------------------------

在LDAP中使用姓氏和名字:



HRESULT hr = ADsGetObject(" LDAP:// CN =全名,DC = DomainName,DC = Local"",IID_IADsUser,(void * *)& pUser);

  WCHAR * UserFullName = NULL;

    WCHAR * UserFisrtName = NULL;

    WCHAR * UserLastName = NULL;



  pUser-> get_FullName(& UserFullName); // Works

    pUser-> get_FirstName(& UserFisrtName); // Works

  pUser-> get_LastName(& UserLastName); // Works



-------------- ------------------------------------ -------------- -----------------

问题在于:



HRESULT hr = ADsGetObject(L"" LDAP:// CN = UserID,DC = DomainName,DC = Local"",IID_IADsUser,(void **)& pUser);



或:



HRESULT hr = ADsGetObject(" LDAP:// uid = UserID,DC = DomainName,DC = Local"",IID_IADsUser,(void **)& pUser);



当我在LDAP中使用用户ID时,它会向我发送错误代码"0x80072030L - > LDAP_NO_SUCH_OBJECT - > ERROR_DS_NO_SUCH_OBJECT" 

PLZ i need help to set up a program that interogates my AD directory to retrieve user information with "ADsGetObject" with the "User ID"
so when I use this one with "WinNT:" it works here is an example that works:

HRESULT hr = ADsGetObject (L "WinNT: // DmaineName.local / UserID", IID_IADsUser, (void **) & pUser);
  WCHAR * UserFullName = NULL;
   WCHAR * UserFisrtName = NULL;
   WCHAR * UserLastName = NULL;

  pUser-> get_FullName (& UserFullName); // Works
   pUser-> get_FirstName (& UserFisrtName); // Not Works (normal with WinNT)
  pUser-> get_LastName (& UserLastName); // Not Works (normal with WinNT)

-------------------------------------------------- ---------------------------------
with surname and first name in LDAP:

HRESULT hr = ADsGetObject ("LDAP: // CN = Full Name, DC = DomainName, DC = Local" ", IID_IADsUser, (void **) & pUser);
  WCHAR * UserFullName = NULL;
   WCHAR * UserFisrtName = NULL;
   WCHAR * UserLastName = NULL;

  pUser-> get_FullName (& UserFullName); // Works
   pUser-> get_FirstName (& UserFisrtName); // Works
  pUser-> get_LastName (& UserLastName); // Works

-------------------------------------------------- -------------------------------
here is the problem:

HRESULT hr = ADsGetObject (L "" LDAP: // CN = UserID, DC = DomainName, DC = Local "", IID_IADsUser, (void **) & pUser);

or :

HRESULT hr = ADsGetObject ("LDAP: // uid = UserID, DC = DomainName, DC = Local" ", IID_IADsUser, (void **) & pUser);

it's when I use the User ID with LDAP it sends me an error code "0x80072030L -> LDAP_NO_SUCH_OBJECT -> ERROR_DS_NO_SUCH_OBJECT" 

提前致谢




推荐答案

如果UserID是sAMAccountName(Windows 2000之前的登录名)用户的ADUC)和sAMAccountName与公共名称(用户的RDN)不匹配,那么它将无法正常工作。可分辨名称包括用户的RDN作为第一个组件。
绰号"cn"是"通用名称",RDN。
If UserID is the sAMAccountName (pre-Windows 2000 logon name in ADUC) of the user, and the sAMAccountName does not match the common name (the RDN of the user), then it will not work. The distinguished name includes the RDN of the user as the first component. The moniker "cn" is short for "common name", the RDN.


这篇关于LDAP ADsGetObject C ++ - & gt;用户ID搜索错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆