Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nadezhda Ivanova
OpenLDAP
Commits
a97eed06
Commit
a97eed06
authored
Apr 15, 2020
by
Quanah Gibson-Mount
Browse files
ITS#6937 - Remove unused proctitle bits
parent
a5e17673
Changes
26
Hide whitespace changes
Inline
Side-by-side
clients/tools/common.c
View file @
a97eed06
...
...
@@ -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
);
...
...
clients/tools/ldapcompare.c
View file @
a97eed06
...
...
@@ -135,7 +135,7 @@ handle_private_option( int i )
optarg
++
;
}
control
=
ber_strdup
(
optarg
)
;
control
=
optarg
;
if
(
(
cvalue
=
strchr
(
control
,
'='
))
!=
NULL
)
{
*
cvalue
++
=
'\0'
;
}
...
...
clients/tools/ldapdelete.c
View file @
a97eed06
...
...
@@ -111,7 +111,7 @@ handle_private_option( int i )
optarg++;
}
control =
strdup(
optarg
)
;
control = optarg;
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
...
...
clients/tools/ldapmodify.c
View file @
a97eed06
...
...
@@ -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:
...
...
clients/tools/ldapmodrdn.c
View file @
a97eed06
...
...
@@ -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
;
...
...
clients/tools/ldappasswd.c
View file @
a97eed06
...
...
@@ -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
++
)
{
...
...
clients/tools/ldapsearch.c
View file @
a97eed06
...
...
@@ -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
);
}
...
...
clients/tools/ldapvc.c
View file @
a97eed06
...
...
@@ -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 */
...
...
clients/tools/ldapwhoami.c
View file @
a97eed06
...
...
@@ -89,7 +89,7 @@ handle_private_option( int i )
optarg++;
}
control =
strdup(
optarg
)
;
control = optarg;
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
...
...
configure.in
View file @
a97eed06
...
...
@@ -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])
...
...
include/ac/setproctitle.h
deleted
100644 → 0
View file @
a5e17673
/* 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 */
include/portable.hin
View file @
a97eed06
...
...
@@ -493,9 +493,6 @@
/* 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
...
...
libraries/libldap/test.c
View file @
a97eed06
...
...
@@ -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
;
...
...
libraries/liblutil/setproctitle.c
deleted
100644 → 0
View file @
a5e17673
/* $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 */
servers/slapd/main.c
View file @
a97eed06
...
...
@@ -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
);
...
...
servers/slapd/slapcommon.c