From bbf9960b5f4c984fe6f2cfe1c24984816a21fbec Mon Sep 17 00:00:00 2001 From: William Brown Date: Apr 16 2019 03:59:00 +0000 Subject: Ticket 50302 - remove support for mozldap Bug Description: Mozldap has not been supported for some time in favour of the OpenLDAP libraries for protocol implementation. Remove the unused mozldap Fix Description: Remove the compat header and defined-out code, along with the ability to configure this as the ldapsdk. https://pagure.io/389-ds-base/issue/50302 Author: William Brown Review by: ??? --- diff --git a/Makefile.am b/Makefile.am index 5649cbc..acb9dbb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -519,7 +519,6 @@ dist_noinst_HEADERS = \ ldap/servers/slapd/http.h \ ldap/servers/slapd/intrinsics.h \ ldap/servers/slapd/log.h \ - ldap/servers/slapd/mozldap.h \ ldap/servers/slapd/openldapber.h \ ldap/servers/slapd/pblock_v3.h \ ldap/servers/slapd/poll_using_select.h \ diff --git a/configure.ac b/configure.ac index 5872ed8..3660e68 100644 --- a/configure.ac +++ b/configure.ac @@ -834,7 +834,6 @@ fi AC_SUBST(nss_libdir) m4_include(m4/openldap.m4) -m4_include(m4/mozldap.m4) m4_include(m4/db.m4) PKG_CHECK_MODULES([SASL], [libsasl2]) diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c index 263eb9c..3e3b16e 100644 --- a/ldap/servers/slapd/connection.c +++ b/ldap/servers/slapd/connection.c @@ -993,8 +993,6 @@ connection_wait_for_new_work(Slapi_PBlock *pb, PRIntervalTime interval) #ifdef USE_OPENLDAP #include "openldapber.h" -#else -#include "mozldap.h" #endif static ber_tag_t diff --git a/ldap/servers/slapd/ldaputil.c b/ldap/servers/slapd/ldaputil.c index 94928c7..1c722ad 100644 --- a/ldap/servers/slapd/ldaputil.c +++ b/ldap/servers/slapd/ldaputil.c @@ -241,13 +241,6 @@ slapi_urlparse_err2string(int err) case LDAP_URL_ERR_BADEXTS: s = "extensions not specified correctly"; break; -#else /* !USE_OPENLDAP */ - case LDAP_URL_ERR_NOTLDAP: - s = "missing ldap:// or ldaps:// or ldapi://"; - break; - case LDAP_URL_ERR_NODN: - s = "missing suffix"; - break; #endif } @@ -810,20 +803,7 @@ slapi_ldap_init_ext( ldapurl, rc, ldap_err2string(rc)); } } -#else /* !USE_OPENLDAP */ - if (ldapi_socket) { - /* ldapi in mozldap client is not yet supported */ - } else if (secure == SLAPI_LDAP_INIT_FLAG_SSL) { - ld = ldapssl_init(hostname, port, secure); - } else { /* regular ldap and/or starttls */ - /* - * Leverage the libprldap layer to take care of all the NSPR - * integration. - * Note that ldapssl_init() uses libprldap implicitly. - */ - ld = prldap_init(hostname, port, shared); - } -#endif /* !USE_OPENLDAP */ +#endif /* USE_OPENLDAP */ /* must explicitly set version to 3 */ ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &ldap_version3); diff --git a/ldap/servers/slapd/mozldap.h b/ldap/servers/slapd/mozldap.h deleted file mode 100644 index c5c7af2..0000000 --- a/ldap/servers/slapd/mozldap.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * mozldap does not have all the openldap "ber" functions, like ber_skip_element. - * So we need to directly parse the ber element, and see inside the ber struct. - * From lber-int.h - */ -typedef struct seqorset -{ - ber_len_t sos_clen; - ber_tag_t sos_tag; - char *sos_first; - char *sos_ptr; - struct seqorset *sos_next; -} Seqorset; - -#define SOS_STACK_SIZE 8 /* depth of the pre-allocated sos structure stack */ -#define MAX_TAG_SIZE (1 + sizeof(ber_int_t)) /* One byte for the length of the tag */ -#define MAX_LEN_SIZE (1 + sizeof(ber_int_t)) /* One byte for the length of the length */ -#define MAX_VALUE_PREFIX_SIZE (2 + sizeof(ber_int_t)) /* 1 byte for the tag and 1 for the len (msgid) */ -#define BER_ARRAY_QUANTITY 7 /* 0:Tag 1:Length 2:Value-prefix 3:Value 4:Value-suffix */ - -struct berelement -{ - ldap_x_iovec ber_struct[BER_ARRAY_QUANTITY]; /* See above */ - char ber_tag_contents[MAX_TAG_SIZE]; - char ber_len_contents[MAX_LEN_SIZE]; - char ber_pre_contents[MAX_VALUE_PREFIX_SIZE]; - char ber_suf_contents[MAX_LEN_SIZE + 1]; - char *ber_buf; /* update the value value when writing in case realloc is called */ - char *ber_ptr; - char *ber_end; - struct seqorset *ber_sos; - ber_len_t ber_tag_len_read; - ber_tag_t ber_tag; /* Remove me someday */ - ber_len_t ber_len; /* Remove me someday */ - int ber_usertag; - char ber_options; - char *ber_rwptr; - BERTranslateProc ber_encode_translate_proc; - BERTranslateProc ber_decode_translate_proc; - int ber_flags; -#define LBER_FLAG_NO_FREE_BUFFER 1 /* don't free ber_buf */ - unsigned int ber_buf_reallocs; /* realloc counter */ - int ber_sos_stack_posn; - Seqorset ber_sos_stack[SOS_STACK_SIZE]; -}; -typedef struct berelement MozElement; diff --git a/ldap/servers/slapd/sasl_io.c b/ldap/servers/slapd/sasl_io.c index b889c2c..331c745 100644 --- a/ldap/servers/slapd/sasl_io.c +++ b/ldap/servers/slapd/sasl_io.c @@ -16,13 +16,6 @@ #include "fe.h" #include #include -#ifndef USE_OPENLDAP -#include "mozldap.h" -#if LDAP_VENDOR_VERSION > 604 -/* garbage to cause build to fail */ -MOZLDAP is newer than expected, if the ber structure has not changed(see ldap / server / slapd / mozldap.h), please bump the version number(604->new version) -#endif -#endif /* * I/O Shim Layer for SASL Encryption diff --git a/m4/mozldap.m4 b/m4/mozldap.m4 deleted file mode 100644 index 76d3300..0000000 --- a/m4/mozldap.m4 +++ /dev/null @@ -1,167 +0,0 @@ -# BEGIN COPYRIGHT BLOCK -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# -# License: GPL (version 3 or any later version). -# See LICENSE for details. -# END COPYRIGHT BLOCK - -AC_CHECKING(for Mozilla LDAPSDK) - -# check for --with-ldapsdk -AC_MSG_CHECKING(for --with-ldapsdk) -AC_ARG_WITH(ldapsdk, AS_HELP_STRING([--with-ldapsdk@<:@=PATH@:>@],[Mozilla LDAP SDK directory]), -[ - if test "$withval" = yes - then - AC_MSG_RESULT(yes) - ldaplib="mozldap" - ldaplib_defs="" - elif test "$withval" = no - then - AC_MSG_RESULT(no) - elif test -e "$withval"/include/ldap.h -a -d "$withval"/lib - then - AC_MSG_RESULT([using $withval]) - LDAPSDKDIR=$withval - ldaplib="mozldap" - ldaplib_defs="" - ldapsdk_inc="-I$LDAPSDKDIR/include" - ldapsdk_lib="-L$LDAPSDKDIR/lib" - ldapsdk_libdir="$LDAPSDKDIR/lib" - ldapsdk_bindir="$LDAPSDKDIR/bin" - with_ldapsdk=yes - else - echo - AC_MSG_ERROR([$withval not found]) - fi - - if test "$with_ldapsdk" = yes -a "$with_openldap" = yes - then - AC_MSG_ERROR([Cannot use both LDAPSDK and OpenLDAP.]) - fi - if test "$with_ldapsdk" != yes -a "$with_openldap" != yes - then - AC_MSG_ERROR([Either LDAPSDK or OpenLDAP must be used.]) - fi -], -[ - if test "$with_openldap" = yes - then - AC_MSG_RESULT(no) - else - AC_MSG_RESULT(yes) - with_ldapsdk=yes - fi -]) - -# check for --with-ldapsdk-inc -AC_MSG_CHECKING(for --with-ldapsdk-inc) -AC_ARG_WITH(ldapsdk-inc, AS_HELP_STRING([--with-ldapsdk-inc=PATH],[Mozilla LDAP SDK include directory]), -[ - if test -e "$withval"/ldap.h - then - AC_MSG_RESULT([using $withval]) - ldapsdk_inc="-I$withval" - with_ldapsdk=yes - else - echo - AC_MSG_ERROR([$withval not found]) - fi -], -AC_MSG_RESULT(no)) - -# check for --with-ldapsdk-lib -AC_MSG_CHECKING(for --with-ldapsdk-lib) -AC_ARG_WITH(ldapsdk-lib, AS_HELP_STRING([--with-ldapsdk-lib=PATH],[Mozilla LDAP SDK library directory]), -[ - if test -d "$withval" - then - AC_MSG_RESULT([using $withval]) - ldapsdk_lib="-L$withval" - ldapsdk_libdir="$withval" - with_ldapsdk=yes - else - echo - AC_MSG_ERROR([$withval not found]) - fi -], -AC_MSG_RESULT(no)) - -# check for --with-ldapsdk-bin -AC_MSG_CHECKING(for --with-ldapsdk-bin) -AC_ARG_WITH(ldapsdk-bin, AS_HELP_STRING([--with-ldapsdk-bin=PATH],[Mozilla LDAP SDK binary directory]), -[ - if test -d "$withval" - then - AC_MSG_RESULT([using $withval]) - ldapsdk_bindir="$withval" - with_ldapsdk=yes - else - echo - AC_MSG_ERROR([$withval not found]) - fi -], -AC_MSG_RESULT(no)) - -# if LDAPSDK is not found yet, try pkg-config - -# last resort -if test "$with_ldapsdk" = yes ; then - if test -z "$ldapsdk_inc" -o -z "$ldapsdk_lib" -o -z "$ldapsdk_libdir" -o -z "$ldapsdk_bindir"; then - AC_MSG_CHECKING(for mozldap with pkg-config) - if test -n "$PKG_CONFIG"; then - if $PKG_CONFIG --exists mozldap6; then - mozldappkg=mozldap6 - elif $PKG_CONFIG --exists mozldap; then - mozldappkg=mozldap - else - AC_MSG_ERROR([LDAPSDK not found, specify with --with-ldapsdk[-inc|-lib|-bin].]) - fi - ldapsdk_inc=`$PKG_CONFIG --cflags-only-I $mozldappkg` - ldapsdk_lib=`$PKG_CONFIG --libs-only-L $mozldappkg` - ldapsdk_libdir=`$PKG_CONFIG --libs-only-L $mozldappkg | sed -e s/-L// | sed -e s/\ .*$//` - ldapsdk_bindir=`$PKG_CONFIG --variable=bindir $mozldappkg` - AC_MSG_RESULT([using system $mozldappkg]) - fi - fi -fi - -if test "$with_ldapsdk" = yes ; then - if test -z "$ldapsdk_inc" -o -z "$ldapsdk_lib"; then - AC_MSG_ERROR([LDAPSDK not found, specify with --with-ldapsdk[-inc|-lib|-bin].]) - fi -dnl default path for the ldap c sdk tools (see [210947] for more details) - if test -z "$ldapsdk_bindir" ; then - if [ -d $libdir/mozldap6 ] ; then - ldapsdk_bindir=$libdir/mozldap6 - else - ldapsdk_bindir=$libdir/mozldap - fi - fi - - dnl make sure the ldap sdk version is 6 or greater - we do not support - dnl the old 5.x or prior versions - the ldap server code expects the new - dnl ber types and other code used with version 6 - save_cppflags="$CPPFLAGS" - CPPFLAGS="$ldapsdk_inc $NSS_CFLAGS $NSPR_CFLAGS" - AC_CHECK_HEADER([ldap.h], [isversion6=1], [isversion6=], - [#include -#if LDAP_VENDOR_VERSION < 600 -#error The LDAP C SDK version is not supported -#endif - ]) - CPPFLAGS="$save_cppflags" - - if test -z "$isversion6" ; then - AC_MSG_ERROR([The LDAPSDK version in $ldapsdk_inc/ldap-standard.h is not supported]) - fi - AC_DEFINE([USE_MOZLDAP], [1], [If defined, using MozLDAP for LDAP SDK]) - AC_DEFINE([HAVE_LDAP_URL_PARSE_NO_DEFAULTS], [1], [have the function ldap_url_parse_no_defaults]) - # where to find ldapsearch, et. al. - ldaptool_bindir=$ldapsdk_bindir - # default options to pass to the tools - ldaptool_opts= - # get plain output from ldapsearch - no version - plainldif_opts=-1 -fi