/* $Id: ldap_client.c,v 1.5 2006/05/13 01:12:59 jonz Exp $ */ /* DSPAM COPYRIGHT (C) 2002-2006 JONATHAN A. ZDZIARSKI This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include #endif #ifdef USE_LDAP #include #include #include #include #include "libdspam.h" #include "ldap_client.h" #include "config.h" #include "language.h" #include "error.h" #include "config_shared.h" int ldap_verify(DSPAM_CTX *CTX, const char *username) { LDAP *ld; int result, i; int desired_version = LDAP_VERSION3; char *ldap_host = _ds_read_attribute(CTX->config->attributes, "LDAPHost"); char search_filter[1024]; LDAPMessage *msg; char* base = _ds_read_attribute(CTX->config->attributes, "LDAPBase"); char* filter = _ds_read_attribute(CTX->config->attributes, "LDAPFilter"); if (!base || !filter || !ldap_host) { LOG(LOG_ERR, ERR_LDAP_MISCONFIGURED); return EFAILURE; } for(i=0;i 0; ldap_msgfree (msg); ldap_unbind(ld); return result; } #endif