1 /* rwm.h - dn rewrite/attribute mapping header file */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1999-2009 The OpenLDAP Foundation.
6 * Portions Copyright 1999-2003 Howard Chu.
7 * Portions Copyright 2000-2003 Pierangelo Masarati.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted only as authorized by the OpenLDAP
14 * A copy of this license is available in the file LICENSE in the
15 * top-level directory of the distribution or, alternatively, at
16 * <http://www.OpenLDAP.org/license.html>.
19 * This work was initially developed by the Howard Chu for inclusion
20 * in OpenLDAP Software and subsequently enhanced by Pierangelo
27 #ifndef ENABLE_REWRITE
28 #error "librewrite must be enabled!"
29 #endif /* ENABLE_REWRITE */
31 /* String rewrite library */
36 /* define to enable referral DN massage by default */
37 #undef RWM_REFERRAL_REWRITE
48 #define RWMMAP_F_NONE 0x00
49 #define RWMMAP_F_IS_OC 0x01
50 #define RWMMAP_F_FREE_SRC 0x10
51 #define RWMMAP_F_FREE_DST 0x20
54 AttributeDescription *m_s_ad;
57 #define m_src_ad m_src_ref.m_s_ad
58 #define m_src_oc m_src_ref.m_s_oc
61 AttributeDescription *m_d_ad;
64 #define m_dst_ad m_dst_ref.m_d_ad
65 #define m_dst_oc m_dst_ref.m_d_oc
72 struct rewrite_info *rwm_rw;
73 BerVarray rwm_bva_rewrite;
76 * Attribute/objectClass mapping
78 struct ldapmap rwm_oc;
79 struct ldapmap rwm_at;
80 BerVarray rwm_bva_map;
82 #define RWM_F_NONE (0x0000U)
83 #define RWM_F_NORMALIZE_MAPPED_ATTRS (0x0001U)
84 #define RWM_F_DROP_UNREQUESTED_ATTRS (0x0002U)
85 #define RWM_F_SUPPORT_T_F (0x4000U)
86 #define RWM_F_SUPPORT_T_F_DISCOVER (0x8000U)
87 #define RWM_F_SUPPORT_T_F_MASK (RWM_F_SUPPORT_T_F)
88 #define RWM_F_SUPPORT_T_F_MASK2 (RWM_F_SUPPORT_T_F|RWM_F_SUPPORT_T_F_DISCOVER)
92 /* Whatever context ldap_back_dn_massage needs... */
93 typedef struct dncookie {
94 struct ldaprwmap *rwmap;
101 int rwm_dn_massage( dncookie *dc, struct berval *in, struct berval *dn );
102 int rwm_dn_massage_pretty( dncookie *dc, struct berval *in, struct berval *pdn );
103 int rwm_dn_massage_normalize( dncookie *dc, struct berval *in, struct berval *ndn );
104 int rwm_dn_massage_pretty_normalize( dncookie *dc, struct berval *in, struct berval *pdn, struct berval *ndn );
106 /* attributeType/objectClass mapping */
107 int rwm_mapping_cmp (const void *, const void *);
108 int rwm_mapping_dup (void *, void *);
110 int rwm_map_init ( struct ldapmap *lm, struct ldapmapping ** );
111 void rwm_map ( struct ldapmap *map, struct berval *s, struct berval *m,
113 int rwm_mapping ( struct ldapmap *map, struct berval *s,
114 struct ldapmapping **m, int remap );
119 struct ldapmap *at_map,
120 struct ldapmap *oc_map,
125 struct ldapmap *at_map,
128 char ***mapped_attrs );
132 struct ldapmap *at_map,
133 struct ldapmap *oc_map,
138 extern void rwm_mapping_dst_free ( void *mapping );
140 extern void rwm_mapping_free ( void *mapping );
142 extern int rwm_map_config(
143 struct ldapmap *oc_map,
144 struct ldapmap *at_map,
151 rwm_filter_map_rewrite(
155 struct berval *fstr );
157 /* suffix massaging by means of librewrite */
159 rwm_suffix_massage_config(
160 struct rewrite_info *info,
164 struct berval *nrnc);
171 BerVarray *pa_nvals );
173 rwm_referral_rewrite(
178 BerVarray *pa_nvals );
179 extern int rwm_dnattr_result_rewrite( dncookie *dc, BerVarray a_vals, BerVarray a_nvals );
180 extern int rwm_referral_result_rewrite( dncookie *dc, BerVarray a_vals );