1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/* Authors: Martin Nagy <mnagy@redhat.com>
* Adam Tkac <atkac@redhat.com>
*
* Copyright (C) 2008, 2009 Red Hat
* see file 'COPYING' for use and warranty information
*
* 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 only
*
* 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
*/
#ifndef _LD_LDAP_HELPER_H_
#define _LD_LDAP_HELPER_H_
#include <isc/util.h>
typedef struct ldap_instance ldap_instance_t;
/*
* some nice words about ldapdb_rdatalist_t:
* - it is list of all RRs which have same owner name
* - rdata buffer is reachable only via dns_rdata_toregion()
*
* structure:
*
* class1 class2
* type1 type2
* ttl1 ttl2
* rdata1 -> rdata2 -> rdata3 rdata4 -> rdata5
* next_rdatalist -> next_rdatalist ...
*/
typedef LIST(dns_rdatalist_t) ldapdb_rdatalist_t;
isc_result_t ldapdb_rdatalist_findrdatatype(ldapdb_rdatalist_t *rdatalist,
dns_rdatatype_t rdtype,
dns_rdatalist_t **rdlistp);
/*
* ldapdb_rdatalist_findrdatatype
*
* find rdatalist in rdatalist which matches rdtype and return it in rdlistp.
*
* Returns ISC_R_SUCCESS or ISC_R_NOTFOUND
*/
void ldapdb_rdatalist_destroy(isc_mem_t *mctx, ldapdb_rdatalist_t *rdatalist);
/*
* ldapdb_rdatalist_destroy
*
* Free rdatalist list and free all associated rdata buffers.
*/
void free_rdatalist(isc_mem_t *mctx, dns_rdatalist_t *rdlist);
/*
* free_rdatalist
*
* Free all dynamically allocated memory inside rdlist.
*/
isc_result_t ldapdb_rdatalist_get(isc_mem_t *mctx, ldap_instance_t *ldap_inst,
dns_name_t *name, dns_name_t *origin,
ldapdb_rdatalist_t *rdatalist);
/*
* ldapdb_rdatalist_get
*
* Find all RRs in ldap database with specified name and return them in
* rdatalist.
*
* XXX Add partial match handling.
*
* Possible errors include:
*
* ISC_R_NOMEMORY
* ISC_R_NOTFOUND
* DNS_R_PARTIALMATCH
*/
isc_result_t new_ldap_instance(isc_mem_t *mctx, dns_view_t *view, ldap_instance_t **ldap_instp,
const char * const *argv);
void destroy_ldap_instance(ldap_instance_t **ldap_inst);
isc_result_t refresh_zones_from_ldap(ldap_instance_t *ldap_inst, const char *name,
dns_zonemgr_t *zmgr);
isc_result_t
get_zone_dn(ldap_instance_t *ldap_inst, dns_name_t *name, const char **dn,
dns_name_t *matched_name);
/* Functions for writing to LDAP. */
isc_result_t write_to_ldap(dns_name_t *owner, ldap_instance_t *ldap_inst,
dns_rdatalist_t *rdlist);
isc_result_t remove_from_ldap(dns_name_t *owner, ldap_instance_t *ldap_inst,
dns_rdatalist_t *rdlist);
#endif /* !_LD_LDAP_HELPER_H_ */
|