]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#6937 - Remove unused proctitle bits
authorQuanah Gibson-Mount <quanah@openldap.org>
Wed, 15 Apr 2020 19:31:07 +0000 (19:31 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Wed, 15 Apr 2020 19:32:28 +0000 (19:32 +0000)
26 files changed:
clients/tools/common.c
clients/tools/ldapcompare.c
clients/tools/ldapdelete.c
clients/tools/ldapmodify.c
clients/tools/ldapmodrdn.c
clients/tools/ldappasswd.c
clients/tools/ldapsearch.c
clients/tools/ldapvc.c
clients/tools/ldapwhoami.c
configure.in
include/ac/setproctitle.h [deleted file]
include/portable.hin
libraries/libldap/test.c
libraries/liblutil/setproctitle.c [deleted file]
servers/slapd/main.c
servers/slapd/slapcommon.c
servers/slapd/slappasswd.c
tests/progs/slapd-addel.c
tests/progs/slapd-auth.c
tests/progs/slapd-common.c
tests/progs/slapd-modify.c
tests/progs/slapd-modrdn.c
tests/progs/slapd-mtread.c
tests/progs/slapd-read.c
tests/progs/slapd-search.c
tests/progs/slapd-tester.c

index 518017ae6b4b8e0035258d08604fcb368c867e15..b29cff77f5272260dab61c6ea180944152cdbe29 100644 (file)
@@ -285,63 +285,17 @@ tool_destroy( void )
                BER_BVZERO( &pr_cookie );
        }
 
-       if ( binddn != NULL ) {
-               ber_memfree( binddn );
-               binddn = NULL;
-       }
-
        if ( passwd.bv_val != NULL ) {
                ber_memfree( passwd.bv_val );
                BER_BVZERO( &passwd );
        }
 
-#ifdef HAVE_CYRUS_SASL
-       if ( sasl_mech != NULL ) {
-               ber_memfree( sasl_mech );
-               sasl_mech = NULL;
-       }
-#endif /* HAVE_CYRUS_SASL */
-
-       if ( infile != NULL ) {
-               ber_memfree( infile );
-               infile = NULL;
-       }
-
-       if ( assertion ) {
-               ber_memfree( assertion );
-               assertion = NULL;
-       }
-
-       if ( authzid ) {
-               ber_memfree( authzid );
-               authzid = NULL;
-       }
-
-       if ( proxydn ) {
-               ber_memfree( proxydn );
-               proxydn = NULL;
-       }
-
-       if ( preread_attrs ) {
-               ber_memfree( preread_attrs );
-               preread_attrs = NULL;
-       }
-
-       if ( postread_attrs ) {
-               ber_memfree( postread_attrs );
-               postread_attrs = NULL;
-       }
-
 #ifdef LDAP_CONTROL_X_SESSION_TRACKING
        if ( !BER_BVISNULL( &stValue ) ) {
                ber_memfree( stValue.bv_val );
                BER_BVZERO( &stValue );
        }
 
-       if ( sessionTrackingName ) {
-               ber_memfree( sessionTrackingName );
-               sessionTrackingName = NULL;
-       }
 #endif /* LDAP_CONTROL_X_SESSION_TRACKING */
 }
 
@@ -473,7 +427,7 @@ tool_args( int argc, char **argv )
                                fprintf( stderr, "%s: -D previously specified\n", prog );
                                exit( EXIT_FAILURE );
                        }
-                       binddn = ber_strdup( optarg );
+                       binddn = optarg;
                        break;
                case 'e':       /* general extensions (controls and such) */
                        /* should be extended to support comma separated list of
@@ -487,7 +441,7 @@ tool_args( int argc, char **argv )
                                optarg++;
                        }
 
-                       control = ber_strdup( optarg );
+                       control = optarg;
                        if ( (cvalue = strchr( control, '=' )) != NULL ) {
                                *cvalue++ = '\0';
                        }
@@ -505,7 +459,7 @@ tool_args( int argc, char **argv )
                                assertctl = 1 + crit;
 
                                assert( assertion == NULL );
-                               assertion = ber_strdup( cvalue );
+                               assertion = cvalue;
 
                        } else if ( strcasecmp( control, "authzid" ) == 0 ) {
                                if( authzid != NULL ) {
@@ -532,7 +486,7 @@ tool_args( int argc, char **argv )
                                }
 
                                assert( authzid == NULL );
-                               authzid = ber_strdup( cvalue );
+                               authzid = cvalue;
 
 #ifdef LDAP_CONTROL_OBSOLETE_PROXY_AUTHZ
                        } else if ( strcasecmp( control, "proxydn" ) == 0 ) {
@@ -558,7 +512,7 @@ tool_args( int argc, char **argv )
                                }
 
                                assert( proxydn == NULL );
-                               proxydn = ber_strdup( cvalue );
+                               proxydn = cvalue;
 #endif /* LDAP_CONTROL_OBSOLETE_PROXY_AUTHZ */
 
                        } else if ( strcasecmp( control, "bauthzid" ) == 0 ) {
@@ -639,7 +593,7 @@ tool_args( int argc, char **argv )
                                }
 
                                preread = 1 + crit;
