diff --git a/CHANGES b/CHANGES index e1116db6b80c2c8ee592bffe2150a336d4ccbfb3..1799e099851681b235fd6fcc228c755d3ba5b9ae 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,7 @@ OpenLDAP 2.4.17 Engineering Fixed slapd normalization of updated schema attributes (ITS#5540) Fixed slapd pagedresults stacked control with overlays (ITS#6056) Fixed slapd sockets usage on windows (ITS#6039) + Added slapo-rwm rwm-drop-unrequested-attrs config option (ITS#6057) Build Environment Added test056-monitor (ITS#5540) Added test057-memberof-refint (ITS#5395) diff --git a/doc/man/man5/slapo-rwm.5 b/doc/man/man5/slapo-rwm.5 index 255021bb4fa636ed1107cc3a9c00d711e48b9487..e03e8b1f00d9ab3091a7fdf561ce4b7cb653a6dc 100644 --- a/doc/man/man5/slapo-rwm.5 +++ b/doc/man/man5/slapo-rwm.5 @@ -89,6 +89,19 @@ Set this to "yes", if the overlay should try to normalize the values of attributes that are mapped from an attribute type that is unknown to the local server. The default value of this setting is "no". +.TP +.B rwm-drop-unrequested-attrs {yes|no} +Set this to "yes", if the +.B rwm +overlay should drop attributes that are not explicitly requested +by a search operation. +When this is set to "no", the +.B rwm +overlay will leave all attributes in place, so that subsequent modules +can further manipulate them. +In any case, unrequested attributes will be omitted from search results +by the frontend, when the search entry response package is encoded. +The default value of this setting is "yes". .SH SUFFIX MASSAGING A basic feature of the .B rwm diff --git a/servers/slapd/overlays/rwm.c b/servers/slapd/overlays/rwm.c index e10ee7fa134f0915bf9fe4325b39628e84a38267..de8da75f3ef32141ed766647434662e5217d75d7 100644 --- a/servers/slapd/overlays/rwm.c +++ b/servers/slapd/overlays/rwm.c @@ -1197,7 +1197,8 @@ rwm_attrs( Operation *op, SlapReply *rs, Attribute** a_first, int stripEntryDN ) int last = -1; Attribute *a; - if ( op->ors_attrs != NULL && + if ( ( rwmap->rwm_flags & RWM_F_DROP_UNREQUESTED_ATTRS ) && + op->ors_attrs != NULL && !SLAP_USERATTRS( rs->sr_attr_flags ) && !ad_inlist( (*ap)->a_desc, op->ors_attrs ) ) { @@ -1829,6 +1830,7 @@ enum { RWM_CF_MAP, RWM_CF_T_F_SUPPORT, RWM_CF_NORMALIZE_MAPPED, + RWM_CF_DROP_UNREQUESTED, RWM_CF_LAST }; @@ -1883,6 +1885,14 @@ static ConfigTable rwmcfg[] = { "SINGLE-VALUE )", NULL, NULL }, + { "rwm-drop-unrequested-attrs", "true|false", + 2, 2, 0, ARG_MAGIC|ARG_ON_OFF|RWM_CF_DROP_UNREQUESTED, rwm_cf_gen, + "( OLcfgOvAt:16.5 NAME 'olcRwmDropUnrequested' " + "DESC 'Drop unrequested attributes' " + "SYNTAX OMsBoolean " + "SINGLE-VALUE )", + NULL, NULL }, + { NULL, NULL, 0, 0, 0, ARG_IGNORED } }; @@ -2051,6 +2061,10 @@ rwm_cf_gen( ConfigArgs *c ) c->value_int = ( rwmap->rwm_flags & RWM_F_NORMALIZE_MAPPED_ATTRS ); break; + case RWM_CF_DROP_UNREQUESTED: + c->value_int = ( rwmap->rwm_flags & RWM_F_DROP_UNREQUESTED_ATTRS ); + break; + default: assert( 0 ); rc = 1; @@ -2145,6 +2159,10 @@ rwm_cf_gen( ConfigArgs *c ) rwmap->rwm_flags &= ~RWM_F_NORMALIZE_MAPPED_ATTRS; break; + case RWM_CF_DROP_UNREQUESTED: + rwmap->rwm_flags &= ~RWM_F_DROP_UNREQUESTED_ATTRS; + break; + default: return 1; } @@ -2325,6 +2343,14 @@ rwm_cf_gen( ConfigArgs *c ) } break; + case RWM_CF_DROP_UNREQUESTED: + if ( c->value_int ) { + rwmap->rwm_flags |= RWM_F_DROP_UNREQUESTED_ATTRS; + } else { + rwmap->rwm_flags &= ~RWM_F_DROP_UNREQUESTED_ATTRS; + } + break; + default: assert( 0 ); return 1; @@ -2344,9 +2370,11 @@ rwm_db_init( rwmap = (struct ldaprwmap *)ch_calloc( 1, sizeof( struct ldaprwmap ) ); + /* default */ + rwmap->rwm_flags = RWM_F_DROP_UNREQUESTED_ATTRS; + rc = rwm_info_init( &rwmap->rwm_rw ); -error_return:; on->on_bi.bi_private = (void *)rwmap; if ( rc ) { diff --git a/servers/slapd/overlays/rwm.h b/servers/slapd/overlays/rwm.h index a46c3caa9f6d19c6842fa650c041c0b55cbf906e..849822d62cf8273ffb965bc6785d4fcdc97d4604 100644 --- a/servers/slapd/overlays/rwm.h +++ b/servers/slapd/overlays/rwm.h @@ -81,6 +81,7 @@ struct ldaprwmap { #define RWM_F_NONE (0x0000U) #define RWM_F_NORMALIZE_MAPPED_ATTRS (0x0001U) +#define RWM_F_DROP_UNREQUESTED_ATTRS (0x0002U) #define RWM_F_SUPPORT_T_F (0x4000U) #define RWM_F_SUPPORT_T_F_DISCOVER (0x8000U) #define RWM_F_SUPPORT_T_F_MASK (RWM_F_SUPPORT_T_F)