验证域用户凭据 [英] Validating domain user credentials

查看:509
本文介绍了验证域用户凭据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一种方法来验证用户/密码对Windows上的本地C ++。 输入用户名和密码,用户可以在域\用户格式。

I need a way to validate a user/password pair for native c++ on windows. Input is user and password, user can be in DOMAIN\user format.

基本上,我需要编写一个函数: 如果用户/密码是一个有效的本地帐户,返回true。 (第1部分) 如果用户/密码是否有效给出的领域,也返回true。 (第2部分) 否则返回false。

Basically I need to write a function that: If user/password is a valid local account, returns true. (part 1) If user/password is valid on the domain given, return true also. (part 2) else return false.

使用 KB180548 我解决了(第一部分)(但我也不得不检查,如果用户名字是一个有效的用户,因为失败的用户使用空密码 - 丑陋的解决方法,但它的工作原理)

Using KB180548 I solved (part 1) (but I had to also check if the user name is a valid user, because fails for users with blank passwords - ugly workaround but it works)

不过,对于任何域之外,上面的KB样品code ++工程(错误)的任何用户名/密码对。

However for any domain besides ".", the above KB sample code works(incorrectly) for any user/pass pair.

我已经使用ldap_bind_s尝试过,但它成功了不正确的用户名/密码对(可怕的来宾帐户?)。此外,对于将。域,它失败了有效的用户/密码与LDAP_SERVER_DOWN(也许是因为本地主机是不是域控制器?)

I've tried using ldap_bind_s, but it succeeds for incorrect user/pass pairs(the dreaded Guest account?). Also, for the "." domain, it fails for valid user/passwords with LDAP_SERVER_DOWN (maybe because the local host is not a domain controller?)

也许有的这些概念都不清楚我。我希望至少我的问题是清楚的解释。 我不会停留在任何方式,日志,因为它可以只用C ++本机code来实现。

Maybe some of these notions are unclear to me. I hope at least my problem is explained clearly. I'm not stuck on any method, as log as it can be implemented just in C++ native code.

此问题 C#中:如何验证域凭据似乎有它想通了(除了没有公认的答案)。唉,这是在C#。

This question C#: How to validate domain credentials? seems to have it figured it out (except there is no accepted answer). Alas, it is in C#.

编辑:来吧,堆栈溢出,你从来没让我失望过......

Come on, Stack Overflow, you've never let me down before...

推荐答案

如果你的意思。域,域不在受信任W /运行从失败code域,那么这是由设计。

If you mean by the "." domain, domains that aren't "trusted" w/ the domain running the code from fail, then that is by design.

这个时候我们采用了支持票是使用WNetUseConnection()。几年前微软最好的答案

Several years ago Microsoft best answer to this when we used a support ticket was to use WNetUseConnection() .

这篇关于验证域用户凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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