00001
00002 #ifndef __JBXL_LDAP_TOOL_H_
00003 #define __JBXL_LDAP_TOOL_H_
00004
00005
00023 #include "xtools.h"
00024
00025
00026 #ifndef HAVE_LDAP_H
00027 #ifndef DISABLE_LDAP
00028 #define DISABLE_LDAP
00029 #endif
00030 #endif
00031
00032 #ifdef DISABLE_LDAP
00033 #undef ENABLE_LDAP
00034 #endif
00035
00036
00037
00038 #ifdef ENABLE_LDAP
00039
00040
00041 #ifndef LDAP_DEPRECATED
00042 #define LDAP_DEPRECATED 1
00043 #endif
00044
00045 #include <ldap.h>
00046
00047
00048 struct _jbl_ldap_host {
00049 Buffer hostname;
00050 unsigned short port;
00051 int useSSL;
00052 int reqCert;
00053 };
00054
00055
00056 struct _jbl_ldap_dn {
00057 Buffer base;
00058 Buffer dnbind;
00059 Buffer passwd;
00060 };
00061
00062
00063 typedef struct _jbl_ldap_host JBXL_LDAP_Host;
00064 typedef struct _jbl_ldap_dn JBXL_LDAP_Dn;
00065
00066
00067 void read_ldap_config(char* fn, JBXL_LDAP_Host* ldap_host, JBXL_LDAP_Dn* ldap_bind);
00068 LDAP* open_ldap_connection(JBXL_LDAP_Host* ldap_host, JBXL_LDAP_Dn* ldap_bind);
00069
00070 int simple_check_ldap_passwd(LDAP* ld, char* userid, char* passwd, JBXL_LDAP_Dn* ldap_bind);
00071 int check_ldap_passwd(LDAP* ld, JBXL_LDAP_Dn* user, JBXL_LDAP_Dn* ldap_bind);
00072 void close_ldap_connection(LDAP* ld, JBXL_LDAP_Host** p_ldap_host, JBXL_LDAP_Dn** p_ldap_bind);
00073
00074 void init_LDAP_Host(JBXL_LDAP_Host* host);
00075 void init_LDAP_Dn(JBXL_LDAP_Dn* dn);
00076
00077 void free_LDAP_Host(JBXL_LDAP_Host* host);
00078 void free_LDAP_Dn(JBXL_LDAP_Dn* dn);
00079
00080 JBXL_LDAP_Host* new_LDAP_Host(void);
00081 JBXL_LDAP_Dn* new_LDAP_Dn(void);
00082
00083 void del_LDAP_Host(JBXL_LDAP_Host** p_host);
00084 void del_LDAP_Dn(JBXL_LDAP_Dn** p_dn);
00085
00086
00087 #endif // ENABLE_LDAP
00088
00089 #endif // __JBXL_LDAP_TOOL_H_
00090