-                               preread_attrs = ber_strdup( cvalue );
+                               preread_attrs = cvalue;
 
                        } else if ( strcasecmp( control, "postread" ) == 0 ) {
                                if( postread ) {
@@ -648,7 +602,7 @@ tool_args( int argc, char **argv )
                                }
 
                                postread = 1 + crit;
-                               postread_attrs = ber_strdup( cvalue );
+                               postread_attrs = cvalue;
 
 #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
                        } else if ( strcasecmp( control, "chaining" ) == 0 ) {
@@ -713,7 +667,7 @@ tool_args( int argc, char **argv )
                                        usage();
                                }
                                if ( cvalue ) {
-                                       sessionTrackingName = ber_strdup( cvalue );
+                                       sessionTrackingName = cvalue;
                                }
 #endif /* LDAP_CONTROL_X_SESSION_TRACKING */
 
@@ -793,24 +747,20 @@ tool_args( int argc, char **argv )
                                        control );
                                usage();
                        }
-                       if ( control ) {
-                               ber_memfree( control );  
-                               control = NULL;
-                       }
                        break;
                case 'f':       /* read from file */
                        if( infile != NULL ) {
                                fprintf( stderr, "%s: -f previously specified\n", prog );
                                exit( EXIT_FAILURE );
                        }
-                       infile = ber_strdup( optarg );
+                       infile = optarg;
                        break;
                case 'h':       /* ldap host */
                        if( ldaphost != NULL ) {
                                fprintf( stderr, "%s: -h previously specified\n", prog );
                                exit( EXIT_FAILURE );
                        }
-                       ldaphost = ber_strdup( optarg );
+                       ldaphost = optarg;
                        break;
                case 'H':       /* ldap URI */
                        if( ldapuri != NULL ) {
@@ -846,7 +796,7 @@ tool_args( int argc, char **argv )
                        nocanon++;
                        break;
                case 'o':
-                       control = ber_strdup( optarg );
+                       control = optarg;
                        if ( (cvalue = strchr( control, '=' )) != NULL ) {
                                *cvalue++ = '\0';
                        }
@@ -906,7 +856,6 @@ tool_args( int argc, char **argv )
                                        control );
                                usage();
                        }
-                       ber_memfree(control);
                        break;
                case 'O':
 #ifdef HAVE_CYRUS_SASL
@@ -920,7 +869,7 @@ tool_args( int argc, char **argv )
                                exit( EXIT_FAILURE );
                        }
                        authmethod = LDAP_AUTH_SASL;
-                       sasl_secprops = ber_strdup( optarg );
+                       sasl_secprops = optarg;
 #else
                        fprintf( stderr, "%s: not compiled with SASL support\n", prog );
                        exit( EXIT_FAILURE );
@@ -996,7 +945,7 @@ tool_args( int argc, char **argv )
                                exit( EXIT_FAILURE );
                        }
                        authmethod = LDAP_AUTH_SASL;
-                       sasl_realm = ber_strdup( optarg );
+                       sasl_realm = optarg;
 #else
                        fprintf( stderr, "%s: not compiled with SASL support\n",
                                prog );
@@ -1016,7 +965,7 @@ tool_args( int argc, char **argv )
                                exit( EXIT_FAILURE );
                        }
                        authmethod = LDAP_AUTH_SASL;
-                       sasl_authc_id = ber_strdup( optarg );
+                       sasl_authc_id = optarg;
 #else
                        fprintf( stderr, "%s: not compiled with SASL support\n",
                                prog );
@@ -1058,7 +1007,7 @@ tool_args( int argc, char **argv )
                                exit( EXIT_FAILURE );
                        }
                        authmethod = LDAP_AUTH_SASL;
-                       sasl_mech = ber_strdup( optarg );
+                       sasl_mech = optarg;
 #else
                        fprintf( stderr, "%s: not compiled with SASL support\n", prog );
                        exit( EXIT_FAILURE );
