简体   繁体   English

如何修复 Win32 上的错误 1935 API LogonUser() Function

[英]How to Fix Error 1935 on Win32 API LogonUser() Function

I'm trying to use this Function .我正在尝试使用这个 Function

The User I'm trying to impersonate is not in the same domain.我试图模拟的用户不在同一个域中。 I can mount the share using the credentials just fine.我可以使用凭据安装共享就好了。

But whenever I call LogonUser但是每当我打电话给 LogonUser

bLogonSucc = ::LogonUser(sUserName
            , sDomain
            , sUserPW
            , LOGON32_LOGON_INTERACTIVE
            , LOGON32_PROVIDER_DEFAULT
            , &hToken);

I get the error 1935:我收到错误 1935:

ERROR_AUTHENTICATION_FIREWALL_FAILED
1935 (0x78F)
The computer you are signing into is protected by an authentication firewall. The specified account is not allowed to authenticate to the computer.

My goal is to open a File on a Server, where the User is used as Login to said destination and open the File.我的目标是在服务器上打开一个文件,其中用户用作登录到所述目的地并打开文件。

If I use LOGON32_LOGON_NEW_CREDENTIALS as Parameter, the LogonUser Function & Impersonate works, but somehow still doesn't work later on in the code.如果我使用LOGON32_LOGON_NEW_CREDENTIALS作为参数,LogonUser Function & Impersonate 可以工作,但后来在代码中仍然无法工作。

Can't seem to find a solution for this.似乎无法为此找到解决方案。

Any Ideas on how to solve this?关于如何解决这个问题的任何想法? The Firewall should be setup correctly.防火墙应正确设置。

This error occurs because the user or group, has been granted the correct rights to access the share.发生此错误的原因是用户或组已被授予访问共享的正确权限。 But the share is in another domain, and even though that domain trusts the one the user is coming from , the trust was set up with 'selective authentication'.但是该共享位于另一个域中,即使该域信任用户来自的域,该信任也是通过“选择性身份验证”设置的。

You can try this.你可以试试这个。

Go to the domain that's providing the share, log into a domain controller Go 到提供共享的域,登录到域 controller

  1. Open 'Control Panel\System and Security\Administrative Tools'打开“控制面板\系统和安全\管理工具”
  2. Open 'Active Directory Users and Computers'打开“Active Directory 用户和计算机”
  3. View看法
  4. Advanced Features高级功能
  5. Locate the COMPUTER you are trying to authenticate找到您要验证的计算机
  6. Properties特性
  7. Security安全
  8. Add in the user (or group) that requires access添加需要访问的用户(或组)
  9. Grant the “Allowed to authenticate” right授予“允许验证”权限
  10. Apply and OK申请并确定

允许验证权限

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM