gpt4 book ai didi

active-directory - 使用 UnboundID 添加组条目时不会执行错误 503

转载 作者:行者123 更新时间:2023-12-04 07:21:51 37 4
gpt4 key购买 nike

我正在尝试使用 UnboundID LDAP SDK 将组添加到我的 Active Directory 服务,并不断收到错误 503:将无法执行。

我已经验证我正在使用 SSL 连接,并且我正在与属于 Administrators 组的用户连接,除非我弄错了,否则他有权创建新条目。

我还将 LDAP 接口(interface)事件的日志记录级别一直提高到 5,并且事件查看器注册了许多事件,这些事件都无法解释为什么服务不愿意执行我的创建条目操作。

关于可能导致此问题的任何想法?

下面是我正在使用的 scala 代码示例:

val connection = connect("MyAdminUser", "MyAdminPass")

val addGroupResult = connection.add("CN=TestGroup2,OU=Groups,OU=mydomain,DC=mydomain,DC=local",
new Attribute("objectClass", "top", "group"),
new Attribute("name","TestGroup2"),
new Attribute("sAMAccountName","TestGroup2"),
new Attribute("sAMAccountType","268435456"),
new Attribute("objectCategory","CN=Group,CN=Schema,CN=Configuration,DC=mydomain,DC=local"),
new Attribute("cn","TestGroup2"),
new Attribute("distinguishedName","CN=TestGroup2,OU=Groups,OU=mydomain,DC=mydomain,DC=local"),
new Attribute("instanceType","4"),
new Attribute("groupType","-2147483646")
)

private def connect(user: String, pass: String) = {
val options = new LDAPConnectionOptions()
options.setFollowReferrals(true)
val sslUtil = new SSLUtil(new TrustAllTrustManager())
val socketFactory = sslUtil.createSSLSocketFactory()
new LDAPConnection(socketFactory, options, host, securePort, DN(user), pass)
}

这是我收到的错误消息:
Exception in thread "main" LDAPException(resultCode=53 (unwilling to perform), errorMessage='0000209A: SvcErr: DSID-031A104A, problem 5003 (WILL_NOT_PERFORM), data 0', diagnosticMessage='0000209A: SvcErr: DSID-031A104A, problem 5003 (WILL_NOT_PERFORM), data 0')

最佳答案

我的错误是在添加操作中包含太多属性,其中一些不应该手动设置,而是由 SAM(安全帐户管理器)设置。

正确的代码如下:

val addGroupResult = connection.add("CN=TestGroup2,OU=Groups,OU=simpleBI,DC=domain,DC=local",
new Attribute("objectClass", "top", "group"),
new Attribute("name","TestGroup2"),
new Attribute("sAMAccountName","TestGroup2"),
new Attribute("objectCategory","CN=Group,CN=Schema,CN=Configuration,DC=domain,DC=local")
)

请注意,我删除了一些属性,包括被 AD 拒绝的 sAMAccountType。我还删除了一些多余的。我相信我所拥有的是满足我需求的最小属性集。

连接代码未更改。

关于active-directory - 使用 UnboundID 添加组条目时不会执行错误 503,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15972168/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com