+ ad = NULL;
+ rc = slap_str2ad( type, &ad, &text );
+
+ if( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "str2entry: str2ad(%s): %s\n", type, text ));
+#else
+ Debug( slapMode & SLAP_TOOL_MODE
+ ? LDAP_DEBUG_ANY : LDAP_DEBUG_TRACE,
+ "<= str2entry: str2ad(%s): %s\n", type, text, 0 );
+#endif
+ if( slapMode & SLAP_TOOL_MODE ) {
+ entry_free( e );
+ free( vals[0].bv_val );
+ free( type );
+ return NULL;
+ }
+
+ rc = slap_str2undef_ad( type, &ad, &text );
+ if( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "str2entry: str2undef_ad(%s): %s\n", type, text ));
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "<= str2entry: str2undef_ad(%s): %s\n",
+ type, text, 0 );
+#endif
+ entry_free( e );
+ free( vals[0].bv_val );
+ free( type );
+ return NULL;
+ }
+ }
+
+ if( slapMode & SLAP_TOOL_MODE ) {
+ struct berval pval;
+ slap_syntax_validate_func *validate =
+ ad->ad_type->sat_syntax->ssyn_validate;
+ slap_syntax_transform_func *pretty =
+ ad->ad_type->sat_syntax->ssyn_pretty;
+
+ if( pretty ) {
+ rc = pretty( ad->ad_type->sat_syntax,
+ &vals[0], &pval );
+
+ } else if( validate ) {
+ /*
+ * validate value per syntax
+ */
+ rc = validate( ad->ad_type->sat_syntax, &vals[0] );
+
+ } else {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "str2entry: no validator for syntax %s\n",
+ ad->ad_type->sat_syntax->ssyn_oid ));
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "str2entry: no validator for syntax %s\n",
+ ad->ad_type->sat_syntax->ssyn_oid, 0, 0 );
+#endif
+ entry_free( e );
+ free( vals[0].bv_val );
+ free( type );
+ return NULL;
+ }
+
+ if( rc != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "str2entry: invalid value for syntax %s\n",
+ ad->ad_type->sat_syntax->ssyn_oid ));
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "str2entry: invalid value for syntax %s\n",
+ ad->ad_type->sat_syntax->ssyn_oid, 0, 0 );
+#endif
+ entry_free( e );
+ free( vals[0].bv_val );
+ free( type );
+ return NULL;
+ }
+
+ if( pretty ) {
+ free( vals[0].bv_val );
+ vals[0] = pval;
+ }
+ }
+
+ rc = attr_merge( e, ad, vals );
+ if( rc != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "str2entry: NULL (attr_merge)\n" ));
+#else
+ Debug( LDAP_DEBUG_ANY,