]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slapadd.c
Plug mutex/rwlock leaks (destroy them)
[openldap] / servers / slapd / slapadd.c
index fe205eafb5f00bff907d0a83a8c2c3845be565a6..d88e1219713d78daf1dbf5842e512c8672b2c98d 100644 (file)
@@ -103,6 +103,14 @@ slapadd( int argc, char **argv )
 
        checkvals = (slapMode & SLAP_TOOL_QUICK) ? 0 : 1;
 
+       /* do not check values in quick mode */
+       if ( slapMode & SLAP_TOOL_QUICK ) {
+               if ( slapMode & SLAP_TOOL_VALUE_CHECK ) {
+                       fprintf( stderr, "%s: value-check incompatible with quick mode; disabled.\n", progname );
+                       slapMode &= ~SLAP_TOOL_VALUE_CHECK;
+               }
+       }
+
        lmax = 0;
        nextline = 0;
 
@@ -267,6 +275,34 @@ slapadd( int argc, char **argv )
                                }
                                textbuf[ 0 ] = '\0';
                        }
+
+                       if ( (slapMode & SLAP_TOOL_VALUE_CHECK) != 0) {
+                               Modifications *ml = NULL;
+
+                               if ( slap_entry2mods( e, &ml, &text, textbuf, textlen )
+                                       != LDAP_SUCCESS )
+                               {
+                                       fprintf( stderr, "%s: dn=\"%s\" (line=%d): (%d) %s\n",
+                                               progname, e->e_dn, lineno, rc, text );
+                                       rc = EXIT_FAILURE;
+                                       entry_free( e );
+                                       if( continuemode ) continue;
+                                       break;
+                               }
+                               textbuf[ 0 ] = '\0';
+
+                               rc = slap_mods_check( op, ml, &text, textbuf, textlen, NULL );
+                               slap_mods_free( ml, 1 );
+                               if ( rc != LDAP_SUCCESS ) {
+                                       fprintf( stderr, "%s: dn=\"%s\" (line=%d): (%d) %s\n",
+                                               progname, e->e_dn, lineno, rc, text );
+                                       rc = EXIT_FAILURE;
+                                       entry_free( e );
+                                       if( continuemode ) continue;
+                                       break;
+                               }
+                               textbuf[ 0 ] = '\0';
+                       }
                }
 
                if ( SLAP_LASTMOD(be) ) {