@@ -1084,7 +1033,7 @@ tool_args( int argc, char **argv )
                                exit( EXIT_FAILURE );
                        }
                        authmethod = LDAP_AUTH_SASL;
-                       sasl_authz_id = ber_strdup( optarg );
+                       sasl_authz_id = optarg;
 #else
                        fprintf( stderr, "%s: not compiled with SASL support\n", prog );
                        exit( EXIT_FAILURE );
index 4d0bfa86a75b8f39527cdce01620c7201f6fc319..aee1c07ffc94c6409565c48916893ef7a1e2de2e 100644 (file)
@@ -135,7 +135,7 @@ handle_private_option( int i )
                        optarg++;
                }
 
-               control = ber_strdup( optarg );
+               control = optarg;
                if ( (cvalue = strchr( control, '=' )) != NULL ) {
                        *cvalue++ = '\0';
                }
index 16a14d41eab9e5d056df7d4caba4f5e8bbc68bee..000e486f0e1e857e9d1e9faa05c1457b1630b073 100644 (file)
@@ -111,7 +111,7 @@ handle_private_option( int i )
                        optarg++;
                }
 
-               control = strdup( optarg );
+               control = optarg;
                if ( (cvalue = strchr( control, '=' )) != NULL ) {
                        *cvalue++ = '\0';
                }
index 57657fdaa2cd716e9129f17793bdc8ff091618d2..ead93688cac06e35f72cbab73fd6af5b2cb2f15f 100644 (file)
@@ -152,7 +152,7 @@ handle_private_option( int i )
                        optarg++;
                }
 
-               control = ber_strdup( optarg );
+               control = optarg;
                if ( (cvalue = strchr( control, '=' )) != NULL ) {
                        *cvalue++ = '\0';
                }
@@ -181,7 +181,6 @@ handle_private_option( int i )
                                control );
                        usage();
                }
-               ber_memfree( control );
                break;
 
        case 'a':       /* add */
@@ -196,7 +195,7 @@ handle_private_option( int i )
                        fprintf( stderr, _("%s: -S previously specified\n"), prog );
                        exit( EXIT_FAILURE );
                }
-               rejfile = ber_strdup( optarg );
+               rejfile = optarg;
                break;
 
        default:
index 868900fbd396690d65c27f71a37e92b86feb64d6..3c2f05202df07abfe306d98798627bd10f3f85fd 100644 (file)
@@ -122,7 +122,7 @@ handle_private_option( int i )
                        optarg++;
                }
 
-               control = strdup( optarg );
+               control = optarg;
                if ( (cvalue = strchr( control, '=' )) != NULL ) {
                        *cvalue++ = '\0';
                }
@@ -140,7 +140,7 @@ handle_private_option( int i )
                                prog, protocol );
                        exit( EXIT_FAILURE );
                }
-               newSuperior = strdup( optarg );
+               newSuperior = optarg;
                protocol = LDAP_VERSION3;
                break;
 
index 6029d94b41969890d073b7613e3113e605f4a5fd..313a8dea6b101dcc63fe7597fe9ec3c423d11c6d 100644 (file)
@@ -108,7 +108,7 @@ handle_private_option( int i )
                        optarg++;
                }
 
-               control = strdup( optarg );
+               control = optarg;
                if ( (cvalue = strchr( control, '=' )) != NULL ) {
                        *cvalue++ = '\0';
                }
@@ -133,7 +133,7 @@ handle_private_option( int i )
                break;
 
        case 's':       /* new password (secret) */
-               newpw.bv_val = strdup (optarg);
+               newpw.bv_val = strdup( optarg );
                {
                        char* p;
                        for( p = optarg; *p != '\0'; p++ ) {
index 812d753d61d33542ec04f498717deb3065041e85..a89c8b9dfb5cf8ac7e82aa44a7aed13754a4f568 100644 (file)
@@ -383,7 +383,7 @@ handle_private_option( int i )
                ++attrsonly;
                break;
        case 'b': /* search base */
-               base = ber_strdup( optarg );
+               base = optarg;
                break;
        case 'E': /* search extensions */
                if( protocol == LDAP_VERSION2 ) {
@@ -403,7 +403,7 @@ handle_private_option( int i )
                        optarg++;
                }
 
-               control = ber_strdup( optarg );
+               control = optarg;
                if ( (cvalue = strchr( control, '=' )) != NULL ) {
                        *cvalue++ = '\0';
                }
@@ -873,7 +873,7 @@ handle_private_option( int i )
                break;
        case 'F':       /* uri prefix */
                if( urlpre ) free( urlpre );
-               urlpre = strdup( optarg );
+               urlpre = optarg;
                break;
        case 'l':       /* time limit */
                if ( strcasecmp( optarg, "none" ) == 0 ) {
@@ -917,14 +917,14 @@ handle_private_option( int i )
                }
                break;
        case 'S':       /* sort attribute */
-               sortattr = strdup( optarg );
+               sortattr = optarg;
                break;
        case 't':       /* write attribute values to TMPDIR files */
                ++vals2tmp;
                break;
        case 'T':       /* tmpdir */
                if( tmpdir ) free( tmpdir );
-               tmpdir = strdup( optarg );
+               tmpdir = optarg;
                break;
        case 'u':       /* include UFN */
                ++includeufn;
@@ -1609,12 +1609,6 @@ getNextPage:
                goto getNextPage;
        }
 
-       if ( base != NULL ) {
-               ber_memfree( base );
-       }
-       if ( control != NULL ) {
-               ber_memfree( control );
-       }
        if ( sss_keys != NULL ) {
                ldap_free_sort_keylist( sss_keys );
        }
index 09e465d4b92e22c89de576effceae6d97a6589f9..49be3769f0717cb31557fb62e47ac8879576f53a 100644 (file)
@@ -112,7 +112,7 @@ handle_private_option( int i )
                        optarg++;
                }
 
-               control = strdup( optarg );
+               control = optarg;
                if ( (cvalue = strchr( control, '=' )) != NULL ) {
                        *cvalue++ = '\0';
                }
@@ -255,7 +255,6 @@ handle_private_option( int i )
                    fprintf( stderr, _("Invalid Verify Credentials extension name: %s\n"), control );
                    usage();
                }
-               free( control );
                break;
 
        case 'a':  /* request authzid */
index e2326fc665b8923cc84797646c796d0f54f90588..050038140de2873e99930d5a6677397208faf079 100644 (file)
@@ -89,7 +89,7 @@ handle_private_option( int i )
                        optarg++;
                }
 
-               control = strdup( optarg );
+               control = optarg;
                if ( (cvalue = strchr( control, '=' )) != NULL ) {
                        *cvalue++ = '\0';
                }
index b9f0c6267bea8fe495d4f2319f7262007138fe8c..cca3b0bb7e994307d90812ef697fe15f78e5f6e9 100644 (file)
@@ -228,7 +228,6 @@ dnl set default to traditional to enable the original debug style
 OL_ARG_ENABLE(debug,[  --enable-debug    enable debugging], yes, [no yes traditional])dnl
 OL_ARG_ENABLE(dynamic,[  --enable-dynamic        enable linking built binaries with dynamic libs], auto)dnl
 OL_ARG_ENABLE(syslog,[  --enable-syslog          enable syslog support], auto)dnl
-OL_ARG_ENABLE(proctitle,[  --enable-proctitle    enable proctitle support], yes)dnl
 dnl OL_ARG_ENABLE(referrals,[  --enable-referrals        enable LDAPv2+ Referrals (experimental)], no)dnl
 ol_enable_referrals=${ol_enable_referrals-no}
 OL_ARG_ENABLE(ipv6,[  --enable-ipv6      enable IPv6 support], auto)dnl
@@ -2159,23 +2158,6 @@ if test $ol_enable_crypt != no ; then
        fi
 fi
 
-dnl ----------------------------------------------------------------
-dnl FreeBSD (and others) have setproctitle(3) in -lutil
-if test $ol_enable_proctitle != no ; then
-       AC_CHECK_FUNC(setproctitle,     [have_setproctitle=yes], [
-               AC_CHECK_LIB(util, setproctitle,
-                       [have_setproctitle=yes
-                       LUTIL_LIBS="$LUTIL_LIBS -lutil"],
-                       [have_setproctitle=no
-                       AC_LIBOBJ(setproctitle)
-                       LIBSRCS="$LIBSRCS setproctitle.c"])])
-
-       if test $have_setproctitle = yes ; then
-               AC_DEFINE(HAVE_SETPROCTITLE,1,
-                       [define if setproctitle(3) is available])
-       fi
-fi
-
 dnl ----------------------------------------------------------------
 if test $ol_enable_slp != no ; then
        AC_CHECK_HEADERS( slp.h )
@@ -2505,10 +2487,6 @@ if test "$ol_enable_syslog" = yes ; then
        AC_DEFINE(LDAP_SYSLOG,1,
                [define this to add syslog code])
 fi
