英文:
Error in LDAP, LDAP Result Code 2 \"Protocol Error\": 0000203D: LdapErr: DSID-0C091137, comment: Unknown extended request OID, data 0, v3839
问题
这里的问题是什么?我提供了旧密码和新密码,但在更改密码时出现了问题。
- 我正在使用LDAP V3。
根据请求,我正在使用PasswordModifyRequest,其中包括旧密码、新密码和用户DN作为域登录。
无论如何,总是出现这个问题。我的代码有问题吗?还是AD上应该进行一些特定的设置,以便我的方法可以工作?
baseDN := "dc=" + strings.Replace(ldap.Domain, ".", ",dc=", -1)
pass := ldap2.PasswordModifyRequest{
UserIdentity: baseDN,
OldPassword: OldPassword,
NewPassword: NewPassword,
}
// 将ModifyRequest发送到服务器
res, err := li.Conn.PasswordModify(&pass)
if err != nil {
fmt.Printf("更改密码时出错:%s\n", err)
return err
}
英文:
What is the problem over here? I'm prioviding old, and new password. But somehow getting this problem while changing password.
-
I'm using LDAP V3
As request I'm using PasswordModifyRequest with oldPassword, newPassword and UserDN as domainLogin.
Somehow always getting this issue. Is there a problem with my code or there should some specific setting on AD so my method can work?baseDN := "dc=" + strings.Replace(ldap.Domain, ".", ",dc=", -1) pass := ldap2.PasswordModifyRequest{ UserIdentity: baseDN , OldPassword: OldPassword, NewPassword: NewPassword, } // Send the ModifyRequest to the server res, err := li.Conn.PasswordModify(&pass) if err != nil { fmt.Printf("Error changing the password: %s\n", err) return err }
答案1
得分: 0
找到了一个解决方案。我决定使用Modify而不是ModifyPassword。问题本身与服务器属性和AD的版本有关。在我的情况下,我提供了更具体的DN属性和控制来使用Modify。
controlTypes, err := getSupportedControl(li.Conn)
if err != nil {
return err
}
control := []ldap2.Control{}
for _, oid := range controlTypes {
if oid == controlTypeLdapServerPolicyHints || oid == controlTypeLdapServerPolicyHintsDeprecated {
control = append(control, &ldapControlServerPolicyHints{oid: oid})
break
}
}
err = li.Conn.Modify(passReqA)
if err != nil {
return err
}
英文:
Found a solution. I decided to use Modify instead of ModifyPassword. The problem itself was about server properties and the version of AD. In my case, I provided more specific DN attributes and Control to use Modify.
controlTypes, err := getSupportedControl(li.Conn)
if err != nil {
return err
}
control := []ldap2.Control{}
for _, oid := range controlTypes {
if oid == controlTypeLdapServerPolicyHints || oid == controlTypeLdapServerPolicyHintsDeprecated {
control = append(control, &ldapControlServerPolicyHints{oid: oid})
break
}
}
err = li.Conn.Modify(passReqA)
if err != nil {
return err
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论