ldap - LDAP 中的扩展 errno

标签 ldap openldap

以下是我的 C 代码行:

ldap_bind_s(ld, root_dn, root_pw, auth_method) != LDAP_SUCCESS  

ldap_perror( ld, "ldap_bind" );//to print the EXACT error like 525,52e

执行时

Project  ./a.out CN=username,OU=ABC,DC=example,DC=com wrong-pasword
     ldap_bind: Invalid credentials (49)
   additional info: 80090308: LdapErr: DSID-0C090334, comment:  
AcceptSecurityContext      error, data 52e, vece

这里data后面的字符串52e代表扩展错误。 任何人都可以建议我如何直接访问此扩展错误。目前我正在解析字符串以提取该值。通常,当我打印 LDAP_OPT_ERROR_NUMBER 时,它仅返回 49(INVALID_CREDENTIALS) 但这对我来说还不够。如何获取扩展错误的代码(仅代码)。
我什至尝试打印 ld->ld_errno 但它不允许我,因为没有内存分配给 ld。

最佳答案

您必须解析错误字符串才能提取错误号,因为您无法从 LDAP 结构中看到错误代码,因为它是不透明数据类型并且您可以访问的元素>LDAP结构只能通过例程才能看到不完整的结构定义。

关于ldap - LDAP 中的扩展 errno,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15217144/

相关文章:

docker - 在 Sonarqube Docker 容器中设置 LDAPS 登录时遇到问题

java - 我可以使用像 ApacheDS 这样的 LDAP 服务器作为桌面应用程序的持久性解决方案吗?

java - 使用 Java 从 LDAP 检索所有用户及其角色

authentication - openldap fortress 与 Apache Shiro

openldap - 模板值错误 [gidNumber] phpLDAPadmin

ldap - 应用 LDIF - OpenLDAP 时出现错误 50(访问权限不足)

react-native - 使用 React Native 和 Firebase 自定义 token 在 LDAP 服务器上进行身份验证

java - 解密 OpenLDAP 密码

active-directory - 为什么公司不将LDAP用作用户以外的中央存储库?

jenkins - 无法在 Jenkins 中使用 LDAP 登录