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 */
}
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
optarg++;
}
- control = ber_strdup( optarg );
+ control = optarg;
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
assertctl = 1 + crit;
assert( assertion == NULL );
- assertion = ber_strdup( cvalue );
+ assertion = cvalue;
} else if ( strcasecmp( control, "authzid" ) == 0 ) {
if( authzid != NULL ) {
}
assert( authzid == NULL );
- authzid = ber_strdup( cvalue );
+ authzid = cvalue;
#ifdef LDAP_CONTROL_OBSOLETE_PROXY_AUTHZ
} else if ( strcasecmp( control, "proxydn" ) == 0 ) {
}
assert( proxydn == NULL );
- proxydn = ber_strdup( cvalue );
+ proxydn = cvalue;
#endif /* LDAP_CONTROL_OBSOLETE_PROXY_AUTHZ */
} else if ( strcasecmp( control, "bauthzid" ) == 0 ) {
}
preread = 1 + crit;
- preread_attrs = ber_strdup( cvalue );
+ preread_attrs = cvalue;
} else if ( strcasecmp( control, "postread" ) == 0 ) {
if( postread ) {
}
postread = 1 + crit;
- postread_attrs = ber_strdup( cvalue );
+ postread_attrs = cvalue;
#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
} else if ( strcasecmp( control, "chaining" ) == 0 ) {
usage();
}
if ( cvalue ) {
- sessionTrackingName = ber_strdup( cvalue );
+ sessionTrackingName = cvalue;
}
#endif /* LDAP_CONTROL_X_SESSION_TRACKING */
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 ) {
nocanon++;
break;
case 'o':
- control = ber_strdup( optarg );
+ control = optarg;
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
control );
usage();
}
- ber_memfree(control);
break;
case 'O':
#ifdef HAVE_CYRUS_SASL
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 );
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 );
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 );
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 );
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 );
optarg++;
}
- control = ber_strdup( optarg );
+ control = optarg;
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
optarg++;
}
- control = strdup( optarg );
+ control = optarg;
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
optarg++;
}
- control = ber_strdup( optarg );
+ control = optarg;
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
control );
usage();
}
- ber_memfree( control );
break;
case 'a': /* add */
fprintf( stderr, _("%s: -S previously specified\n"), prog );
exit( EXIT_FAILURE );
}
- rejfile = ber_strdup( optarg );
+ rejfile = optarg;
break;
default:
optarg++;
}
- control = strdup( optarg );
+ control = optarg;
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
prog, protocol );
exit( EXIT_FAILURE );
}
- newSuperior = strdup( optarg );
+ newSuperior = optarg;
protocol = LDAP_VERSION3;
break;
optarg++;
}
- control = strdup( optarg );
+ control = optarg;
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
break;
case 's': /* new password (secret) */
- newpw.bv_val = strdup (optarg);
+ newpw.bv_val = strdup( optarg );
{
char* p;
for( p = optarg; *p != '\0'; p++ ) {
++attrsonly;
break;
case 'b': /* search base */
- base = ber_strdup( optarg );
+ base = optarg;
break;
case 'E': /* search extensions */
if( protocol == LDAP_VERSION2 ) {
optarg++;
}
- control = ber_strdup( optarg );
+ control = optarg;
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
break;
case 'F': /* uri prefix */
if( urlpre ) free( urlpre );
- urlpre = strdup( optarg );
+ urlpre = optarg;
break;
case 'l': /* time limit */
if ( strcasecmp( optarg, "none" ) == 0 ) {
}
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;
goto getNextPage;
}
- if ( base != NULL ) {
- ber_memfree( base );
- }
- if ( control != NULL ) {
- ber_memfree( control );
- }
if ( sss_keys != NULL ) {
ldap_free_sort_keylist( sss_keys );
}
optarg++;
}
- control = strdup( optarg );
+ control = optarg;
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
fprintf( stderr, _("Invalid Verify Credentials extension name: %s\n"), control );
usage();
}
- free( control );
break;
case 'a': /* request authzid */
optarg++;
}
- control = strdup( optarg );
+ control = optarg;
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
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
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 )
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])
+++ /dev/null
-/* 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 */
/* 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
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;
+++ /dev/null
-/* $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 */
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 */
} 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': {
#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':
config_destroy();
- if ( configfile )
- ch_free( configfile );
- if ( configdir )
- ch_free( configdir );
- if ( urls )
- ch_free( urls );
if ( global_host )
ch_free( global_host );
while ( (i = getopt( argc, argv, options )) != EOF ) {
switch ( i ) {
case 'a':
- filterstr = ch_strdup( optarg );
+ filterstr = optarg;
break;
case 'b':
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 */
break;
case 'l': /* LDIF file */
- ldiffile = ch_strdup( optarg );
+ ldiffile = optarg;
break;
case 'M':
case SLAPSCHEMA:
/* dump subtree */
ch_free( subtree );
- subtree = ch_strdup( optarg );
+ subtree = optarg;
break;
}
break;
fprintf( stderr, "Invalid filter '%s'\n", filterstr );
exit( EXIT_FAILURE );
}
-
- ch_free( filterstr );
- filterstr = NULL;
}
if( subtree ) {
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 ) {
}
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;
return EXIT_FAILURE;
} else {
- scheme = ch_strdup( optarg );
+ scheme = optarg;
}
break;
break;
case 'f': /* file with entry search request */
- filename = strdup( optarg );
+ filename = optarg;
break;
default:
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':
break;
case 'D':
- config->binddn = strdup( optarg );
+ config->binddn = optarg;
break;
case 'd':
}
case 'H':
- config->uri = strdup( optarg );
+ config->uri = optarg;
break;
case 'h':
- config->host = strdup( optarg );
+ config->host = optarg;
break;
case 'i':
return -1;
}
config->authmethod = LDAP_AUTH_SASL;
- config->secprops = ber_strdup( optarg );
+ config->secprops = optarg;
break;
case 'R':
return -1;
}
config->authmethod = LDAP_AUTH_SASL;
- config->realm = ber_strdup( optarg );
+ config->realm = optarg;
break;
case 'U':
return -1;
}
config->authmethod = LDAP_AUTH_SASL;
- config->authc_id = ber_strdup( optarg );
+ config->authc_id = optarg;
break;
case 'X':
return -1;
}
config->authmethod = LDAP_AUTH_SASL;
- config->authz_id = ber_strdup( optarg );
+ config->authz_id = optarg;
break;
case 'Y':
return -1;
}
config->authmethod = LDAP_AUTH_SASL;
- config->mech = ber_strdup( optarg );
+ config->mech = optarg;
break;
#endif
break;
case 'e': /* entry to modify */
- entry = strdup( optarg );
+ entry = optarg;
break;
case 'a':
- ava = strdup( optarg );
+ ava = optarg;
break;
default:
break;
case 'e': /* entry to rename */
- entry = strdup( optarg );
+ entry = optarg;
break;
default:
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':
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':
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':
break;
case 'd': /* data directory */
- dirname = strdup( optarg );
+ dirname = optarg;
break;
case 'F':
break;
case 'H': /* slapd uri */
- uri = strdup( optarg );
+ uri = optarg;
break;
case 'h': /* slapd host */
- host = strdup( optarg );
+ host = optarg;
break;
case 'I':
break;
case 'L': /* the number of outerloops per client */
- outerloops = strdup( optarg );
+ outerloops = optarg;
break;
case 'N':
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':
break;
case 't': /* the delay in seconds between each retry */
- delay = strdup( optarg );
+ delay = optarg;
break;
case 'w': /* the managers passwd */