]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldap/config.c
notices
[openldap] / servers / slapd / back-ldap / config.c
index e3174d74c4ad6d6e4e33a4fc76124b2acc342232..1b01ba800b800ee256c0ea013575d002726a65a9 100644 (file)
@@ -1,8 +1,22 @@
 /* config.c - ldap backend configuration file routine */
 /* $OpenLDAP$ */
-/*
- * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2003 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by the Howard Chu for inclusion
+ * in OpenLDAP Software and subsequently enhanced by Pierangelo
+ * Masarati.
  */
 /* This is an altered version */
 /*
@@ -132,7 +146,8 @@ ldap_back_db_config(
                            fname, lineno );
                        return( 1 );
                }
-               load_extop( (struct berval *)&slap_EXOP_WHOAMI, ldap_back_exop_whoami );
+               load_extop( (struct berval *)&slap_EXOP_WHOAMI,
+                       0, ldap_back_exop_whoami );
        
        /* dn massaging */
        } else if ( strcasecmp( argv[0], "suffixmassage" ) == 0 ) {
@@ -162,7 +177,7 @@ ldap_back_db_config(
                }
                
                ber_str2bv( argv[1], 0, 0, &bvnc );
-               if ( dnPrettyNormal( NULL, &bvnc, &pvnc, &nvnc ) != LDAP_SUCCESS ) {
+               if ( dnPrettyNormal( NULL, &bvnc, &pvnc, &nvnc, NULL ) != LDAP_SUCCESS ) {
                        fprintf( stderr, "%s: line %d: suffix DN %s is invalid\n",
                                fname, lineno, bvnc.bv_val );
                        return( 1 );
@@ -180,7 +195,7 @@ ldap_back_db_config(
                }
 
                ber_str2bv( argv[2], 0, 0, &brnc );
-               if ( dnPrettyNormal( NULL, &brnc, &prnc, &nrnc ) != LDAP_SUCCESS ) {
+               if ( dnPrettyNormal( NULL, &brnc, &prnc, &nrnc, NULL ) != LDAP_SUCCESS ) {
                        fprintf( stderr, "%s: line %d: suffix DN %s is invalid\n",
                                fname, lineno, brnc.bv_val );
                        free( nvnc.bv_val );
@@ -221,11 +236,11 @@ ldap_back_db_config(
                return( rc );
 
 #else /* !ENABLE_REWRITE */
-               ber_bvarray_add( &li->suffix_massage, &pvnc );
-               ber_bvarray_add( &li->suffix_massage, &nvnc );
+               ber_bvarray_add( &li->rwmap.rwm_suffix_massage, &pvnc );
+               ber_bvarray_add( &li->rwmap.rwm_suffix_massage, &nvnc );
                
-               ber_bvarray_add( &li->suffix_massage, &prnc );
-               ber_bvarray_add( &li->suffix_massage, &nrnc );
+               ber_bvarray_add( &li->rwmap.rwm_suffix_massage, &prnc );
+               ber_bvarray_add( &li->rwmap.rwm_suffix_massage, &nrnc );
 #endif /* !ENABLE_REWRITE */
 
        /* rewrite stuff ... */
@@ -420,25 +435,23 @@ ldap_back_exop_whoami(
        if ( op->oq_extended.rs_reqdata != NULL ) {
                /* no request data should be provided */
                rs->sr_text = "no request data expected";
-               return LDAP_PROTOCOL_ERROR;
+               return rs->sr_err = LDAP_PROTOCOL_ERROR;
        }
 
-       {
-               rs->sr_err = backend_check_restrictions( op, rs, 
+       rs->sr_err = backend_check_restrictions( op, rs, 
                        (struct berval *)&slap_EXOP_WHOAMI );
-
-               if( rs->sr_err != LDAP_SUCCESS ) return rs->sr_err;
-       }
+       if( rs->sr_err != LDAP_SUCCESS ) return rs->sr_err;
 
        /* if auth'd by back-ldap and request is proxied, forward it */
        if ( op->o_conn->c_authz_backend && !strcmp(op->o_conn->c_authz_backend->be_type, "ldap" ) && !dn_match(&op->o_ndn, &op->o_conn->c_ndn)) {
                struct ldapconn *lc;
 
-               LDAPControl c, *ctrls[2] = {&c, NULL};
+               LDAPControl c, *ctrls[2] = {NULL, NULL};
                LDAPMessage *res;
                Operation op2 = *op;
                ber_int_t msgid;
 
+               ctrls[0] = &c;
                op2.o_ndn = op->o_conn->c_ndn;
                lc = ldap_back_getconn(&op2, rs);
                if (!lc || !ldap_back_dobind( lc, op, rs )) {
@@ -676,11 +689,22 @@ suffix_massage_config(
        rargv[ 4 ] = NULL;
        rewrite_parse( info, "<suffix massage>", ++line, 4, rargv );
 #else /* normalize "matched" */
+
        rargv[ 0 ] = "rewriteContext";
-       rargv[ 1 ] = "matchedDn";
-       rargv[ 2 ] = NULL;
-       rewrite_parse( info, "<suffix massage>", ++line, 2, rargv );
+       rargv[ 1 ] = "matchedDN";
+       rargv[ 2 ] = "alias";
+       rargv[ 3 ] = "searchResult";
+       rargv[ 4 ] = NULL;
+       rewrite_parse( info, "<suffix massage>", ++line, 4, rargv );
 
+       rargv[ 0 ] = "rewriteContext";
+       rargv[ 1 ] = "searchAttrDN";
+       rargv[ 2 ] = "alias";
+       rargv[ 3 ] = "searchResult";
+       rargv[ 4 ] = NULL;
+       rewrite_parse( info, "<suffix massage>", ++line, 4, rargv );
+
+#if 0
        rargv[ 0 ] = "rewriteRule";
        rargv[ 1 ] = suffix_massage_regexize( prnc->bv_val );
        rargv[ 2 ] = suffix_massage_patternize( nvnc->bv_val );
@@ -689,6 +713,7 @@ suffix_massage_config(
        rewrite_parse( info, "<suffix massage>", ++line, 4, rargv );
        ch_free( rargv[ 1 ] );
        ch_free( rargv[ 2 ] );
+#endif /* 0 */
 #endif /* normalize "matched" */
 
        return 0;