From 52a49e0840d759efbd2d2ce0acedacbfc9351fb7 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Tue, 20 Jul 2004 00:46:20 +0000 Subject: [PATCH] improve manual and make naming contexts uniform; NOTE: backwards compatibility not preserved --- doc/man/man5/slapo-rwm.5 | 32 ++++++++++++++------------- servers/slapd/overlays/rwm.c | 38 ++++++++++++++++---------------- servers/slapd/overlays/rwmconf.c | 6 ++--- 3 files changed, 39 insertions(+), 37 deletions(-) diff --git a/doc/man/man5/slapo-rwm.5 b/doc/man/man5/slapo-rwm.5 index 64a0ff533a..1541477ebe 100644 --- a/doc/man/man5/slapo-rwm.5 +++ b/doc/man/man5/slapo-rwm.5 @@ -63,10 +63,10 @@ directive. .B rwm-suffixmassage "" "" Shortcut to implement naming context rewriting; the trailing part of the DN is rewritten from the virtual to the real naming context -in the bindDN, searchBase, searchFilterAttrDN, compareDN, compareAttrDN, +in the bindDN, searchDN, searchFilterAttrDN, compareDN, compareAttrDN, addDN, addAttrDN, modifyDN, modifyAttrDN, modrDN, newSuperiorDN, deleteDN, exopPasswdDN, and from the real to the virtual naming context -in the searchResult, searchAttrDN and matchedDN rewrite contexts. +in the searchEntryDN, searchAttrDN and matchedDN rewrite contexts. By default no rewriting occurs for the searchFilter rewrite context. This directive implies setting the .B rwm-rewriteEngine @@ -281,7 +281,7 @@ client -> server: (default) if defined and no specific context is available bindDN bind -searchBase search +searchDN search searchFilter search searchFilterAttrDN search compareDN compare @@ -301,11 +301,13 @@ server -> client: .LP .RS .nf -searchResult search (only if defined; no default; - acts on DN and DN-syntax attributes - of search results) -searchAttrDN search AVA -matchedDN all ops (only if applicable) +searchEntryDN search (only if defined; no default; + acts on DN of search entries) +searchAttrDN search AVA (only if defined; defaults + to searchEntryDN; acts on DN-syntax + attributes of search results) +matchedDN all ops (only if applicable; defaults + to searchEntryDN) .fi .RE .LP @@ -369,10 +371,10 @@ rwm-rewriteRule "(.*)$" "$1" ":" # empty filter rule rwm-rewriteContext searchFilter # all dataflow from server to client -rwm-rewriteContext searchResult +rwm-rewriteContext searchEntryDN rwm-rewriteRule "(.*)$" "$1" ":" -rwm-rewriteContext searchAttrDN alias searchResult -rwm-rewriteContext matchedDN alias searchResult +rwm-rewriteContext searchAttrDN alias searchEntryDN +rwm-rewriteContext matchedDN alias searchEntryDN # Everything defined here goes into the `default' context. # This rule changes the naming context of anything sent @@ -419,11 +421,11 @@ rwm-rewriteRule ".*" "${>addBlanks($0)}" ":" .\" rwm-rewriteRule ".*" "${>addBlanks(${>uid2Gecos($0)})}" ":" .\" # Rewrite the search base according to `default' rules. -rwm-rewriteContext searchBase alias default +rwm-rewriteContext searchDN alias default # Search results with OpenLDAP DN are rewritten back with # `dc=home,dc=net' naming context, with spaces eaten. -rwm-rewriteContext searchResult +rwm-rewriteContext searchEntryDN rwm-rewriteRule "(.*[^ ],)?[ ]?dc=OpenLDAP,[ ]?dc=org$" "${>eatBlanks($1)}dc=home,dc=net" ":" @@ -438,7 +440,7 @@ rwm-rewriteMap ldap attr2dn "ldap://host/dc=my,dc=org?dn?sub" # in case of match stops rewriting; in case of error, # it is ignored. In case we are mapping virtual # to real naming contexts, we also need to rewrite -# regular DNs, because the definition of a bindDn +# regular DNs, because the definition of a bindDN # rewrite context overrides the default definition. rwm-rewriteContext bindDN rwm-rewriteRule "^mail=[^,]+@[^,]+$" "${attr2dn($0)}" ":@I" @@ -479,7 +481,7 @@ rwm-rewriteRule ".*<>$" "${*prefix}uid=${*arg}${*suffix}" ":" # in case of match the rewriting exits successfully. # The second rule matches everything else and causes # the value to be rejected. -rwm-rewriteContext searchResult +rwm-rewriteContext searchEntryDN rwm-rewriteRule ".*,ou=People,dc=example,dc=com$" "$0" ":@" rwm-rewriteRule ".*" "" "#" .fi diff --git a/servers/slapd/overlays/rwm.c b/servers/slapd/overlays/rwm.c index 3ecd2d527a..a7ba60e21d 100644 --- a/servers/slapd/overlays/rwm.c +++ b/servers/slapd/overlays/rwm.c @@ -82,14 +82,14 @@ rwm_add( Operation *op, SlapReply *rs ) char *olddn = op->o_req_dn.bv_val; #ifdef ENABLE_REWRITE - rc = rwm_op_dn_massage( op, rs, "addDn" ); + rc = rwm_op_dn_massage( op, rs, "addDN" ); #else rc = 1; rc = rwm_op_dn_massage( op, rs, &rc ); #endif if ( rc != LDAP_SUCCESS ) { op->o_bd->bd_info = (BackendInfo *)on->on_info; - send_ldap_error( op, rs, rc, "addDn massage error" ); + send_ldap_error( op, rs, rc, "addDN massage error" ); return -1; } @@ -124,7 +124,7 @@ rwm_add( Operation *op, SlapReply *rs ) * the operation should give up, right? */ #ifdef ENABLE_REWRITE - rc = rwm_dnattr_rewrite( op, rs, "addAttrDn", + rc = rwm_dnattr_rewrite( op, rs, "addAttrDN", (*ap)->a_vals, (*ap)->a_nvals ? &(*ap)->a_nvals : NULL ); #else @@ -165,14 +165,14 @@ rwm_bind( Operation *op, SlapReply *rs ) ( void )rewrite_session_delete( rwmap->rwm_rw, op->o_conn ); ( void )rewrite_session_init( rwmap->rwm_rw, op->o_conn ); - rc = rwm_op_dn_massage( op, rs, "bindDn" ); + rc = rwm_op_dn_massage( op, rs, "bindDN" ); #else rc = 1; rc = rwm_op_dn_massage( op, rs, &rc ); #endif if ( rc != LDAP_SUCCESS ) { op->o_bd->bd_info = (BackendInfo *)on->on_info; - send_ldap_error( op, rs, rc, "bindDn massage error" ); + send_ldap_error( op, rs, rc, "bindDN massage error" ); return -1; } @@ -205,14 +205,14 @@ rwm_compare( Operation *op, SlapReply *rs ) mapped_vals[2] = { BER_BVNULL, BER_BVNULL }; #ifdef ENABLE_REWRITE - rc = rwm_op_dn_massage( op, rs, "compareDn" ); + rc = rwm_op_dn_massage( op, rs, "compareDN" ); #else rc = 1; rc = rwm_op_dn_massage( op, rs, &rc ); #endif if ( rc != LDAP_SUCCESS ) { op->o_bd->bd_info = (BackendInfo *)on->on_info; - send_ldap_error( op, rs, rc, "compareDn massage error" ); + send_ldap_error( op, rs, rc, "compareDN massage error" ); return -1; } @@ -277,14 +277,14 @@ rwm_delete( Operation *op, SlapReply *rs ) int rc; #ifdef ENABLE_REWRITE - rc = rwm_op_dn_massage( op, rs, "deleteDn" ); + rc = rwm_op_dn_massage( op, rs, "deleteDN" ); #else rc = 1; rc = rwm_op_dn_massage( op, rs, &rc ); #endif if ( rc != LDAP_SUCCESS ) { op->o_bd->bd_info = (BackendInfo *)on->on_info; - send_ldap_error( op, rs, rc, "deleteDn massage error" ); + send_ldap_error( op, rs, rc, "deleteDN massage error" ); return -1; } @@ -302,14 +302,14 @@ rwm_modify( Operation *op, SlapReply *rs ) int rc; #ifdef ENABLE_REWRITE - rc = rwm_op_dn_massage( op, rs, "modifyDn" ); + rc = rwm_op_dn_massage( op, rs, "modifyDN" ); #else rc = 1; rc = rwm_op_dn_massage( op, rs, &rc ); #endif if ( rc != LDAP_SUCCESS ) { op->o_bd->bd_info = (BackendInfo *)on->on_info; - send_ldap_error( op, rs, rc, "modifyDn massage error" ); + send_ldap_error( op, rs, rc, "modifyDN massage error" ); return -1; } @@ -381,7 +381,7 @@ rwm_modify( Operation *op, SlapReply *rs ) slap_schema.si_syn_distinguishedName ) { #ifdef ENABLE_REWRITE - rc = rwm_dnattr_rewrite( op, rs, "modifyDn", + rc = rwm_dnattr_rewrite( op, rs, "modifyDN", (*mlp)->sml_values, (*mlp)->sml_nvalues ? &(*mlp)->sml_nvalues : NULL ); #else @@ -455,14 +455,14 @@ rwm_modrdn( Operation *op, SlapReply *rs ) } #ifdef ENABLE_REWRITE - rc = rwm_op_dn_massage( op, rs, "renameDn" ); + rc = rwm_op_dn_massage( op, rs, "renameDN" ); #else rc = 1; rc = rwm_op_dn_massage( op, rs, &rc ); #endif if ( rc != LDAP_SUCCESS ) { op->o_bd->bd_info = (BackendInfo *)on->on_info; - send_ldap_error( op, rs, rc, "renameDn massage error" ); + send_ldap_error( op, rs, rc, "renameDN massage error" ); return -1; } @@ -512,13 +512,13 @@ rwm_search( Operation *op, SlapReply *rs ) char *text = NULL; #ifdef ENABLE_REWRITE - rc = rwm_op_dn_massage( op, rs, "searchDn" ); + rc = rwm_op_dn_massage( op, rs, "searchDN" ); #else rc = 1; rc = rwm_op_dn_massage( op, rs, &rc ); #endif if ( rc != LDAP_SUCCESS ) { - text = "searchDn massage error"; + text = "searchDN massage error"; goto error_return; } @@ -610,14 +610,14 @@ rwm_extended( Operation *op, SlapReply *rs ) int rc; #ifdef ENABLE_REWRITE - rc = rwm_op_dn_massage( op, rs, "extendedDn" ); + rc = rwm_op_dn_massage( op, rs, "extendedDN" ); #else rc = 1; rc = rwm_op_dn_massage( op, rs, &rc ); #endif if ( rc != LDAP_SUCCESS ) { op->o_bd->bd_info = (BackendInfo *)on->on_info; - send_ldap_error( op, rs, rc, "extendedDn massage error" ); + send_ldap_error( op, rs, rc, "extendedDN massage error" ); return -1; } @@ -834,7 +834,7 @@ rwm_send_entry( Operation *op, SlapReply *rs ) #ifdef ENABLE_REWRITE dc.conn = op->o_conn; dc.rs = NULL; - dc.ctx = "searchResult"; + dc.ctx = "searchEntryDN"; #else dc.tofrom = 0; dc.normalized = 0; diff --git a/servers/slapd/overlays/rwmconf.c b/servers/slapd/overlays/rwmconf.c index 0bdb928c55..be1e7f870e 100644 --- a/servers/slapd/overlays/rwmconf.c +++ b/servers/slapd/overlays/rwmconf.c @@ -313,7 +313,7 @@ rwm_suffix_massage_config( ch_free( rargv[ 2 ] ); rargv[ 0 ] = "rewriteContext"; - rargv[ 1 ] = "searchResult"; + rargv[ 1 ] = "searchEntryDN"; rargv[ 2 ] = NULL; rewrite_parse( info, "", ++line, 2, rargv ); @@ -329,14 +329,14 @@ rwm_suffix_massage_config( rargv[ 0 ] = "rewriteContext"; rargv[ 1 ] = "matchedDN"; rargv[ 2 ] = "alias"; - rargv[ 3 ] = "searchResult"; + rargv[ 3 ] = "searchEntryDN"; rargv[ 4 ] = NULL; rewrite_parse( info, "", ++line, 4, rargv ); rargv[ 0 ] = "rewriteContext"; rargv[ 1 ] = "searchAttrDN"; rargv[ 2 ] = "alias"; - rargv[ 3 ] = "searchResult"; + rargv[ 3 ] = "searchEntryDN"; rargv[ 4 ] = NULL; rewrite_parse( info, "", ++line, 4, rargv ); -- 2.39.5