Tag: ldap

使用C访问Active Directory

在http://www-archive.mozilla.org/directory/csdk-docs/example.htm的代码中进行了一些修改之后,我尝试了以下代码。 # include # include “ldap.h” int main( int argc, char **argv ) { LDAP *ld; int rc; /* Get a handle to an LDAP connection. */ if ( (ld = ldap_init( “ipaddr”, port )) == NULL ) { perror( “ldap_init” ); return( 1 ); } /* Bind anonymously to the LDAP server. */ rc […]

LDAP身份validation,ldap_sasl_bind_s无效,但ldap_simple_bind_s有效

我有一个问题,在ldap_sasl_bind_s不起作用,但ldap_simple_bind_s工作。 奇怪的是,ldap_sasl_bind_s甚至可以使用错误的密码,并让用户感觉他输入了正确的密码。 问题的PFA代码片段,如果我的方法有任何问题,请告诉我。 { int rc, aReturnVal = 0; NSString *aUserDN = [NSString stringWithFormat:@”uid=%s,cn=users,dc=example,dc=com”, username]; char* userDN = (char*)[aUserDN UTF8String]; rc = ldap_simple_bind_s ( ld, userDN, password ); // TODO: ldap_simple_bind_s is a deprecated method and should not be used for long. ldap_sasl_bind_s is the right method, but is not working for now. // Find […]