当设备是域成员时,LDAP查询不起作用

时间:2015-09-28 14:08:00

标签: php ldap

当我的设备将其用作域成员时,此php代码会出错。

$ ldap = @ldap_connect(ldaphost,ldapport);

ldap_set_option($ ldap,LDAP_OPT_PROTOCOL_VERSION,3);

如果(@ldap_bind($ LDAP,登录,密码)){

$result = ldap_search($this->lcon,'DC=XXXXXXX,DC=CRP','(&(memberOf=CN=XXXXXX,OU=XXXXXX,DC=XXXXX,DC=CRP)(sAMAccountName='.login.'))')  ;   
    }  

2 个答案:

答案 0 :(得分:0)

试试这个:

-(void)loadMasterView
{
    // set the idle timer to be disabled.
    [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
    self.window.rootViewController =self.masterViewController;
    dispatch_async(dispatch_get_main_queue(), ^{

        HomeScreenController *homeScreenController = [[HomeScreenController alloc] initWithNibName:@"HomeScreenController" bundle:nil];
        homeScreenController.masterViewController = self.masterViewController;
        [self.masterViewController pushViewController:homeScreenController];
    });  
}

我刚刚将周围的$ldap = @ldap_connect(ldaphost,ldapport); ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); if(@ldap_bind($ldap,login,password)){ $result = ldap_search($this->lcon,'DC=XXXXXXX,DC=CRP','(&(memberOf=CN=XXXXXX,OU=XXXXXX,DC=XXXXX,DC=CRP)(sAMAccountName='.login.'))'); } 更改为",并删除了ldap_search-command中的内部'

答案 1 :(得分:0)

为了修复它,我使用了here

中的LDAP.php