1 /* rwm.h - dn rewrite/attribute mapping header file */
2 /* $OpenLDAP: pkg/ldap/servers/slapd/overlays/rwm.h,v 1.15.2.3 2008/02/11 23:26:48 kurt Exp $ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1999-2008 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_SUPPORT_T_F (0x4000U)
85 #define RWM_F_SUPPORT_T_F_DISCOVER (0x8000U)
86 #define RWM_F_SUPPORT_T_F_MASK (RWM_F_SUPPORT_T_F)
87 #define RWM_F_SUPPORT_T_F_MASK2 (RWM_F_SUPPORT_T_F|RWM_F_SUPPORT_T_F_DISCOVER)
91 /* Whatever context ldap_back_dn_massage needs... */
92 typedef struct dncookie
{
93 struct ldaprwmap
*rwmap
;
100 int rwm_dn_massage( dncookie
*dc
, struct berval
*in
, struct berval
*dn
);
101 int rwm_dn_massage_pretty( dncookie
*dc
, struct berval
*in
, struct berval
*pdn
);
102 int rwm_dn_massage_normalize( dncookie
*dc
, struct berval
*in
, struct berval
*ndn
);
103 int rwm_dn_massage_pretty_normalize( dncookie
*dc
, struct berval
*in
, struct berval
*pdn
, struct berval
*ndn
);
105 /* attributeType/objectClass mapping */
106 int rwm_mapping_cmp (const void *, const void *);
107 int rwm_mapping_dup (void *, void *);
109 int rwm_map_init ( struct ldapmap
*lm
, struct ldapmapping
** );
110 void rwm_map ( struct ldapmap
*map
, struct berval
*s
, struct berval
*m
,
112 int rwm_mapping ( struct ldapmap
*map
, struct berval
*s
,
113 struct ldapmapping
**m
, int remap
);
118 struct ldapmap
*at_map
,
119 struct ldapmap
*oc_map
,
124 struct ldapmap
*at_map
,
127 char ***mapped_attrs
);
131 struct ldapmap
*at_map
,
132 struct ldapmap
*oc_map
,
137 extern void rwm_mapping_dst_free ( void *mapping
);
139 extern void rwm_mapping_free ( void *mapping
);
141 extern int rwm_map_config(
142 struct ldapmap
*oc_map
,
143 struct ldapmap
*at_map
,
150 rwm_filter_map_rewrite(
154 struct berval
*fstr
);
156 /* suffix massaging by means of librewrite */
158 rwm_suffix_massage_config(
159 struct rewrite_info
*info
,
163 struct berval
*nrnc
);
170 BerVarray
*pa_nvals
);
172 rwm_referral_rewrite(
177 BerVarray
*pa_nvals
);
178 extern int rwm_dnattr_result_rewrite( dncookie
*dc
, BerVarray a_vals
);
179 extern int rwm_referral_result_rewrite( dncookie
*dc
, BerVarray a_vals
);