Koozali.org: home of the SME Server

LDAP Query

Offline Brave Dave

  • *
  • 187
  • +0/-0
LDAP Query
« on: December 29, 2025, 05:33:00 AM »
A Question about LDAP

- I'm considering using Koozali SME Server as a primary authentication server
and
- I want to know if an account is locked

Using PHP from another machine, I can check is a user can login in by checking their LDAP  - simple - works

Code: [Select]
if (@ldap_bind($ldap, $dn, $password)) return true;

if I do an ldap_search
- is there any entry which will tell me that the account is locked

i.e.
- go to user manager
- lock the account
- then, using ldap, can I tell if the account is locked

(it looks to me like the answer is no)

thanks in advance
.:DB:.

Offline bunkobugsy

  • *
  • 320
  • +4/-0
Re: LDAP Query
« Reply #1 on: December 29, 2025, 10:22:54 AM »
No, I don't seem to see any difference with LdapAdmin either.
If an account has never had a password set it's missing displayName attribute and sambaSamAccount objectClass.
But your only goal should only be https://wiki.koozali.org/LDAP_Authentication_for_applications

Offline Jean-Philippe Pialasse

  • *
  • 2,944
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: LDAP Query
« Reply #2 on: December 31, 2025, 08:27:03 PM »
user is locked by setting this , so search if user has userPassword equal to {crypt}!*


but you might need privileges to do so. 

Code: [Select]
sub ldaplockuser {
  my $self = shift ;
  my $userName = shift;
  my $base = $self->base;
  my $result = $self->modify("uid=$userName,ou=Users,$base",
               replace => { 'userPassword' => "{crypt}!*"});
 return $result->code;
}


Offline Brave Dave

  • *
  • 187
  • +0/-0
Re: LDAP Query
« Reply #3 on: January 01, 2026, 04:12:45 AM »
Thanks bunkobugsy and Jean-Philippe Pialasse

I'll try that search
.:DB:.