From 23cdcaf17a10e16b218828733837ece2f7706b67 Mon Sep 17 00:00:00 2001 From: alexhudson Date: Sun, 16 Sep 2007 09:06:04 +0000 Subject: [PATCH] Stub out an optional LDAP-based auth backend --- configure.ac | 3 ++ src/libs/msgapi/Bongo.rules | 8 +++++ src/libs/msgapi/auth-backends/ldap.c | 51 ++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 src/libs/msgapi/auth-backends/ldap.c diff --git a/configure.ac b/configure.ac index cd48096..6bd82f3 100644 --- a/configure.ac +++ b/configure.ac @@ -260,10 +260,12 @@ LIBS=$SAVE_LIBS AC_SUBST(RESOLV_LIBS) have_ldap="no" +info_ldap="No. LDAP auth backend will be unavailable." AC_CHECK_HEADER(ldap.h,[ AC_CHECK_LIB(ldap, ldap_init,[ LDAP_LIBS="-lldap" have_ldap="yes" + info_ldap="Yes. LDAP auth backend will be available." ]) ]) AM_CONDITIONAL(HAVE_LDAP,test "$have_ldap" = "yes") @@ -717,5 +719,6 @@ Imported libraries: libical: ${info_libical} Optional libraries: + LDAP: ${info_ldap} Check: ${info_check} ]) diff --git a/src/libs/msgapi/Bongo.rules b/src/libs/msgapi/Bongo.rules index 4d246b8..0ceb621 100644 --- a/src/libs/msgapi/Bongo.rules +++ b/src/libs/msgapi/Bongo.rules @@ -44,6 +44,14 @@ libauthsqlite3_la_CPPFLAGS = $(AM_CPPFLAGS) $(SQLITE_CFLAGS) libauthsqlite3_la_LIBADD = \ $(SQLITE_LIBS) +if HAVE_LDAP +auth_LTLIBRARIES += libauthldap.la +endif + +libauthldap_la_SOURCES = src/libs/msgapi/auth-backends/ldap.c +libauthldap_la_CPPFLAGS = $(AM_CPPFLAGS) +libauthldap_la_LIBADD = $(LDAP_LIBS) + src/libs/msgapi/all: libbongomsgapi.la $(auth_LTLIBRARIES) src/libs/msgapi/clean: clean src/libs/msgapi/install: diff --git a/src/libs/msgapi/auth-backends/ldap.c b/src/libs/msgapi/auth-backends/ldap.c new file mode 100644 index 0000000..ccb99d0 --- /dev/null +++ b/src/libs/msgapi/auth-backends/ldap.c @@ -0,0 +1,51 @@ +#include +#include +#include +#include + +/* returns 0 on success */ +int +AuthLdap_Install(void) +{ + // TODO + return -1; +} + +int +AuthLdap_FindUser(const char *user) +{ + return -1; +} + +int +AuthLdap_VerifyPassword(const char *user, const char *password) +{ + return -1; +} + +/* "Write" functions below */ + +int +AuthLdap_AddUser(const char *user) +{ + return -1; +} + +int +AuthLdap_SetPassword(const char *user, const char *password) +{ + return -1; +} + +int +AuthLdap_InterfaceVersion(void) +{ + return 1; +} + +int +main (int argc, char *argv[]) +{ + printf("This cannot be run directly"); + return (-1); +}