2003-03-17 07:49:25 +01:00
|
|
|
/*
|
|
|
|
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
|
2012-05-27 19:31:10 +02:00
|
|
|
* Copyright (C) 2003-2012 Match Grun and the Claws Mail team
|
2003-03-17 07:49:25 +01:00
|
|
|
*
|
|
|
|
* 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
|
2007-07-11 18:38:12 +02:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2003-03-17 07:49:25 +01:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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
|
2007-07-11 18:38:12 +02:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
2003-03-17 07:49:25 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Functions for LDAP control data.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __LDAPCTRL_H__
|
|
|
|
#define __LDAPCTRL_H__
|
|
|
|
|
|
|
|
#ifdef USE_LDAP
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Constants.
|
|
|
|
*/
|
|
|
|
#define LDAPCTL_DFL_PORT 389
|
2006-04-24 19:02:07 +02:00
|
|
|
#define LDAPCTL_DFL_SSL_PORT 636
|
2003-03-17 07:49:25 +01:00
|
|
|
#define LDAPCTL_MAX_ENTRIES 30
|
|
|
|
#define LDAPCTL_DFL_TIMEOUT 30
|
|
|
|
#define LDAPCTL_DFL_QUERY_AGE 600
|
|
|
|
#define LDAPCTL_MAX_QUERY_AGE 86400
|
|
|
|
|
|
|
|
#define LDAPCTL_ATTR_EMAIL "mail"
|
|
|
|
#define LDAPCTL_ATTR_COMMONNAME "cn"
|
|
|
|
#define LDAPCTL_ATTR_GIVENNAME "givenName"
|
|
|
|
#define LDAPCTL_ATTR_SURNAME "sn"
|
2007-03-22 18:53:17 +01:00
|
|
|
#define LDAPCTL_ATTR_PHONE "telephoneNumber"
|
2007-04-17 11:16:46 +02:00
|
|
|
#define LDAPCTL_ATTR_DISPLAYNAME "displayName"
|
2003-03-17 07:49:25 +01:00
|
|
|
|
2007-07-09 21:59:36 +02:00
|
|
|
#define LDAPCTL_DFL_ATTR_LIST "mail, cn, givenName, sn, displayName"
|
2003-03-17 07:49:25 +01:00
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
/*
|
|
|
|
* Search matching options.
|
|
|
|
*/
|
|
|
|
#define LDAPCTL_MATCH_BEGINWITH 0
|
|
|
|
#define LDAPCTL_MATCH_CONTAINS 1
|
|
|
|
|
2003-03-17 07:49:25 +01:00
|
|
|
/*
|
|
|
|
* Data structures.
|
|
|
|
*/
|
|
|
|
typedef struct _LdapControl LdapControl;
|
|
|
|
struct _LdapControl {
|
|
|
|
gchar *hostName;
|
|
|
|
gint port;
|
|
|
|
gchar *baseDN;
|
|
|
|
gchar *bindDN;
|
|
|
|
gchar *bindPass;
|
|
|
|
gint maxEntries;
|
|
|
|
gint timeOut;
|
|
|
|
gint maxQueryAge;
|
2004-01-12 22:28:31 +01:00
|
|
|
gint matchingOption;
|
2004-07-24 16:15:23 +02:00
|
|
|
gint version;
|
|
|
|
gboolean enableTLS;
|
2006-04-24 19:02:07 +02:00
|
|
|
gboolean enableSSL;
|
2003-03-17 07:49:25 +01:00
|
|
|
gchar *attribEMail;
|
|
|
|
gchar *attribCName;
|
|
|
|
gchar *attribFName;
|
|
|
|
gchar *attribLName;
|
2007-04-17 11:16:46 +02:00
|
|
|
gchar *attribDName;
|
2003-03-17 07:49:25 +01:00
|
|
|
GList *listCriteria;
|
|
|
|
pthread_mutex_t *mutexCtl;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Function prototypes */
|
|
|
|
LdapControl *ldapctl_create ( void );
|
|
|
|
void ldapctl_set_host ( LdapControl* ctl, const gchar *value );
|
|
|
|
void ldapctl_set_port ( LdapControl* ctl, const gint value );
|
|
|
|
void ldapctl_set_base_dn ( LdapControl* ctl, const gchar *value );
|
|
|
|
void ldapctl_set_bind_dn ( LdapControl* ctl, const gchar *value );
|
2010-02-03 17:58:03 +01:00
|
|
|
void ldapctl_set_bind_password
|
|
|
|
( LdapControl* ctl, const gchar *value, gboolean encrypt, gboolean change );
|
|
|
|
gchar* ldapctl_get_bind_password ( LdapControl* ctl );
|
2003-03-17 07:49:25 +01:00
|
|
|
void ldapctl_set_max_entries ( LdapControl* ctl, const gint value );
|
|
|
|
void ldapctl_set_timeout ( LdapControl* ctl, const gint value );
|
|
|
|
void ldapctl_set_max_query_age ( LdapControl* ctl, const gint value );
|
2004-01-12 22:28:31 +01:00
|
|
|
void ldapctl_set_matching_option( LdapControl* ctl, const gint value );
|
2004-07-24 16:15:23 +02:00
|
|
|
void ldapctl_set_tls ( LdapControl* ctl, const gboolean value );
|
2006-04-24 19:02:07 +02:00
|
|
|
void ldapctl_set_ssl ( LdapControl* ctl, const gboolean value );
|
2003-03-17 07:49:25 +01:00
|
|
|
GList *ldapctl_get_criteria_list( const LdapControl* ctl );
|
|
|
|
void ldapctl_criteria_list_clear( LdapControl *ctl );
|
|
|
|
void ldapctl_criteria_list_add ( LdapControl *ctl, gchar *attr );
|
|
|
|
void ldapctl_free ( LdapControl *ctl );
|
|
|
|
void ldapctl_print ( const LdapControl *ctl, FILE *stream );
|
|
|
|
void ldapctl_copy ( const LdapControl *ctlFrom,
|
|
|
|
LdapControl *ctlTo );
|
|
|
|
gchar *ldapctl_format_criteria ( LdapControl *ctl, const gchar *searchVal );
|
|
|
|
char **ldapctl_attribute_array ( LdapControl *ctl );
|
2007-08-21 11:37:03 +02:00
|
|
|
char **ldapctl_full_attribute_array( LdapControl *ctl );
|
2003-03-17 07:49:25 +01:00
|
|
|
void ldapctl_free_attribute_array( char **ptrArray );
|
|
|
|
void ldapctl_parse_ldap_search ( LdapControl *ctl, gchar *criteria );
|
2007-07-09 21:59:36 +02:00
|
|
|
gchar *ldapctl_get_default_criteria(void);
|
|
|
|
GList *ldapctl_get_default_criteria_list();
|
|
|
|
gboolean ldapctl_compare_list(GList *l1, GList *l2);
|
2003-03-17 07:49:25 +01:00
|
|
|
|
|
|
|
#endif /* USE_LDAP */
|
|
|
|
|
|
|
|
#endif /* __LDAPCTRL_H__ */
|
|
|
|
|