Fix CID 1491093: attrib leaked if attvalue is null
[claws.git] / src / ldapserver.h
blob73ff9ec9236404215747fba10bc7dd58e8a5139e
1 /*
2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 2003-2022 Match Grun and the Claws Mail team
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.
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.
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/>.
20 * Definitions necessary to access LDAP servers.
23 #ifndef __LDAPSERVER_H__
24 #define __LDAPSERVER_H__
26 #ifdef USE_LDAP
28 #include <glib.h>
29 #ifdef G_OS_UNIX
30 #include <ldap.h>
31 #else
32 #include <stdio.h>
33 #include <string.h>
34 #include <stdarg.h>
35 #include <stdlib.h>
36 #include <ctype.h>
37 #include <errno.h>
38 #include <windows.h>
39 #include <winldap.h>
40 #include <winber.h>
41 #endif
43 #include "ldapctrl.h"
44 #include "addritem.h"
45 #include "addrcache.h"
46 #include "adbookbase.h"
47 #include "addrquery.h"
49 /* Error codes */
50 #define LDAPRC_SUCCESS 0
51 #define LDAPRC_CONNECT -1
52 #define LDAPRC_INIT -2
53 #define LDAPRC_BIND -3
54 #define LDAPRC_SEARCH -4
55 #define LDAPRC_TIMEOUT -5
56 #define LDAPRC_CRITERIA -6
57 #define LDAPRC_NOENTRIES -7
58 #define LDAPRC_STOP_FLAG -8
59 #define LDAPRC_TLS -9
60 #define LDAPRC_NODN -10
61 #define LDAPRC_NAMING_VIOLATION -11
62 #define LDAPRC_ALREADY_EXIST -12
63 #define LDAPRC_STRONG_AUTH -13
65 typedef struct _LdapServer LdapServer;
66 struct _LdapServer {
67 AddressBookType type;
68 AddressCache *addressCache;
69 gint retVal;
70 LdapControl *control;
71 gboolean searchFlag;
72 GList *listQuery;
75 /* Function prototypes */
76 LdapServer *ldapsvr_create_noctl( void );
77 LdapServer *ldapsvr_create ( void );
78 void ldapsvr_set_name ( LdapServer *server, const gchar *value );
79 void ldapsvr_set_accessed ( LdapServer *server, const gboolean value );
80 void ldapsvr_force_refresh ( LdapServer *server );
81 void ldapsvr_free_all_query ( LdapServer *server );
82 void ldapsvr_free ( LdapServer *server );
83 gint ldapsvr_get_status ( LdapServer *server );
84 gboolean ldapsvr_get_accessed ( LdapServer *server );
85 gchar *ldapsvr_get_name ( LdapServer *server );
86 gboolean ldapsvr_get_modified ( LdapServer *server );
87 void ldapsvr_set_modified ( LdapServer *server, const gboolean value );
88 gboolean ldapsvr_get_read_flag ( LdapServer *server );
89 gboolean ldapsvr_get_search_flag( LdapServer *server );
90 void ldapsvr_set_search_flag ( LdapServer *server, const gboolean value );
91 gint ldapsvr_read_data ( LdapServer *server );
93 #ifdef DEBUG_LDAP
94 void ldapsvr_print_data ( LdapServer *server, FILE *stream );
95 #endif
96 void ldapsvr_cancel_read ( LdapServer *server );
98 ItemFolder *ldapsvr_get_root_folder ( LdapServer *server );
99 GList *ldapsvr_get_list_person ( LdapServer *server );
100 GList *ldapsvr_get_list_folder ( LdapServer *server );
102 void ldapsvr_stop_query_id ( LdapServer *server, const gint queryID );
103 void ldapsvr_stop_all_query ( LdapServer *server );
104 void ldapsvr_cancel_all_query ( LdapServer *server );
105 void ldapsvr_retire_query ( LdapServer *server );
107 gboolean ldapsvr_reuse_previous ( const LdapServer *server,
108 const QueryRequest *req );
109 void ldapsrv_set_options (gint secs, LDAP *ld);
110 LDAP *ldapsvr_connect(LdapControl *ctl);
111 void ldapsvr_disconnect(LDAP *ld);
112 #endif /* USE_LDAP */
114 #endif /* __LDAPSERVER_H__ */