-if test "$ol_enable_proctitle" != no ; then
-       AC_DEFINE(LDAP_PROCTITLE,1,
-               [define this for LDAP process title support])
-fi
 if test "$ol_enable_referrals" != no ; then
        AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS,LDAP_VENDOR_VERSION,
                [define to LDAP VENDOR VERSION])
diff --git a/include/ac/setproctitle.h b/include/ac/setproctitle.h
deleted file mode 100644 (file)
index 0bacbf3..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Generic setproctitle.h */
-/* $OpenLDAP$ */
-/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
- *
- * Copyright 1998-2020 The OpenLDAP Foundation.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted only as authorized by the OpenLDAP
- * Public License.
- *
- * A copy of this license is available in file LICENSE in the
- * top-level directory of the distribution or, alternatively, at
- * <http://www.OpenLDAP.org/license.html>.
- */
-
-#ifndef _AC_SETPROCTITLE_H
-#define _AC_SETPROCTITLE_H
-
-#ifdef LDAP_PROCTITLE
-
-#if defined( HAVE_LIBUTIL_H )
-#      include <libutil.h>
-#else
-       /* use lutil version */
-       LDAP_LUTIL_F (void) (setproctitle) LDAP_P((const char *fmt, ...)) \
-               LDAP_GCCATTR((format(printf, 1, 2)));
-       LDAP_LUTIL_V (int) Argc;
-       LDAP_LUTIL_V (char) **Argv;
-#endif
-
-#endif /* LDAP_PROCTITLE */
-#endif /* _AC_SETPROCTITLE_H */
index 6d98db22659fbe626eb67a4a0b8f0975162a0848..a785d097634dde333d7f7b0658923ebfa98eadf5 100644 (file)
 /* Define to 1 if you have the `setgid' function. */
 #undef HAVE_SETGID
 
-/* define if setproctitle(3) is available */
-#undef HAVE_SETPROCTITLE
-
 /* Define to 1 if you have the `setpwfile' function. */
 #undef HAVE_SETPWFILE
 
index 9f415bb455511a64accafb12d9c2ea29911196fe..e3e587dcb80ef202b556adb7af070ee87007958b 100644 (file)
@@ -320,12 +320,12 @@ main( int argc, char **argv )
                        break;
 
                case 't':       /* copy ber's to given file */
-                       copyfname = strdup( optarg );
+                       copyfname = optarg;
 /*                     copyoptions = LBER_TO_FILE; */
                        break;
 
                case 'T':       /* only output ber's to given file */
-                       copyfname = strdup( optarg );
+                       copyfname = optarg;
 /*                     copyoptions = (LBER_TO_FILE | LBER_TO_FILE_ONLY); */
                        break;
 
diff --git a/libraries/liblutil/setproctitle.c b/libraries/liblutil/setproctitle.c
deleted file mode 100644 (file)
index 1c2fbf5..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/* $OpenLDAP$ */
-/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
- *
- * Copyright 1998-2020 The OpenLDAP Foundation.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted only as authorized by the OpenLDAP
- * Public License.
- *
- * A copy of this license is available in the file LICENSE in the
- * top-level directory of the distribution or, alternatively, at
- * <http://www.OpenLDAP.org/license.html>.
- */
-/* Portions Copyright (c) 1990,1991 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-#include "portable.h"
-
-#ifndef HAVE_SETPROCTITLE
-
-#include <stdio.h>
-
-#include <ac/stdlib.h>
-
-#include <ac/setproctitle.h>
-#include <ac/string.h>
-#include <ac/stdarg.h>
-
-char   **Argv;         /* pointer to original (main's) argv */
-int    Argc;           /* original argc */
-
-/*
- * takes a printf-style format string (fmt) and up to three parameters (a,b,c)
- * this clobbers the original argv...
- */
-
-/* VARARGS */
-void setproctitle( const char *fmt, ... )
-{
-       static char *endargv = (char *)0;
-       char    *s;
-       int             i;
-       char    buf[ 1024 ];
-       va_list ap;
-
-       va_start(ap, fmt);
-
-       buf[sizeof(buf) - 1] = '\0';
-       vsnprintf( buf, sizeof(buf)-1, fmt, ap );
-
-       va_end(ap);
-
-       if ( endargv == (char *)0 ) {
-               /* set pointer to end of original argv */
-               endargv = Argv[ Argc-1 ] + strlen( Argv[ Argc-1 ] );
-       }
-       /* make ps print "([prog name])" */
-       s = Argv[0];
-       *s++ = '-';
-       i = strlen( buf );
-       if ( i > endargv - s - 2 ) {
-               i = endargv - s - 2;
-               buf[ i ] = '\0';
-       }
-       strcpy( s, buf );
-       s += i;
-       while ( s < endargv ) *s++ = ' ';
-}
-#endif /* NOSETPROCTITLE */
index 44432d1b3f28e24dffa99072fdbe1f74ca128e81..0a76bc4cc24d585703c1fdf24206ea33fcb31025 100644 (file)
@@ -494,7 +494,7 @@ int main( int argc, char **argv )
 
                case 'h':       /* listen URLs */
                        if ( urls != NULL ) free( urls );
