分享好友 最新动态首页 最新动态分类 切换频道
IADsOpenDSObject::OpenDSObject method (iads.h)
2024-12-26 12:03

The IADsOpenDSObject::OpenDSObject method binds to an ADSI object, using the given credentials, and retrieves an IDispatch pointer to the specified object.

 


The null-terminated Unicode string that specifies the ADsPath of the ADSI object. For more information and examples of binding strings for this parameter, see LDAP ADsPath. When using the LDAP provider with an ADsPath that includes a specific server name, the lnReserved parameter should include the ADS_SERVER_BIND flag.

The null-terminated Unicode string that specifies the user name to be used for securing permission from the namespace server. For more information, see the following Remarks section.

The null-terminated Unicode string that specifies the password to be used to obtain permission from the namespace server.

Authentication flags used to define the binding options. For more information, see ADS_AUTHENTICATION_ENUM.

Pointer to a pointer to an IDispatch interface on the requested object.

This method supports the standard return values, including S_OK when the IDispatch interface has been successfully retrieved using these credentials.

For more information, see ADSI Error Codes.

This method should not be used just to validate user credentials.

When lnReserved is set, the behavior of OpenDSObject depends on the provider it connects to. High security namespaces may ignore these flags and always require authentication.

The IADsOpenDSObject::OpenDSObject method maintains the authenticated and encrypted user credentials in the cache. Cached credentials may be used in subsequent operations for binding to any other directory objects. The ADSI client applications should not cache the credentials supplied by the user. Instead, they should rely on ADSI infrastructure to perform caching. To use the cached credentials, lpszPassword and lpszUserName must remain unchanged in any subsequent calls of OpenDSObject. The following code example shows this operation.


The credentials passed to the IADsOpenDSObject::OpenDSObject function are used only with the particular object bound to and do not affect the security context of the calling thread. This means that, in the following code example, the call to IADsOpenDSObject::OpenDSObject will use different credentials than the call to GetObject.


With a serverless binding, the server name, "server1", is not stated explicitly. The default server is used instead. Only the LDAP provider supports the serverless binding. To use this feature, the client computer must be on an Active Directory domain. To attempt a serverless binding from a computer, you must bind as a domain user.

For credential caching to work properly, it is important to keep an object reference outstanding to maintain the cache handle. In the example given above, an attempt to open "obj2" after releasing "obj1" will result in an authentication failure.

The IADsOpenDSObject method uses the default credentials when lpszUserName and lpszPassword are set to NULL.

If Kerberos authentication is required for the successful completion of a specific directory request using the LDAP provider, the lpszDNName binding string must use either a serverless ADsPath, such as "LDAP://CN=Jeff Smith,CN=admin,DC=Fabrikam,DC=com", or it must use an ADsPath with a fully qualified DNS server name, such as "LDAP://central3.corp.Fabrikam.com/CN=Jeff Smith,CN=admin,DC=Fabrikam,DC=com". Binding to the server using a flat NETBIOS name or a short DNS name, for example, using the short name "central3" instead of "central3.corp.Fabrikam.com", may or may not yield Kerberos authentication.

The ADsOpenObject helper function offers the same features as the IADsOpenDSObject::OpenDSObject method.

With the LDAP provider for Active Directory, you may pass in lpszUserName as one of the following strings:

  • The name of a user account, such as "jeffsmith". To use a user name by itself, you must set only the ADS_SECURE_AUTHENTICATION flag in the lnReserved parameter.
  • The user path from a previous version of Windows, such as "Fabrikamjeffsmith".
  • Distinguished Name, such as "CN=Jeff Smith,OU=Sales,DC=Fabrikam,DC=Com". To use a DN, the lnReserved parameter must be zero or it must include the ADS_USE_SSL flag
  • User Principal Name (UPN), such as "jeffsmith@Fabrikam.com". To use a UPN, you must assign the appropriate UPN value for the userPrincipalName attribute of the target user object.

Examples

The following code example shows how to use IADsOpenDSObject to open the "Administrator" user object on "Fabrikam" with Secure Authentication through the LDAP provider.


The following code example uses IADsOpenDSObject to open an Active Directory object through the LDAP provider.



Requirement Value Minimum supported client Windows Vista Minimum supported server Windows Server 2008 Target Platform Windows Header iads.h DLL Activeds.dll

ADSI Error Codes

ADS_AUTHENTICATION_ENUM

ADsOpenObject

Binding

GetObject

IADsOpenDSObject

IDispatch

LDAP ADsPath

最新文章
第十一章 文件操作_C语言插入、删除、更改文件内容
我们平时所见的文件,例如 txt、doc、mp4 等,文件内容是按照从头到尾的顺序依次存储在磁盘上的,就像排起一条长长的队伍,称为顺序文件。 除了顺序文件,还有索引文件、散列文件等,一般用于特殊领域
微信小程序开发多少钱一个月
在当今互联网飞速发展的时代,微信小程序因其便捷、功能多样和用户量庞大,成为众多企业、商家乃至个体创业者拓展线上业务的重要工具。对于想要开发微信小程序的企业而言,最关心的问题之一就是费用问题。在合肥开发一款微信小程序的费用到
淘宝关键词排名优化怎么做?影响因素有哪些?
标题是淘宝店铺自然搜索流量最重要的入口,如果宝贝的标题没有做好,那么后续的运营也就没有什么意义了。想要获取自然搜索流量,那么标题的关键词就得有权重,有排名。一、淘宝标题关键词如何优化靠前?首先,搜索引擎会先抓取大热词,大热
转:Sql 四大排名函数(ROW_NUMBER、RANK、DENSE_RANK、NTILE)简介
https://www.cnblogs.com/52xf/p/4209211.html    附上表结构和初始数据图:用法: 一:语法(用法):      rank() over([partition by col1] order by col2)      dense_rank() over([partition by col
苹果手机请启用javascript,请启用javascript教程
JavaScript是一种广泛应用于网页开发的脚本语言,它为网页增加了交互性和动态功能。如果您想在手机上开发和运行JavaScript代码,您需要确保手机浏览器支持JavaScript并已启用该功能Deepl降重。下面是一些简单的步骤,帮
美国男篮历史上有哪些巨星
1、迈克尔·乔丹迈克尔·乔丹,全球最具影响力的篮球运动员,也是世界上最伟大的篮球运动员,球迷们送了他一个外号“篮球之神”,可见乔丹在篮球运动中的影响力。曾在1984年和1992年两次带队参加奥运会,最终两次均以全胜战绩夺取金牌。2、
竞价推广之SEMer如何快速做好竞争对手分析?
俗话说,知己知彼百战不殆。且它在一定程度上决定了我们的推广策略以及账户优化方向。那么,小编想问你:对于你的竞争对手,你了解多少?日常你又会针对竞争对手做哪些分析?我想对于大多数人来说,都是一时兴起点击一下广告,并没有一定的目
赵丽颖黑粉的行为,深度分析与反思_反馈记录和整理
摘要:本文关注赵丽颖黑粉的行为,对其进行了深度分析与反জ
相关文章
推荐文章
发表评论
0评