1 /* 2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client 3 * Copyright (C) 2003-2012 Match Grun and the Claws Mail team 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 /* 21 * Some utility functions to access LDAP servers. 22 */ 23 24 #ifndef __LDAPUTIL_H__ 25 #define __LDAPUTIL_H__ 26 27 #ifdef USE_LDAP 28 29 #include <glib.h> 30 #ifdef G_OS_UNIX 31 #include <ldap.h> 32 #include <lber.h> 33 #else 34 #include <windows.h> 35 #include <winldap.h> 36 #define LDAP_CONST const 37 #define ldap_unbind_ext(ld,x,y) ldap_unbind_s(ld) 38 #define LDAP_ADMINLIMIT_EXCEEDED LDAP_ADMIN_LIMIT_EXCEEDED 39 #define timeval l_timeval 40 #ifndef LDAP_OPT_SUCCESS 41 # define LDAP_OPT_SUCCESS 0 42 #endif 43 #endif 44 /* Function Prototypes */ 45 GList *ldaputil_read_basedn ( const gchar *host, const gint port, 46 const gchar *bindDN, const gchar *bindPW, 47 const gint tov, int ssl, int tls ); 48 gboolean ldaputil_test_connect ( const gchar *host, const gint port, int ssl, int tls, int secs); 49 gboolean ldaputil_test_ldap_lib ( void ); 50 int claws_ldap_simple_bind_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *passwd ); 51 const gchar *ldaputil_get_error(LDAP *ld); 52 53 #endif /* USE_LDAP */ 54 55 #endif /* __LDAPUTIL_H__ */ 56 57 /* 58 * End of Source. 59 */ 60