]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-meta/config.c
quotes needed for spaces in DN (ITS#7525)
[openldap] / servers / slapd / back-meta / config.c
index ed1d1591bdbfd46fd8058e06a8a9bf9be4f5fb7a..f3a6d017f289a114559b2bd229eb3a7019234dc4 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1999-2012 The OpenLDAP Foundation.
+ * Copyright 1999-2013 The OpenLDAP Foundation.
  * Portions Copyright 2001-2003 Pierangelo Masarati.
  * Portions Copyright 1999-2003 Howard Chu.
  * All rights reserved.
 #include "../back-ldap/back-ldap.h"
 #include "back-meta.h"
 
+#ifdef LDAP_DEVEL
+#define SLAP_AUTH_DN   1
+#endif
+
 static ConfigDriver meta_back_cf_gen;
 static ConfigLDAPadd meta_ldadd;
 static ConfigCfAdd meta_cfadd;
@@ -1348,15 +1352,18 @@ meta_back_cf_gen( ConfigArgs *c )
                /* target attrs */
                case LDAP_BACK_CFG_URI: {
                        char *p2, *p1 = strchr( mt->mt_uri, ' ' );
-                       bv.bv_len = strlen( mt->mt_uri ) + 1 + mt->mt_psuffix.bv_len;
+                       bv.bv_len = strlen( mt->mt_uri ) + 3 + mt->mt_psuffix.bv_len;
                        bv.bv_val = ch_malloc( bv.bv_len + 1 );
+                       p2 = bv.bv_val;
+                       *p2++ = '"';
                        if ( p1 ) {
-                               p2 = lutil_strncopy( bv.bv_val, mt->mt_uri, p1 - mt->mt_uri );
+                               p2 = lutil_strncopy( p2, mt->mt_uri, p1 - mt->mt_uri );
                        } else {
-                               p2 = lutil_strcopy( bv.bv_val, mt->mt_uri );
+                               p2 = lutil_strcopy( p2, mt->mt_uri );
                        }
                        *p2++ = '/';
                        p2 = lutil_strcopy( p2, mt->mt_psuffix.bv_val );
+                       *p2++ = '"';
                        if ( p1 ) {
                                strcpy( p2, p1 );
                        }
@@ -1500,6 +1507,7 @@ meta_back_cf_gen( ConfigArgs *c )
                                        ptr = lutil_strcopy( ptr, ",proxy-authz-non-critical" );
                                }
 
+#ifdef SLAP_AUTH_DN
                                switch ( mt->mt_idassert_flags & LDAP_BACK_AUTH_DN_MASK ) {
                                case LDAP_BACK_AUTH_DN_AUTHZID:
                                        ptr = lutil_strcopy( ptr, ",dn-authzid" );
@@ -1515,6 +1523,7 @@ meta_back_cf_gen( ConfigArgs *c )
 #endif
                                        break;
                                }
+#endif
 
                                bv.bv_len = ( ptr - bv.bv_val );
                                /* end-of-flags */