]> git.sur5r.net Git - openldap/commitdiff
improve URI DN containment check
authorPierangelo Masarati <ando@openldap.org>
Sat, 25 Aug 2007 10:13:51 +0000 (10:13 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 25 Aug 2007 10:13:51 +0000 (10:13 +0000)
servers/slapd/back-meta/config.c

index 6cdfbc60fc85a67824032040beaeecb3fc5ed25c..1c0b5f672726950468b5cea5a1f4f22b92668a94 100644 (file)
@@ -111,13 +111,11 @@ meta_back_db_config(
        /* URI of server to query */
        if ( strcasecmp( argv[ 0 ], "uri" ) == 0 ) {
                int             i = mi->mi_ntargets;
-#if 0
-               int             j;
-#endif /* uncomment if uri MUST be a branch of suffix */
                LDAPURLDesc     *ludp, *tmpludp;
                struct berval   dn;
                int             rc;
                int             c;
+               BackendDB       *tmp_bd;
 
                metatarget_t    *mt;
                
@@ -282,26 +280,14 @@ meta_back_db_config(
                /*
                 * uri MUST be a branch of suffix!
                 */
-#if 0 /* too strict a constraint */
-               if ( select_backend( &mt->mt_nsuffix, 0 ) != be ) {
-                       Debug( LDAP_DEBUG_ANY,
-       "%s: line %d: <naming context> of URI does not refer to current backend"
-       " in \"uri <protocol>://<server>[:port]/<naming context>\" line\n",
-                               fname, lineno, 0 );
-                       return 1;
-               }
-#else
-               /*
-                * uri MUST be a branch of a suffix!
-                */
-               if ( select_backend( &mt->mt_nsuffix, 0 ) == NULL ) {
+               tmp_bd = select_backend( &mt->mt_nsuffix, 0 );
+               if ( tmp_bd == NULL || tmp_bd->be_private != be->be_private )
+               {
                        Debug( LDAP_DEBUG_ANY,
-       "%s: line %d: <naming context> of URI does not resolve to a backend"
-       " in \"uri <protocol>://<server>[:port]/<naming context>\" line\n",
+       "%s: line %d: <naming context> of URI does not resolve to this database.\n",
                                fname, lineno, 0 );
                        return 1;
                }
-#endif
 
        /* subtree-exclude */
        } else if ( strcasecmp( argv[ 0 ], "subtree-exclude" ) == 0 ) {