]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slapcommon.c
Fix ldif-wrap errmsg typo
[openldap] / servers / slapd / slapcommon.c
index ce6706713fc2873a2432e867090c2c44ee6ab29f..d2e2474aaa5dc5bdb11feecaa74abdf153ce1665 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2013 The OpenLDAP Foundation.
+ * Copyright 1998-2018 The OpenLDAP Foundation.
  * Portions Copyright 1998-2003 Kurt D. Zeilenga.
  * Portions Copyright 2003 IBM Corporation.
  * All rights reserved.
@@ -245,7 +245,7 @@ parse_slapopt( int tool, int *mode )
                        break;
 
                default:
-                       Debug( LDAP_DEBUG_ANY, "value-check meaningless for tool.\n", 0, 0, 0 );
+                       Debug( LDAP_DEBUG_ANY, "ldif-wrap meaningless for tool.\n", 0, 0, 0 );
                        break;
                }
 
@@ -437,6 +437,7 @@ slap_tool_init(
                        }
 
                        if ( ludp->lud_dn != NULL && ludp->lud_dn[0] != '\0' ) {
+                               ch_free( subtree );
                                subtree = ludp->lud_dn;
                                ludp->lud_dn = NULL;
                        }
@@ -522,6 +523,7 @@ slap_tool_init(
                        case SLAPCAT:
                        case SLAPSCHEMA:
                                /* dump subtree */
+                               ch_free( subtree );
                                subtree = ch_strdup( optarg );
                                break;
                        }
@@ -779,6 +781,11 @@ slap_tool_init(
                ber_memfree( nbase.bv_val );
                BER_BVZERO( &nbase );
 
+               if( be == NULL ) {
+                       fprintf( stderr, "%s: slap_init no backend for \"%s\"\n",
+                               progname, base.bv_val );
+                       exit( EXIT_FAILURE );
+               }
                switch ( tool ) {
                case SLAPACL:
                        goto startup;
@@ -787,11 +794,6 @@ slap_tool_init(
                        break;
                }
 
-               if( be == NULL ) {
-                       fprintf( stderr, "%s: slap_init no backend for \"%s\"\n",
-                               progname, base.bv_val );
-                       exit( EXIT_FAILURE );
-               }
                /* If the named base is a glue master, operate on the
                 * entire context
                 */
@@ -996,6 +998,7 @@ slap_tool_update_ctxcsn(
                                fprintf( stderr, "%s: couldn't create context entry\n", progname );
                                rc = EXIT_FAILURE;
                        }
+                       entry_free( ctxcsn_e );
                } else {
                        fprintf( stderr, "%s: context entry is missing\n", progname );
                        rc = EXIT_FAILURE;
@@ -1003,9 +1006,14 @@ slap_tool_update_ctxcsn(
        } else {
                ctxcsn_e = be->be_entry_get( be, ctxcsn_id );
                if ( ctxcsn_e != NULL ) {
+                       Operation op = { 0 };
                        Entry *e = entry_dup( ctxcsn_e );
-                       int change;
                        Attribute *attr = attr_find( e->e_attrs, slap_schema.si_ad_contextCSN );
+
+                       int change;
+                       op.o_bd = be;
+                       be_entry_release_r( &op, ctxcsn_e );
+
                        if ( attr ) {
                                int             i;