]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slapcommon.c
ITS#4780 plug leak
[openldap] / servers / slapd / slapcommon.c
index 1a1ea03441f6e0e5d05edf724f2dc5afe366d571..bad640605a6485b68b45b4d3e26b2aae5653a0f0 100644 (file)
@@ -71,7 +71,7 @@ usage( int tool, const char *progname )
 
        case SLAPADD:
                options = " [-c]\n\t[-g] [-n databasenumber | -b suffix]\n"
-                       "\t[-l ldiffile] [-q] [-u] [-s] [-w]\n";
+                       "\t[-l ldiffile] [-j linenumber] [-q] [-u] [-s] [-w]\n";
                break;
 
        case SLAPAUTH:
@@ -241,7 +241,7 @@ slap_tool_init(
 
        switch( tool ) {
        case SLAPADD:
-               options = "b:cd:f:F:gl:n:o:qstuvw";
+               options = "b:cd:f:F:gj:l:n:o:qstuvw";
                break;
 
        case SLAPCAT:
@@ -283,7 +283,7 @@ slap_tool_init(
        while ( (i = getopt( argc, argv, options )) != EOF ) {
                switch ( i ) {
                case 'a':
-                       filterstr = strdup( optarg );
+                       filterstr = ch_strdup( optarg );
                        break;
 
                case 'b':
@@ -320,19 +320,25 @@ slap_tool_init(
                        break;
 
                case 'f':       /* specify a conf file */
-                       conffile = strdup( optarg );
+                       conffile = ch_strdup( optarg );
                        break;
 
                case 'F':       /* specify a conf dir */
-                       confdir = strdup( optarg );
+                       confdir = ch_strdup( optarg );
                        break;
 
                case 'g':       /* disable subordinate glue */
                        use_glue = 0;
                        break;
 
+               case 'j':       /* jump to linenumber */
+                       if ( lutil_atoi( &jumpline, optarg ) ) {
+                               usage( tool, progname );
+                       }
+                       break;
+
                case 'l':       /* LDIF file */
-                       ldiffile = strdup( optarg );
+                       ldiffile = ch_strdup( optarg );
                        break;
 
                case 'M':
@@ -377,7 +383,7 @@ slap_tool_init(
                        if ( tool == SLAPADD )
                                mode |= SLAP_TOOL_NO_SCHEMA_CHECK;
                        else if ( tool == SLAPCAT )
-                               subtree = strdup( optarg );
+                               subtree = ch_strdup( optarg );
                        break;
 
                case 't':       /* turn on truncate */
@@ -511,6 +517,7 @@ slap_tool_init(
                        exit( EXIT_FAILURE );
        }
 
+#ifdef LDAP_SYSLOG
        if ( syslog_unknowns ) {
                rc = parse_debug_unknowns( syslog_unknowns, &ldap_syslog );
                ldap_charray_free( syslog_unknowns );
@@ -518,6 +525,7 @@ slap_tool_init(
                if ( rc )
                        exit( EXIT_FAILURE );
        }
+#endif
 
        at_oc_cache = 1;