在 Linux 中,我可以像这样运行 ldapdelete
sudo ldapdelete -x -w 1234 -D "cn=Manager,o=project1" -r "o=project1"
现在我想使用 ANT 任务来执行此操作:
<target name="ldap-delete">
<exec executable="ldapdelete" failonerror="false">
<arg value="-x"/>
<arg value="-w"/>
<arg value="${ldap.password}"/>
<arg value="-D"/>
<arg value=""${ldap.rootdn}""/>
<arg value="-r"/>
<arg value=""${ldap.entry}""/>
</exec>
</target>
但在运行 ANT 时失败:
[exec] ldap_bind: Invalid DN syntax (34)
[exec] additional info: invalid DN
[exec] Result: 1
我的 ANT 任务脚本出了什么问题?
谢谢
根据Martin Clayton的评论,我删除了-D和-r arg值周围的引号,如下所示:
<arg value="-D"/>
<arg value="${ldap.rootdn}"/>
<arg value="-r"/>
<arg value="${ldap.entry}"/>
并以详细模式运行 ant,我收到以下错误:
[echo] ldapdelete...
[exec] Current OS is Linux
[exec] Executing 'ldapdelete' with arguments:
[exec] '-x'
[exec] '-w'
[exec] '1234'
[exec] '-D'
[exec] 'cn=Manager,o=project1'
[exec] '-r'
[exec] 'o=project1'
[exec]
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
[exec] ldap_search: No such object (32)
[exec] ldap_delete: No such object (32)
[exec] Result: 32
最终自己
得到了一个解决方案:
<target name="ldap-delete">
<exec executable="ldapdelete" failonerror="false">
<arg line="-x -w ${ldap.password} -D "${ldap.rootdn}" -r "${ldap.entry}""/>
</exec>
</target>