Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Contributions to ELOG  Not logged in ELOG logo
Message ID: 148     Entry time: Mon Mar 11 09:28:15 2019
Author: Maurat 
Author Email: gm001@free.fr 
Category: Script 
Subject: Code change for LDAP authentication 
Status: Stable 
Last Revision: Mon Mar 11 10:15:43 2019 by Maurat 

Hi,

I had to change code to authenticate users in my organization's LDAP directory. Indeed, accounts are distributed under several organizational units in my LDAP directory.

The current version of the code can't authenticate accounts when these are in different organizational units. Hence my contribution.

I Use a read account to request LDAP to locate the account that has logged in (with e-mail address in the search filter).

I get the number of LDAP entries. If I have one entry then I call ldap_get_dn function to get the DN account and then I call ldap_simple_bind_s using the account's DN and password to perform LDAP authentication.

I changed configuration file elogd.cfg. I added two parameters:

LDAP DN user = <DN read account>

LDAP PW user = <password read account>

I changed code auth.c too (see attached file)

I had to change Makefile. I added a call to lber library

ifdef USE_LDAP
ifneq ($(USE_LDAP),0)
CFLAGS += -DHAVE_LDAP
LIBS += -lldap -llber
endif
endif

Have good day

 

 

 

 

 

 

Attachment 1: auth.c  21 kB  | Show | Show all
ELOG V3.1.5-3fb85fa6