-                       urls = ch_strdup( optarg );
+                       urls = optarg;
                        break;
 
                case 'c':       /* provide sync cookie, override if exist in replica */
@@ -546,11 +546,11 @@ int main( int argc, char **argv )
                        } break;
 
                case 'f':       /* read config file */
-                       configfile = ch_strdup( optarg );
+                       configfile = optarg;
                        break;
 
                case 'F':       /* use config dir */
-                       configdir = ch_strdup( optarg );
+                       configdir = optarg;
                        break;
 
                case 'o': {
@@ -615,25 +615,22 @@ int main( int argc, char **argv )
 
 #ifdef HAVE_CHROOT
                case 'r':
-                       if( sandbox ) free(sandbox);
-                       sandbox = ch_strdup( optarg );
+                       sandbox = optarg;
                        break;
 #endif
 
 #if defined(HAVE_SETUID) && defined(HAVE_SETGID)
                case 'u':       /* user name */
-                       if( username ) free(username);
-                       username = ch_strdup( optarg );
+                       username = optarg;
                        break;
 
                case 'g':       /* group name */
-                       if( groupname ) free(groupname);
-                       groupname = ch_strdup( optarg );
+                       groupname = optarg;
                        break;
 #endif /* SETUID && GETUID */
 
                case 'n':  /* NT service name */
-                       serverName = ch_strdup( optarg );
+                       serverName = optarg;
                        break;
 
                case 't':
@@ -1100,12 +1097,6 @@ stop:
 
        config_destroy();
 
-       if ( configfile )
-               ch_free( configfile );
-       if ( configdir )
-               ch_free( configdir );
-       if ( urls )
-               ch_free( urls );
        if ( global_host )
                ch_free( global_host );
 
index f170496e2df08bb662f6ff549364bdcd7a33254b..954cc385852a2967eb2c4a1596bee3397f929a59 100644 (file)
@@ -362,7 +362,7 @@ slap_tool_init(
        while ( (i = getopt( argc, argv, options )) != EOF ) {
                switch ( i ) {
                case 'a':
-                       filterstr = ch_strdup( optarg );
+                       filterstr = optarg;
                        break;
 
                case 'b':
@@ -399,11 +399,11 @@ slap_tool_init(
                        break;
 
                case 'f':       /* specify a conf file */
-                       conffile = ch_strdup( optarg );
+                       conffile = optarg;
                        break;
 
                case 'F':       /* specify a conf dir */
-                       confdir = ch_strdup( optarg );
+                       confdir = optarg;
                        break;
 
                case 'g':       /* disable subordinate glue */
@@ -464,7 +464,7 @@ slap_tool_init(
                        break;
 
                case 'l':       /* LDIF file */
-                       ldiffile = ch_strdup( optarg );
+                       ldiffile = optarg;
                        break;
 
                case 'M':
@@ -530,7 +530,7 @@ slap_tool_init(
                        case SLAPSCHEMA:
                                /* dump subtree */
                                ch_free( subtree );
-                               subtree = ch_strdup( optarg );
+                               subtree = optarg;
                                break;
                        }
                        break;
@@ -753,9 +753,6 @@ slap_tool_init(
                        fprintf( stderr, "Invalid filter '%s'\n", filterstr );
                        exit( EXIT_FAILURE );
                }
-
-               ch_free( filterstr );
-               filterstr = NULL;
        }
 
        if( subtree ) {
@@ -894,20 +891,6 @@ startup:;
        mal_leaktrace(1);
 #endif
 
-       if ( conffile != NULL ) {
-               ch_free( conffile );
-               conffile = NULL;
-       }
-
-       if ( confdir != NULL ) {
-               ch_free( confdir );
-               confdir = NULL;
-       }
-
-       if ( ldiffile != NULL ) {
-               ch_free( ldiffile );
-               ldiffile = NULL;
-       }
 
        /* slapdn doesn't specify a backend to startup */
        if ( !dryrun && tool != SLAPDN ) {
index 95d081d6e1f964be887d1dc6d43dbedffafe2c51..1a782b2fc02b232a4bb81a8676976ccf5bbe44f3 100644 (file)
@@ -77,14 +77,10 @@ parse_slappasswdopt( void )
        }
 
        if ( strncasecmp( optarg, "module-path", len ) == 0 ) {
-               if ( modulepath )
-                       ch_free( modulepath );
-               modulepath = ch_strdup( p );
+               modulepath = p;
 
        } else if ( strncasecmp( optarg, "module-load", len ) == 0 ) {
-               if ( moduleload )
-                       ch_free( moduleload );
-               moduleload = ch_strdup( p );
+               moduleload = p;
 
        } else {
                return -1;
@@ -151,7 +147,7 @@ slappasswd( int argc, char *argv[] )
                                return EXIT_FAILURE;
 
                        } else {
-                               scheme = ch_strdup( optarg );
+                               scheme = optarg;
                        }
                        break;
 
index cbb4cabc4b489352e0e5f8b52a6b4820026cf8a0..9fab0789684dfc251c9362c4c80ef74329ac3244 100644 (file)
@@ -84,7 +84,7 @@ main( int argc, char **argv )
                        break;
 
                case 'f':               /* file with entry search request */
-                       filename = strdup( optarg );
+                       filename = optarg;
                        break;
 
                default:
index 20c73abede2a5cec016a3eb93879cbf3c8f96b23..d475f116e73952ac886552c3dfb46c047091afdf 100644 (file)
@@ -81,15 +81,15 @@ main( int argc, char **argv )
        while ( (i = getopt( argc, argv, "b:D:H:w:f:n:i:t:r:R:" )) != EOF ) {
                switch( i ) {
                        case 'b':               /* base DN of a tree of user DNs */
-                               base = strdup( optarg );
+                               base = optarg;
                                break;
 
                        case 'D':
-                               binder = strdup( optarg );
+                               binder = optarg;
                                break;
 
                        case 'H':               /* the server uri */
-                               uri = strdup( optarg );
+                               uri = optarg;
                                break;
 
                        case 'w':
index 101e43d848e9b683d3df87310eed52aa1ccf2bec..774c35eb4139594c3dc5dce7fd2886b7ad3ad312 100644 (file)
@@ -306,7 +306,7 @@ tester_config_opt( struct tester_conn_args *config, char opt, char *optarg )
                        break;
 
                case 'D':
-                       config->binddn = strdup( optarg );
+                       config->binddn = optarg;
                        break;
 
                case 'd':
@@ -333,11 +333,11 @@ tester_config_opt( struct tester_conn_args *config, char opt, char *optarg )
                        }
 
                case 'H':
-                       config->uri = strdup( optarg );
+                       config->uri = optarg;
                        break;
 
                case 'h':
-                       config->host = strdup( optarg );
+                       config->host = optarg;
                        break;
 
                case 'i':
@@ -365,7 +365,7 @@ tester_config_opt( struct tester_conn_args *config, char opt, char *optarg )
                                return -1;
                        }
                        config->authmethod = LDAP_AUTH_SASL;
-                       config->secprops = ber_strdup( optarg );
+                       config->secprops = optarg;
                        break;
 
                case 'R':
@@ -376,7 +376,7 @@ tester_config_opt( struct tester_conn_args *config, char opt, char *optarg )
                                return -1;
                        }
                        config->authmethod = LDAP_AUTH_SASL;
-                       config->realm = ber_strdup( optarg );
+                       config->realm = optarg;
                        break;
 
                case 'U':
@@ -387,7 +387,7 @@ tester_config_opt( struct tester_conn_args *config, char opt, char *optarg )
                                return -1;
                        }
                        config->authmethod = LDAP_AUTH_SASL;
-                       config->authc_id = ber_strdup( optarg );
+                       config->authc_id = optarg;
                        break;
 
                case 'X':
@@ -398,7 +398,7 @@ tester_config_opt( struct tester_conn_args *config, char opt, char *optarg )
                                return -1;
                        }
                        config->authmethod = LDAP_AUTH_SASL;
-                       config->authz_id = ber_strdup( optarg );
+                       config->authz_id = optarg;
                        break;
 
                case 'Y':
@@ -409,7 +409,7 @@ tester_config_opt( struct tester_conn_args *config, char opt, char *optarg )
                                return -1;
                        }
                        config->authmethod = LDAP_AUTH_SASL;
-                       config->mech = ber_strdup( optarg );
+                       config->mech = optarg;
                        break;
 #endif
 
index 23bb7e9d9052f127c4ad4e8989f9648de8ac38f9..ee67387e6ac5938964e06e86199a8a1bf8412b0a 100644 (file)
@@ -78,11 +78,11 @@ main( int argc, char **argv )
                        break;
 
                case 'e':               /* entry to modify */
-                       entry = strdup( optarg );
+                       entry = optarg;
                        break;
 
                case 'a':
-                       ava = strdup( optarg );
+                       ava = optarg;
                        break;
 
                default:
index d82d82c69e10aaf19dacbf18843532dd26f0b1ed..d25be2ca9704c287ffcd69780d571169ecc229de 100644 (file)
@@ -79,7 +79,7 @@ main( int argc, char **argv )
                        break;
 
                case 'e':               /* entry to rename */
-                       entry = strdup( optarg );
+                       entry = optarg;
                        break;
 
                default:
index c8024cb6e1769e60eb3bcf9f16c620ce9ab9e6b5..1b99b625c2524c13e69b7ae9ceea3242b3eaa7cf 100644 (file)
@@ -190,11 +190,11 @@ main( int argc, char **argv )
                        break;
 
                case 'e':               /* DN to search for */
-                       entry = strdup( optarg );
+                       entry = optarg;
                        break;
 
                case 'f':               /* the search request */
-                       filter = strdup( optarg );
+                       filter = optarg;
                        break;
 
                case 'F':
index f95228317b1cb82eb4a9c9e8fc150a2da61ca4ac..bf8b8f7f1b3ed181c67ade8eebd2d2f61b8e1028 100644 (file)
@@ -105,11 +105,11 @@ main( int argc, char **argv )
                        break;
 
                case 'e':               /* DN to search for */
-                       entry = strdup( optarg );
+                       entry = optarg;
                        break;
 
                case 'f':               /* the search request */
-                       filter = strdup( optarg );
+                       filter = optarg;
                        break;
 
                case 'F':
index 321fd80e388e18990cf346b70832cf0d579ed275..f80b7a77a22b7cb30d220fb32a7e5d19989f97ec 100644 (file)
@@ -110,15 +110,15 @@ main( int argc, char **argv )
                        break;
 
                case 'a':
-                       attr = strdup( optarg );
+                       attr = optarg;
                        break;
 
                case 'b':               /* file with search base */
-                       sbase = strdup( optarg );
+                       sbase = optarg;
                        break;
 
                case 'f':               /* the search request */
-                       filter = strdup( optarg );
+                       filter = optarg;
                        break;
 
                case 'F':
index bf9e10b9646d87fa52a096521ecd24d9a3faf670..959fb251950cb2b93cb40b0d23dc6ec7b1f73f86 100644 (file)
@@ -251,7 +251,7 @@ main( int argc, char **argv )
                        break;
 
                case 'd':               /* data directory */
-                       dirname = strdup( optarg );
+                       dirname = optarg;
                        break;
 
                case 'F':
@@ -259,11 +259,11 @@ main( int argc, char **argv )
                        break;
 
                case 'H':               /* slapd uri */
-                       uri = strdup( optarg );
+                       uri = optarg;
                        break;
 
                case 'h':               /* slapd host */
-                       host = strdup( optarg );
+                       host = optarg;
                        break;
 
                case 'I':
@@ -325,7 +325,7 @@ main( int argc, char **argv )
                        break;
 
                case 'L':               /* the number of outerloops per client */
-                       outerloops = strdup( optarg );
+                       outerloops = optarg;
                        break;
 
                case 'N':
@@ -333,15 +333,15 @@ main( int argc, char **argv )
                        break;
 
                case 'P':               /* prog directory */
-                       progdir = strdup( optarg );
+                       progdir = optarg;
                        break;
 
                case 'p':               /* the servers port number */
-                       port = strdup( optarg );
+                       port = optarg;
                        break;
 
                case 'r':               /* the number of retries in case of error */
-                       retries = strdup( optarg );
+                       retries = optarg;
                        break;
 
                case 'S':
@@ -349,7 +349,7 @@ main( int argc, char **argv )
                        break;
 
                case 't':               /* the delay in seconds between each retry */
-                       delay = strdup( optarg );
+                       delay = optarg;
                        break;
 
                case 'w':               /* the managers passwd */