LDAP support added

- This patch enables LCDd to retrieve its configuration
  options from an LDAP directory.
- The code was tested with OpenLDAP 2.1.x (21<=x<=22) only.
- LDAP support is disabled by default and has to be enabled
  with ./configure --enable-ldap.
  (See ./configure --help for other options. Not all options
  have any effect yet.)
- Currently only anonymous LDAP binds are supported.
- The DN of the main configuration object has to be passed to LCDd
  instead of the configuration file location:
  LCDd -c "ldap://yourhost.yourcompany.com/cn=config1,cn=lcdproc,dc=yourcompany dc=COM"
  The basic idea behind the LCDproc object classes is that they
  are more or less verbatim copies of the corresponding sections in a
  generic LCDd.conf
- Unfortunately schema files cannot be provided yet, because LCDproc does
  not have a registered OID namespace and OID hijacking is prohibited.
This commit is contained in:
reenoo
2003-12-25 15:02:34 +00:00
parent 63550c6f3f
commit e4e948523f
6 changed files with 422 additions and 4 deletions
+180
View File
@@ -202,6 +202,186 @@ AC_MODULES_INFO
LCD_DRIVERS_SELECT
dnl ######################################################################
dnl Open LDAP
dnl based on code from perdition http://www.vergenet.net/linux/perdition/
dnl
dnl not all options have effect at the moment
AC_SUBST(ldap_libs)
AC_SUBST(ldap_includes)
AC_SUBST(ldap_schemadir)
AC_MSG_CHECKING([if LDAP support has been enabled]);
AC_ARG_ENABLE(
ldap,
[ --enable-ldap compile with LDAP support. ],
[
if test "$enable_ldap" = "yes"; then
AC_MSG_RESULT("yes")
else
AC_MSG_RESULT("no")
fi
],
[
enable_ldap="no";
AC_MSG_RESULT("no")
]
)
if test "$enable_ldap" = "yes"; then
AC_ARG_WITH(
ldap-includes,
[ --with-ldap-includes=DIR
Open LDAP include files are in DIR. ],
[
if test "$withval" = "no"; then
ldap_build_dir="";
else
ldap_includepath="$withval"
fi
],
[
AC_MSG_CHECKING(OpenLDAP include path)
for ldap_includepath in /usr/openldap/include /usr/local/openldap/include \
/usr/include/openldap /usr/local/include/openldap \
/usr/include /usr/local/include; do
if test -f "${ldap_includepath}/ldap.h"; then
break
fi
done
AC_MSG_RESULT($ldap_includepath)
]
)
fi
ldap_includes="-I$ldap_includepath"
if test "$enable_ldap" = "yes"; then
AC_ARG_WITH(
ldap-libraries,
[ --with-ldap-libraries=DIR
Open LDAP library files are in DIR. ],
[
if test "$withval" = "no"; then
ldap_build_dir="";
else
ldap_libpath="$withval"
fi
],
[
AC_MSG_CHECKING(OpenLDAP library path)
for ldap_libpath in /usr/openldap/lib /usr/local/openldap/lib \
/usr/lib/openldap /usr/local/lib/openldap \
/usr/lib /usr/local/lib; do
if test -f "${ldap_libpath}/libldap.a" \
-o -f "${ldap_libpath}/libldap.so"; then
break
fi
done
AC_MSG_RESULT($ldap_libpath)
]
)
fi
ldap_libs="-L$ldap_libpath -lldap -llber"
if test "$enable_ldap" = "yes"; then
AC_CHECK_FILE(
$ldap_includepath/ldap.h,
[ : ] ,
[ enable_ldap="no" ]
)
fi
if test "$enable_ldap" = "yes"; then
AC_CHECK_LIB(
ldap,
ldap_url_parse,
[ : ],
[ enable_ldap="no" ],
$ldap_libs
)
fi
if test "$enable_ldap" = "yes"; then
AC_MSG_CHECKING(OpenLDAP lud_exts in LDAPURLDesc)
AC_TRY_COMPILE([#include <stdlib.h>
#include <lber.h>
#include <ldap.h>],
[LDAPURLDesc ludp;
ludp.lud_exts[0] = NULL;],
AC_MSG_RESULT("yes")
AC_DEFINE(WITH_LDAP_LUD_EXTS, 1, Compile with LDAP lud_exts),
AC_MSG_RESULT("no")
AC_MSG_WARN(
""
"************************************************************"
"* Password and Username support will not be built in the"
"* LDAP module. For Password and Username support compile"
"* openldap2. Available from openldap.org"
"************************************************************"
)
)
fi
if test "$enable_ldap" = "yes"; then
AC_CHECK_LIB(ldap, ldap_set_option,
AC_DEFINE(WITH_LDAP_SET_OPTION, 1, Compile with LDAP set_option),
AC_MSG_WARN(
""
"************************************************************"
"* Cannot expicitly set network timeout or ldap protocol"
"* version. For ldap_set_option support please use openlap2."
"* Available from openldap.org"
"************************************************************"
),)
fi
if test "$enable_ldap" = "yes"; then
AC_ARG_WITH(
ldap-schema-directory,
[ --with-ldap-schema-directory=DIR
Open LDAP schema files are in DIR. ],
[
if test "$withval" = "no"; then
ldap_schemadir="";
else
ldap_schemadir="$withval"
fi
],
[
AC_MSG_CHECKING(OpenLDAP schema path)
for ldap_schemadir in /etc/openldap/schema /etc/ldap/schema \
/usr/local/openldap/etc/schema; do
if test -f "${ldap_schemadir}/openldap.schema"; then
break
fi
ldap_schemadir="Not found"
done
AC_MSG_RESULT($ldap_schemadir)
if test "$ldap_schemadir" = "Not found"; then
AC_MSG_WARN(
""
"************************************************************"
"* Could not find OpenLDAP schema directory."
"* lcdproc.schema will not be installed"
"************************************************************"
)
ldap_schemadir=""
fi
]
)
fi
if test "$enable_ldap" = "yes"; then
AC_DEFINE(WITH_LDAP_SUPPORT, 1, Compile in LDAP support)
else
ldab_libs="";
ldap_includes="";
fi
AC_OUTPUT(Makefile
shared/Makefile
server/Makefile