Skip to content
Commits on Source (68)
......@@ -16,11 +16,13 @@ PYTHON := python3
BUILDNUM := $(shell perl $(srcdir)/buildnum.pl)
NQBUILDNUM := $(subst \,,$(subst $(QUOTE),,$(BUILDNUM)))
DEBUG_DEFINES = @debug_defs@
GCCSEC_DEFINES = @gccsec_defs@
ASAN_DEFINES = @asan_defs@
MSAN_DEFINES = @msan_defs@
TSAN_DEFINES = @tsan_defs@
UBSAN_DEFINES = @ubsan_defs@
DEBUG_CFLAGS = @debug_cflags@
DEBUG_CXXFLAGS = @debug_cxxflags@
GCCSEC_CFLAGS = @gccsec_cflags@
ASAN_CFLAGS = @asan_cflags@
MSAN_CFLAGS = @msan_cflags@
TSAN_CFLAGS = @tsan_cflags@
UBSAN_CFLAGS = @ubsan_cflags@
SYSTEMD_DEFINES = @systemd_defs@
......@@ -133,7 +135,9 @@ PATH_DEFINES = -DLOCALSTATEDIR="\"$(localstatedir)\"" -DSYSCONFDIR="\"$(sysconfd
# Now that we have all our defines in place, setup the CPPFLAGS
# These flags are the "must have" for all components
AM_CPPFLAGS = $(DEBUG_DEFINES) $(GCCSEC_DEFINES) $(ASAN_DEFINES) $(MSAN_DEFINES) $(TSAN_DEFINES) $(UBSAN_DEFINES) $(PROFILING_DEFINES) $(RUST_DEFINES)
AM_CPPFLAGS = $(DEBUG_DEFINES) $(PROFILING_DEFINES) $(RUST_DEFINES)
AM_CFLAGS = $(DEBUG_CFLAGS) $(GCCSEC_CFLAGS) $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS)
AM_CXXFLAGS = $(DEBUG_CXXFLAGS) $(GCCSEC_CFLAGS) $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS)
# Flags for Directory Server
# WARNING: This needs a clean up, because slap.h is a horrible mess and is publically exposed!
DSPLUGIN_CPPFLAGS = $(DS_DEFINES) $(DS_INCLUDES) $(PATH_DEFINES) $(SYSTEMD_DEFINES) $(NUNCSTANS_INCLUDES) @openldap_inc@ @ldapsdk_inc@ @nss_inc@ $(NSPR_INCLUDES) @systemd_inc@
......@@ -190,7 +194,7 @@ AM_LDFLAGS = -lpthread
else
#AM_LDFLAGS = -Wl,-z,defs
# Provide the tcmalloc links if needed
AM_LDFLAGS = $(RUST_LDFLAGS) $(ASAN_DEFINES) $(MSAN_DEFINES) $(TSAN_DEFINES) $(UBSAN_DEFINES) $(PROFILING_LINKS) $(TCMALLOC_LINK) $(CLANG_LDFLAGS)
AM_LDFLAGS = $(RUST_LDFLAGS) $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS) $(PROFILING_LINKS) $(TCMALLOC_LINK) $(CLANG_LDFLAGS)
endif #end hpux
# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info
......@@ -287,8 +291,10 @@ CLEANFILES = dberrstrs.h ns-slapd.properties \
clean-local:
-rm -rf dist
-rm -rf $(abs_top_builddir)/html
-rm -rf $(abs_top_builddir)/man
-rm -rf $(abs_top_builddir)/man/man3
if RUST_ENABLE
CARGO_TARGET_DIR=$(abs_top_builddir)/rs cargo clean --manifest-path=$(srcdir)/src/libsds/Cargo.toml
endif
dberrstrs.h: Makefile
perl $(srcdir)/ldap/servers/slapd/mkDBErrStrs.pl -i @db_incdir@ -o .
......@@ -320,12 +326,7 @@ updatedir = $(datadir)@updatedir@
pkgconfigdir = $(libdir)/pkgconfig
serverincdir = $(includedir)/@serverincdir@
gdbautoloaddir = $(prefixdir)/share/gdb/auto-load$(sbindir)
cockpitdir = $(datadir)@cockpitdir@
cockpitstaticdir = $(datadir)@cockpitstaticdir@
cockpitimagesdir = $(datadir)@cockpitimagesdir@
cockpitstaticimagesdir = $(datadir)@cockpitstaticimagesdir@
cockpitjsdir = $(datadir)@cockpitjsdir@/
cockpitcssdir = $(datadir)@cockpitcssdir@
cockpitdir = $(prefixdir)/share/cockpit@cockpitdir@
# This has to be hardcoded to /lib - $libdir changes between lib/lib64, but
# sysctl.d is always in /lib.
......@@ -651,7 +652,6 @@ dist_noinst_DATA = \
$(srcdir)/wrappers/*.in \
$(srcdir)/wrappers/systemd.template.sysconfig \
$(srcdir)/dirsrvtests \
$(srcdir)/src/cockpit/* \
$(srcdir)/src/lib389/setup.py \
$(srcdir)/src/lib389
......@@ -753,12 +753,17 @@ systemschema_DATA = $(srcdir)/ldap/schema/00core.ldif \
schema_DATA = $(srcdir)/ldap/schema/99user.ldif
sbin_SCRIPTS = ldap/admin/src/scripts/ds_selinux_enabled \
libexec_SCRIPTS = ldap/admin/src/scripts/ds_selinux_enabled \
ldap/admin/src/scripts/ds_selinux_port_query \
wrappers/ds_systemd_ask_password_acl
install-data-hook:
if [ "$(srcdir)" != "." ]; then cp -r $(srcdir)/src/cockpit src ; fi
mkdir -p $(DESTDIR)$(cockpitdir)
rsync -rupE src/cockpit/389-console/ $(DESTDIR)$(cockpitdir)
if ENABLE_PERL
sbin_SCRIPTS += ldap/admin/src/scripts/setup-ds.pl \
sbin_SCRIPTS = ldap/admin/src/scripts/setup-ds.pl \
ldap/admin/src/scripts/migrate-ds.pl \
ldap/admin/src/scripts/remove-ds.pl \
ldap/admin/src/scripts/start-dirsrv \
......@@ -912,52 +917,6 @@ inf_DATA = ldap/admin/src/slapd.inf \
mib_DATA = ldap/servers/snmp/redhat-directory.mib
cockpit_DATA = src/cockpit/389-console/manifest.json \
src/cockpit/389-console/backend.html \
src/cockpit/389-console/index.html \
src/cockpit/389-console/monitor.html \
src/cockpit/389-console/plugins.html \
src/cockpit/389-console/README.md \
src/cockpit/389-console/replication.html \
src/cockpit/389-console/schema.html \
src/cockpit/389-console/security.html \
src/cockpit/389-console/servers.html
cockpitstatic_DATA = src/cockpit/389-console/static/32px.png \
src/cockpit/389-console/static/40px.png \
src/cockpit/389-console/static/jquery.dataTables.min.css \
src/cockpit/389-console/static/jquery.dataTables.min.js \
src/cockpit/389-console/static/jquery.dataTables.select.min.js \
src/cockpit/389-console/static/jquery.timepicker.min.css \
src/cockpit/389-console/static/jquery.timepicker.min.js \
src/cockpit/389-console/static/jstree.min.js \
src/cockpit/389-console/static/page.min.css \
src/cockpit/389-console/static/style.min.css \
src/cockpit/389-console/static/throbber.gif
cockpitstaticimages_DATA = src/cockpit/389-console/static/images/ui-icons_444444_256x240.png \
src/cockpit/389-console/static/images/ui-icons_777620_256x240.png \
src/cockpit/389-console/static/images/ui-icons_cc0000_256x240.png \
src/cockpit/389-console/static/images/ui-icons_555555_256x240.png \
src/cockpit/389-console/static/images/ui-icons_777777_256x240.png \
src/cockpit/389-console/static/images/ui-icons_ffffff_256x240.png
cockpitimages_DATA = src/cockpit/389-console/images/sort_asc.png \
src/cockpit/389-console/images/sort_both.png
cockpitjs_DATA = src/cockpit/389-console/js/backend.js \
src/cockpit/389-console/js/ds.js \
src/cockpit/389-console/js/monitor.js \
src/cockpit/389-console/js/plugins.js \
src/cockpit/389-console/js/replication.js \
src/cockpit/389-console/js/schema.js \
src/cockpit/389-console/js/security.js \
src/cockpit/389-console/js/servers.js \
src/cockpit/389-console/js/tabbed.js
cockpitcss_DATA = src/cockpit/389-console/css/ds.css \
src/cockpit/389-console/css/tabs.css
pkgconfig_DATA = src/pkgconfig/dirsrv.pc \
src/pkgconfig/libsds.pc \
src/pkgconfig/nunc-stans.pc \
......@@ -983,7 +942,6 @@ dist_man_MANS = man/man1/dbscan.1 \
man/man1/dbgen.pl.1 \
man/man1/ds-logpipe.py.1 \
man/man1/ds-replcheck.1 \
man/man1/ds-cockpit-setup.1 \
man/man1/infadd.1 \
man/man1/ldap-agent.1 \
man/man1/ldclt.1 \
......@@ -2199,37 +2157,37 @@ test_libsds_SOURCES = src/libsds/test/test_sds.c \
src/libsds/test/test_sds_ht.c \
src/libsds/test/test_fixtures.c
test_libsds_LDFLAGS = $(ASAN_DEFINES) $(MSAN_DEFINES) $(TSAN_DEFINES) $(UBSAN_DEFINES) $(PROFILING_LINKS) $(CMOCKA_LINKS)
test_libsds_LDFLAGS = $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS) $(PROFILING_LINKS) $(CMOCKA_LINKS)
test_libsds_LDADD = libsds.la $(NSPR_LINK)
test_libsds_CPPFLAGS = $(AM_CPPFLAGS) $(CMOCKA_INCLUDES) $(SDS_CPPFLAGS)
benchmark_sds_SOURCES = src/libsds/test/benchmark.c \
$(libavl_a_SOURCES)
benchmark_sds_LDFLAGS = $(ASAN_DEFINES) $(MSAN_DEFINES) $(TSAN_DEFINES) $(UBSAN_DEFINES) $(PROFILING_LINKS) $(CMOCKA_LINKS)
benchmark_sds_LDFLAGS = $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS) $(PROFILING_LINKS) $(CMOCKA_LINKS)
benchmark_sds_LDADD = libsds.la $(NSPR_LINK)
benchmark_sds_CPPFLAGS = $(AM_CPPFLAGS) $(CMOCKA_INCLUDES) $(SDS_CPPFLAGS) $(DS_INCLUDES)
benchmark_par_sds_SOURCES = src/libsds/test/benchmark_parwrap.c \
src/libsds/test/benchmark_par.c \
$(libavl_a_SOURCES)
benchmark_par_sds_LDFLAGS = $(ASAN_DEFINES) $(MSAN_DEFINES) $(TSAN_DEFINES) $(UBSAN_DEFINES) $(PROFILING_LINKS) $(CMOCKA_LINKS)
benchmark_par_sds_LDFLAGS = $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS) $(PROFILING_LINKS) $(CMOCKA_LINKS)
benchmark_par_sds_LDADD = libsds.la $(NSPR_LINK)
benchmark_par_sds_CPPFLAGS = $(AM_CPPFLAGS) $(CMOCKA_INCLUDES) $(SDS_CPPFLAGS) $(DS_INCLUDES)
test_nuncstans_SOURCES = src/nunc-stans/test/test_nuncstans.c
test_nuncstans_CPPFLAGS = $(AM_CPPFLAGS) $(CMOCKA_INCLUDES) $(NUNCSTANS_CPPFLAGS)
test_nuncstans_LDADD = libnunc-stans.la libsds.la $(NSPR_LINK)
test_nuncstans_LDFLAGS = $(ASAN_DEFINES) $(MSAN_DEFINES) $(TSAN_DEFINES) $(UBSAN_DEFINES) $(PROFILING_LINKS) $(CMOCKA_LINKS) $(EVENT_LINK)
test_nuncstans_LDFLAGS = $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS) $(PROFILING_LINKS) $(CMOCKA_LINKS) $(EVENT_LINK)
test_nuncstans_stress_large_SOURCES = src/nunc-stans/test/test_nuncstans_stress_large.c src/nunc-stans/test/test_nuncstans_stress_core.c
test_nuncstans_stress_large_CPPFLAGS = $(AM_CPPFLAGS) $(CMOCKA_INCLUDES) $(NUNCSTANS_CPPFLAGS)
test_nuncstans_stress_large_LDADD = libnunc-stans.la libsds.la $(NSPR_LINK)
test_nuncstans_stress_large_LDFLAGS = $(ASAN_DEFINES) $(MSAN_DEFINES) $(TSAN_DEFINES) $(UBSAN_DEFINES) $(PROFILING_LINKS) $(CMOCKA_LINKS) $(EVENT_LINK)
test_nuncstans_stress_large_LDFLAGS = $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS) $(PROFILING_LINKS) $(CMOCKA_LINKS) $(EVENT_LINK)
test_nuncstans_stress_small_SOURCES = src/nunc-stans/test/test_nuncstans_stress_small.c src/nunc-stans/test/test_nuncstans_stress_core.c
test_nuncstans_stress_small_CPPFLAGS = $(AM_CPPFLAGS) $(CMOCKA_INCLUDES) $(NUNCSTANS_CPPFLAGS)
test_nuncstans_stress_small_LDADD = libnunc-stans.la libsds.la $(NSPR_LINK)
test_nuncstans_stress_small_LDFLAGS = $(ASAN_DEFINES) $(MSAN_DEFINES) $(TSAN_DEFINES) $(UBSAN_DEFINES) $(PROFILING_LINKS) $(CMOCKA_LINKS) $(EVENT_LINK)
test_nuncstans_stress_small_LDFLAGS = $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS) $(PROFILING_LINKS) $(CMOCKA_LINKS) $(EVENT_LINK)
endif
......@@ -2247,6 +2205,7 @@ fixupcmd = sed \
-e 's,@bindir\@,$(bindir),g' \
-e 's,@sbindir\@,$(sbindir),g' \
-e 's,@libdir\@,$(libdir),g' \
-e 's,@libexecdir\@,$(libexecdir),g' \
-e 's,@nspr_libdir\@,$(nspr_libdir),g' \
-e 's,@nss_libdir\@,$(nss_libdir),g' \
-e 's,@ldapsdk_libdir\@,$(ldapsdk_libdir),g' \
......
......@@ -10,7 +10,7 @@ vendor="389 Project"
# PACKAGE_VERSION is constructed from these
VERSION_MAJOR=1
VERSION_MINOR=4
VERSION_MAINT=0.9
VERSION_MAINT=0.11
# NOTE: VERSION_PREREL is automatically set for builds made out of a git tree
VERSION_PREREL=
VERSION_DATE=$(date -u +%Y%m%d)
......
......@@ -27,7 +27,9 @@ AC_CANONICAL_HOST
AC_CONFIG_MACRO_DIRS([m4])
# Checks for programs.
: ${CXXFLAGS=""}
AC_PROG_CXX
: ${CFLAGS=""}
AC_PROG_CC
AM_PROG_CC_C_O
AM_PROG_AS
......@@ -102,7 +104,9 @@ AC_MSG_CHECKING(for --enable-debug)
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [Enable debug features (default: no)]),
[
AC_MSG_RESULT(yes)
debug_defs="-g3 -DDEBUG -DMCC_DEBUG -O0"
debug_defs="-DDEBUG -DMCC_DEBUG"
debug_cflags="-g3 -O0"
debug_cxxflags="-g3 -O0"
debug_rust_defs="-C debuginfo=2"
cargo_defs=""
rust_target_dir="debug"
......@@ -111,11 +115,16 @@ AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [Enable debug features (de
[
AC_MSG_RESULT(no)
debug_defs=""
# set the default safe CFLAGS that would be set by AC_PROG_CC otherwise
debug_cflags="-g -O2"
debug_cxxflags="-g -O2"
debug_rust_defs="-C debuginfo=2"
cargo_defs="--release"
rust_target_dir="release"
])
AC_SUBST([debug_defs])
AC_SUBST([debug_cflags])
AC_SUBST([debug_cxxflags])
AC_SUBST([debug_rust_defs])
AC_SUBST([cargo_defs])
AC_SUBST([rust_target_dir])
......@@ -125,15 +134,15 @@ AC_MSG_CHECKING(for --enable-asan)
AC_ARG_ENABLE(asan, AS_HELP_STRING([--enable-asan], [Enable gcc/clang address sanitizer options (default: no)]),
[
AC_MSG_RESULT(yes)
asan_defs="-fsanitize=address -fno-omit-frame-pointer"
asan_cflags="-fsanitize=address -fno-omit-frame-pointer"
asan_rust_defs="-Z sanitizer=address"
],
[
AC_MSG_RESULT(no)
asan_defs=""
asan_cflags=""
asan_rust_defs=""
])
AC_SUBST([asan_defs])
AC_SUBST([asan_cflags])
AC_SUBST([asan_rust_defs])
AM_CONDITIONAL(enable_asan,test "$enable_asan" = "yes")
......@@ -141,15 +150,15 @@ AC_MSG_CHECKING(for --enable-msan)
AC_ARG_ENABLE(msan, AS_HELP_STRING([--enable-msan], [Enable gcc/clang memory sanitizer options (default: no)]),
[
AC_MSG_RESULT(yes)
msan_defs="-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer"
msan_cflags="-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer"
msan_rust_defs="-Z sanitizer=memory"
],
[
AC_MSG_RESULT(no)
msan_defs=""
msan_cflags=""
msan_rust_defs=""
])
AC_SUBST([msan_defs])
AC_SUBST([msan_cflags])
AC_SUBST([msan_rust_defs])
AM_CONDITIONAL(enable_msan,test "$enable_msan" = "yes")
......@@ -157,15 +166,15 @@ AC_MSG_CHECKING(for --enable-tsan)
AC_ARG_ENABLE(tsan, AS_HELP_STRING([--enable-tsan], [Enable gcc/clang thread sanitizer options (default: no)]),
[
AC_MSG_RESULT(yes)
tsan_defs="-fsanitize=thread -fno-omit-frame-pointer"
tsan_cflags="-fsanitize=thread -fno-omit-frame-pointer"
tsan_rust_defs="-Z sanitizer=thread"
],
[
AC_MSG_RESULT(no)
tsan_defs=""
tsan_cflags=""
tsan_rust_defs=""
])
AC_SUBST([tsan_defs])
AC_SUBST([tsan_cflags])
AC_SUBST([tsan_rust_defs])
AM_CONDITIONAL(enable_tsan,test "$enable_tsan" = "yes")
......@@ -173,15 +182,15 @@ AC_MSG_CHECKING(for --enable-ubsan)
AC_ARG_ENABLE(ubsan, AS_HELP_STRING([--enable-tsan], [Enable gcc/clang undefined behaviour sanitizer options (default: no)]),
[
AC_MSG_RESULT(yes)
ubsan_defs="-fsanitize=undefined -fno-omit-frame-pointer"
ubsan_cflags="-fsanitize=undefined -fno-omit-frame-pointer"
ubsan_rust_defs=""
],
[
AC_MSG_RESULT(no)
ubsan_defs=""
ubsan_cflags=""
ubsan_rust_defs=""
])
AC_SUBST([ubsan_defs])
AC_SUBST([ubsan_cflags])
AC_SUBST([ubsan_rust_defs])
AM_CONDITIONAL(enable_ubsan,test "$enable_ubsan" = "yes")
......@@ -218,19 +227,19 @@ AC_ARG_ENABLE(gcc-security, AS_HELP_STRING([--enable-gcc-security], [Enable gcc
[
AC_MSG_RESULT(yes)
AM_COND_IF([RPM_HARDEND_CC],
[ gccsec_defs="-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -Werror=format-security -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 " ],
[ gccsec_defs="-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -Werror=format-security" ]
[ gccsec_cflags="-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -Werror=format-security -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 " ],
[ gccsec_cflags="-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -Werror=format-security" ]
)
],
[
# Without this, -fPIC doesn't work on generic fedora builds, --disable-gcc-sec.
AC_MSG_RESULT(no)
AM_COND_IF([RPM_HARDEND_CC],
[ gccsec_defs="-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1" ],
[ gccsec_defs="" ]
[ gccsec_cflags="-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1" ],
[ gccsec_cflags="" ]
)
])
AC_SUBST([gccsec_defs])
AC_SUBST([gccsec_cflags])
# Pull in profiling.
AC_MSG_CHECKING(for --enable-profiling)
......@@ -399,6 +408,7 @@ fi
m4_include(m4/fhs.m4)
localrundir='/run'
cockpitdir=/389-console
# installation paths - by default, we store everything
# under the prefix. The with-fhs option will use /usr,
......@@ -436,13 +446,6 @@ if test "$with_fhs_opt" = "yes"; then
perldir=/perl
# relative to libdir
pythondir=/python
# relative to datadir
cockpitdir=/389-console
cockpitstaticdir=/389-console/static
cockpitimagesdir=/389-console/images
cockpitstaticimagesdir=/389-console/static/images
cockpitjsdir=/389-console/js
cockpitcssdir=/389-console/css
else
if test "$with_fhs" = "yes"; then
ac_default_prefix=/usr
......@@ -479,13 +482,6 @@ else
perldir=/$PACKAGE_NAME/perl
# relative to libdir
pythondir=/$PACKAGE_NAME/python
# relative to datadir
cockpitdir=/$PACKAGE_NAME/389-console
cockpitstaticdir=/$PACKAGE_NAME/389-console/static
cockpitimagesdir=/$PACKAGE_NAME/389-console/images
cockpitstaticimagesdir=/$PACKAGE_NAME/389-console/static/images
cockpitjsdir=/$PACKAGE_NAME/389-console/js
cockpitcssdir=/$PACKAGE_NAME/389-console/css
fi
# if mandir is the default value, override it
......@@ -549,12 +545,12 @@ if test -n "$with_pythonexec"; then
if test "$with_pythonexec" = yes ; then
AC_MSG_ERROR([You must specify --with-pythonexec=/full/path/to/python])
elif test "$with_pythonexec" = no ; then
with_pythonexec=/usr/bin/python2
with_pythonexec=/usr/bin/python3
else
AC_MSG_RESULT([$with_pythonexec])
fi
else
with_pythonexec=/usr/bin/python2
with_pythonexec=/usr/bin/python3
fi
AC_SUBST(prefixdir)
......@@ -573,14 +569,9 @@ AC_SUBST(infdir)
AC_SUBST(mibdir)
AC_SUBST(mandir)
AC_SUBST(updatedir)
AC_SUBST(cockpitdir)
AC_SUBST(cockpitstaticdir)
AC_SUBST(cockpitimagesdir)
AC_SUBST(cockpitstaticimagesdir)
AC_SUBST(cockpitjsdir)
AC_SUBST(cockpitcssdir)
AC_SUBST(defaultuser)
AC_SUBST(defaultgroup)
AC_SUBST(cockpitdir)
# check for --with-instconfigdir
AC_MSG_CHECKING(for --with-instconfigdir)
......@@ -639,7 +630,7 @@ fi
if test -n "$with_pythonexec"; then
pythonexec="$with_pythonexec"
else
pythonexec='/usr/bin/env python2'
pythonexec='/usr/bin/python3'
fi
# Default to no atomic queue operations.
......
389-ds-base (1.4.0.9-1) UNRELEASED; urgency=medium
389-ds-base (1.4.0.11-1) UNRELEASED; urgency=medium
* New upstream release.
* control: Update maintainer address.
......@@ -8,6 +8,7 @@
* control: Drop 389-ds metapackage, the other 389-ds-* packages are
EOL'd upsream and will be removed soon.
* control: svrcore got merged here, drop it from build-depends.
* ftbs_lsoftotkn3.diff: Dropped, obsolete.
-- Timo Aaltonen <tjaalton@debian.org> Sat, 02 Jun 2018 09:34:05 +0300
......
Description: Fix autoconf macro to detect svrcore properly
configure bails out with a linking error against libsoftokn, which is according
#473275 the correct behaviour. The patch modifies the m4 file to do not link
against this lib.
Author: Tobias Frost <tobi@coldtobi.de>
Forwarded: no
Last-Update: 2014-04-25
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/m4/svrcore.m4
+++ b/m4/svrcore.m4
@@ -84,7 +84,7 @@ fi
if test -z "$svrcore_inc" -o -z "$svrcore_lib"; then
dnl just see if SVRCORE is already a system library
AC_CHECK_LIB([svrcore], [SVRCORE_GetRegisteredPinObj], [havesvrcore=1],
- [], [$nss_inc $nspr_inc $nss_lib -lnss3 -lsoftokn3 $nspr_lib -lplds4 -lplc4 -lnspr4])
+ [], [$nss_inc $nspr_inc $nss_lib -lnss3 $nspr_lib -lplds4 -lplc4 -lnspr4])
if test -n "$havesvrcore" ; then
dnl just see if SVRCORE is already a system header file
save_cppflags="$CPPFLAGS"
use-bash-instead-of-sh.diff
rename-online-scripts.diff
ftbs_lsoftotkn3.diff
fix-obsolete-target.diff
fix-saslpath.diff
fix-systemctl-path.diff
......
......@@ -14,7 +14,7 @@ from lib389.topologies import topology_st
from lib389.plugins import ClassOfServicePlugin
from lib389.cos import CosIndirectDefinitions, CosTemplates, CosTemplate
from lib389.idm.user import UserAccounts, TEST_USER_PROPERTIES
from lib389.idm.organisationalunit import OrganisationalUnits
from lib389.idm.organizationalunit import OrganizationalUnits
from lib389._constants import DEFAULT_SUFFIX
......@@ -105,7 +105,7 @@ def test_indirect_template_scale(topology_st):
],
})
ous = OrganisationalUnits(topology_st.standalone, DEFAULT_SUFFIX)
ous = OrganizationalUnits(topology_st.standalone, DEFAULT_SUFFIX)
ou_temp = ous.create(properties={'ou': 'templates'})
cos_temps = OUCosTemplates(topology_st.standalone, ou_temp.dn)
......
......@@ -13,7 +13,7 @@ from lib389.utils import *
from lib389.schema import Schema
from lib389.idm.domain import Domain
from lib389.idm.user import UserAccount, UserAccounts, TEST_USER_PROPERTIES
from lib389.idm.organisationalrole import OrganisationalRole, OrganisationalRoles
from lib389.idm.organizationalrole import OrganizationalRole, OrganizationalRoles
from lib389.topologies import topology_m2
from lib389._constants import SUFFIX, DN_SCHEMA, DN_DM, DEFAULT_SUFFIX, PASSWORD
......@@ -156,7 +156,7 @@ def _moddn_aci_deny_tree(topology_m2, mod_type=None,
ACI_BODY = ACI_TARGET_TO + ACI_TARGET_FROM + ACI_ALLOW + ACI_SUBJECT
# topology_m2.ms["master1"].modify_s(SUFFIX, mod)
topology_m2.ms["master1"].log.info("Add a DENY aci under %s " % PROD_EXCEPT_DN)
prod_except = OrganisationalRole(topology_m2.ms["master1"], PROD_EXCEPT_DN)
prod_except = OrganizationalRole(topology_m2.ms["master1"], PROD_EXCEPT_DN)
prod_except.set('aci', ACI_BODY, mod_type)
......@@ -226,7 +226,7 @@ def moddn_setup(topology_m2):
"""
m1 = topology_m2.ms["master1"]
o_roles = OrganisationalRoles(m1, SUFFIX)
o_roles = OrganizationalRoles(m1, SUFFIX)
m1.log.info("\n\n######## INITIALIZATION ########\n")
......@@ -250,7 +250,7 @@ def moddn_setup(topology_m2):
# DIT for production/except
m1.log.info("Add {}".format(PROD_EXCEPT_DN))
o_roles_prod = OrganisationalRoles(m1, PRODUCTION_DN)
o_roles_prod = OrganizationalRoles(m1, PRODUCTION_DN)
o_roles_prod.create(properties={'cn': EXCEPT_CN, 'description': "production except DIT"})
# enable acl error logging
......@@ -445,7 +445,7 @@ def test_moddn_staging_prod_9(topology_m2, moddn_setup):
old_dn = "%s,%s" % (old_rdn, STAGING_DN)
new_rdn = old_rdn
new_superior = PRODUCTION_DN
prod = OrganisationalRole(topology_m2.ms["master1"], PRODUCTION_DN)
prod = OrganizationalRole(topology_m2.ms["master1"], PRODUCTION_DN)
#
# Try to rename without the appropriate ACI => INSUFFICIENT_ACCESS
......
# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---
#
import pytest
from lib389.tasks import *
from lib389.utils import *
from lib389.topologies import topology_st
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
CONTAINER_1_OU = 'test_ou_1'
CONTAINER_2_OU = 'test_ou_2'
CONTAINER_1 = f'ou={CONTAINER_1_OU},dc=example,dc=com'
CONTAINER_2 = f'ou={CONTAINER_2_OU},dc=example,dc=com'
USER_CN = 'test_user'
USER_PWD = 'Secret123'
USER = f'cn={USER_CN},{CONTAINER_1}'
@pytest.fixture(scope="module")
def env_setup(topology_st):
"""Adds two containers, one user and two ACI rules"""
log.info("Add a container: %s" % CONTAINER_1)
topology_st.standalone.add_s(Entry((CONTAINER_1,
{'objectclass': 'top',
'objectclass': 'organizationalunit',
'ou': CONTAINER_1_OU,
})))
log.info("Add a container: %s" % CONTAINER_2)
topology_st.standalone.add_s(Entry((CONTAINER_2,
{'objectclass': 'top',
'objectclass': 'organizationalunit',
'ou': CONTAINER_2_OU,
})))
log.info("Add a user: %s" % USER)
topology_st.standalone.add_s(Entry((USER,
{'objectclass': 'top person'.split(),
'cn': USER_CN,
'sn': USER_CN,
'userpassword': USER_PWD
})))
ACI_TARGET = '(targetattr="*")'
ACI_ALLOW = '(version 3.0; acl "All rights for %s"; allow (all) ' % USER
ACI_SUBJECT = 'userdn="ldap:///%s";)' % USER
ACI_BODY = ACI_TARGET + ACI_ALLOW + ACI_SUBJECT
mod = [(ldap.MOD_ADD, 'aci', ensure_bytes(ACI_BODY))]
log.info("Add an ACI 'allow (all)' by %s to the %s" % (USER,
CONTAINER_1))
topology_st.standalone.modify_s(CONTAINER_1, mod)
log.info("Add an ACI 'allow (all)' by %s to the %s" % (USER,
CONTAINER_2))
topology_st.standalone.modify_s(CONTAINER_2, mod)
@pytest.mark.ds47553
def test_enhanced_aci_modrnd(topology_st, env_setup):
"""Tests, that MODRDN operation is allowed,
if user has ACI right '(all)' under superior entries,
but doesn't have '(modrdn)'
:id: 492cf2a9-2efe-4e3b-955e-85eca61d66b9
:setup: Standalone instance
:steps:
1. Create two containers
2. Create a user within "ou=test_ou_1,dc=example,dc=com"
3. Add an aci with a rule "cn=test_user is allowed all" within these containers
4. Run MODRDN operation on the "cn=test_user" and set "newsuperior" to
the "ou=test_ou_2,dc=example,dc=com"
5. Check there is no user under container one (ou=test_ou_1,dc=example,dc=com)
6. Check there is a user under container two (ou=test_ou_2,dc=example,dc=com)
:expectedresults:
1. Two containers should be created
2. User should be added successfully
3. This should pass
4. This should pass
5. User should not be found under container ou=test_ou_1,dc=example,dc=com
6. User should be found under container ou=test_ou_2,dc=example,dc=com
"""
log.info("Bind as %s" % USER)
topology_st.standalone.simple_bind_s(USER, USER_PWD)
log.info("User MODRDN operation from %s to %s" % (CONTAINER_1,
CONTAINER_2))
topology_st.standalone.rename_s(USER, "cn=%s" % USER_CN,
newsuperior=CONTAINER_2, delold=1)
log.info("Check there is no user in %s" % CONTAINER_1)
entries = topology_st.standalone.search_s(CONTAINER_1,
ldap.SCOPE_ONELEVEL,
'cn=%s' % USER_CN)
assert not entries
log.info("Check there is our user in %s" % CONTAINER_2)
entries = topology_st.standalone.search_s(CONTAINER_2,
ldap.SCOPE_ONELEVEL,
'cn=%s' % USER_CN)
assert entries
if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
# -v for additional verbose
CURRENT_FILE = os.path.realpath(__file__)
pytest.main("-s -v %s" % CURRENT_FILE)
......@@ -34,6 +34,8 @@ BOGUSSUFFIX = 'uid=bogus,ou=people,dc=bogus'
GROUPOU = 'ou=groups,%s' % DEFAULT_SUFFIX
BOGUSOU = 'ou=OU,%s' % DEFAULT_SUFFIX
def get_ldap_error_msg(e, type):
return e.args[0][type]
def pattern_accesslog(file, log_pattern):
for i in range(5):
......@@ -111,7 +113,7 @@ def check_op_result(server, op, dn, superior, exists, rc):
server.add_s(Entry((dn, {'objectclass': 'top extensibleObject'.split(),
'cn': 'test entry'})))
elif op == 'modify':
server.modify_s(dn, [(ldap.MOD_REPLACE, 'description', 'test')])
server.modify_s(dn, [(ldap.MOD_REPLACE, 'description', b'test')])
elif op == 'modrdn':
if superior is not None:
server.rename_s(dn, 'uid=new', newsuperior=superior, delold=1)
......@@ -125,10 +127,10 @@ def check_op_result(server, op, dn, superior, exists, rc):
except ldap.LDAPError as e:
hit = 1
log.info("Exception (expected): %s" % type(e).__name__)
log.info('Desc ' + e.message['desc'])
log.info('Desc {}'.format(get_ldap_error_msg(e,'desc')))
assert isinstance(e, rc)
if 'matched' in e.message:
log.info('Matched is returned: ' + e.message['matched'])
if 'matched' in e.args:
log.info('Matched is returned: {}'.format(get_ldap_error_msg(e, 'matched')))
if rc != ldap.NO_SUCH_OBJECT:
assert False
......@@ -144,14 +146,43 @@ def check_op_result(server, op, dn, superior, exists, rc):
log.info('PASSED\n')
def test_ticket1347760(topology_st):
"""
Prevent revealing the entry info to whom has no access rights.
@pytest.mark.bz1347760
def test_repeated_ldap_add(topology_st):
"""Prevent revealing the entry info to whom has no access rights.
:id: 76d278bd-3e51-4579-951a-753e6703b4df
:setup: Standalone instance
:steps:
1. Disable accesslog logbuffering
2. Bind as "cn=Directory Manager"
3. Add a organisational unit as BOU
4. Add a bind user as uid=buser123,ou=BOU,dc=example,dc=com
5. Add a test user as uid=tuser0,ou=People,dc=example,dc=com
6. Delete aci in dc=example,dc=com
7. Bind as Directory Manager, acquire an access log path and instance dir
8. Bind as uid=buser123,ou=BOU,dc=example,dc=com who has no right to read the entry
9. Bind as uid=bogus,ou=people,dc=bogus,bogus who does not exist
10. Bind as uid=buser123,ou=BOU,dc=example,dc=com,bogus with wrong password
11. Adding aci for uid=buser123,ou=BOU,dc=example,dc=com to ou=BOU,dc=example,dc=com.
12. Bind as uid=buser123,ou=BOU,dc=example,dc=com now who has right to read the entry
:expectedresults:
1. Operation should be successful
2. Operation should be successful
3. Operation should be successful
4. Operation should be successful
5. Operation should be successful
6. Operation should be successful
7. Operation should be successful
8. Bind operation should be successful with no search result
9. Bind operation should Fail
10. Bind operation should Fail
11. Operation should be successful
12. Bind operation should be successful with search result
"""
log.info('Testing Bug 1347760 - Information disclosure via repeated use of LDAP ADD operation, etc.')
log.info('Disabling accesslog logbuffering')
topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-accesslog-logbuffering', 'off')])
topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-accesslog-logbuffering', b'off')])
log.info('Bind as {%s,%s}' % (DN_DM, PASSWORD))
topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
......@@ -189,7 +220,7 @@ def test_ticket1347760(topology_st):
try:
topology_st.standalone.simple_bind_s(BINDDN, BINDPW)
except ldap.LDAPError as e:
log.info('Desc ' + e.message['desc'])
log.info('Desc {}'.format(get_ldap_error_msg(e,'desc')))
assert False
file_obj = open(file_path, "r")
......@@ -202,7 +233,7 @@ def test_ticket1347760(topology_st):
topology_st.standalone.simple_bind_s(BOGUSDN, 'bogus')
except ldap.LDAPError as e:
log.info("Exception (expected): %s" % type(e).__name__)
log.info('Desc ' + e.message['desc'])
log.info('Desc {}'.format(get_ldap_error_msg(e,'desc')))
assert isinstance(e, ldap.INVALID_CREDENTIALS)
regex = re.compile('No such entry')
cause = pattern_accesslog(file_obj, regex)
......@@ -234,7 +265,7 @@ def test_ticket1347760(topology_st):
topology_st.standalone.simple_bind_s(BINDDN, 'bogus')
except ldap.LDAPError as e:
log.info("Exception (expected): %s" % type(e).__name__)
log.info('Desc ' + e.message['desc'])
log.info('Desc {}'.format(get_ldap_error_msg(e,'desc')))
assert isinstance(e, ldap.INVALID_CREDENTIALS)
regex = re.compile('Invalid credentials')
cause = pattern_accesslog(file_obj, regex)
......@@ -250,7 +281,7 @@ def test_ticket1347760(topology_st):
log.info('aci: %s' % acival)
log.info('Bind as {%s,%s}' % (DN_DM, PASSWORD))
topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
topology_st.standalone.modify_s(BINDOU, [(ldap.MOD_ADD, 'aci', acival)])
topology_st.standalone.modify_s(BINDOU, [(ldap.MOD_ADD, 'aci', ensure_bytes(acival))])
time.sleep(1)
log.info('Bind case 3. the bind user has the right to read the entry itself, bind should be successful.')
......@@ -376,14 +407,14 @@ def test_ticket1347760(topology_st):
acival = '(targetattr="*")(version 3.0; acl "%s-all"; allow(all) userdn = "ldap:///%s";)' % (BUID, BINDDN)
log.info('Bind as {%s,%s}' % (DN_DM, PASSWORD))
topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
topology_st.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_ADD, 'aci', acival)])
topology_st.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_ADD, 'aci', ensure_bytes(acival))])
time.sleep(1)
log.info('Bind as {%s,%s}.' % (BINDDN, BINDPW))
try:
topology_st.standalone.simple_bind_s(BINDDN, BINDPW)
except ldap.LDAPError as e:
log.info('Desc ' + e.message['desc'])
log.info('Desc {}'.format(get_ldap_error_msg(e,'desc')))
assert False
time.sleep(1)
......@@ -434,7 +465,7 @@ def test_ticket1347760(topology_st):
topology_st.standalone.simple_bind_s(BINDDN, BUID)
except ldap.LDAPError as e:
log.info("Exception (expected): %s" % type(e).__name__)
log.info('Desc ' + e.message['desc'])
log.info('Desc {}'.format(get_ldap_error_msg(e,'desc')))
assert isinstance(e, ldap.UNWILLING_TO_PERFORM)
log.info('Bind as {%s,%s} which should fail with %s.' % (BINDDN, 'bogus', ldap.UNWILLING_TO_PERFORM.__name__))
......@@ -442,7 +473,7 @@ def test_ticket1347760(topology_st):
topology_st.standalone.simple_bind_s(BINDDN, 'bogus')
except ldap.LDAPError as e:
log.info("Exception (expected): %s" % type(e).__name__)
log.info('Desc ' + e.message['desc'])
log.info('Desc {}'.format(get_ldap_error_msg(e,'desc')))
assert isinstance(e, ldap.UNWILLING_TO_PERFORM)
log.info('SUCCESS')
......@@ -453,3 +484,4 @@ if __name__ == '__main__':
# -s for DEBUG mode
CURRENT_FILE = os.path.realpath(__file__)
pytest.main("-s %s" % CURRENT_FILE)
......@@ -46,18 +46,14 @@ def _oc_definition(oid_ext, name, must=None, may=None):
may = MAY
new_oc = "( %s NAME '%s' DESC '%s' SUP %s AUXILIARY MUST %s MAY %s )" % (oid, name, desc, sup, must, may)
return new_oc
return ensure_bytes(new_oc)
def test_ticket47653_init(topology_st):
"""
It adds
- Objectclass with MAY 'member'
- an entry ('bind_entry') with which we bind to test the 'SELFDN' operation
It deletes the anonymous aci
"""
@pytest.fixture(scope="module")
def allow_user_init(topology_st):
"""Initialize the test environment
"""
topology_st.standalone.log.info("Add %s that allows 'member' attribute" % OC_NAME)
new_oc = _oc_definition(2, OC_NAME, must=MUST, may=MAY)
topology_st.standalone.schema.add_schema('objectClasses', new_oc)
......@@ -71,7 +67,7 @@ def test_ticket47653_init(topology_st):
'userpassword': BIND_PW})))
# enable acl error logging
mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '128')]
mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', b'128')]
topology_st.standalone.modify_s(DN_CONFIG, mod)
# Remove aci's to start with a clean slate
......@@ -87,13 +83,25 @@ def test_ticket47653_init(topology_st):
'cn': name})))
def test_ticket47653_add(topology_st):
'''
It checks that, bound as bind_entry,
- we can not ADD an entry without the proper SELFDN aci.
- with the proper ACI we can not ADD with 'member' attribute
- with the proper ACI and 'member' it succeeds to ADD
'''
@pytest.mark.ds47653
def test_selfdn_permission_add(topology_st, allow_user_init):
"""Check add entry operation with and without SelfDN aci
:id: e837a9ef-be92-48da-ad8b-ebf42b0fede1
:setup: Standalone instance, add a entry which is used to bind,
enable acl error logging by setting 'nsslapd-errorlog-level' to '128',
remove aci's to start with a clean slate, and add dummy entries
:steps:
1. Check we can not ADD an entry without the proper SELFDN aci
2. Check with the proper ACI we can not ADD with 'member' attribute
3. Check entry to add with memberS and with the ACI
4. Check with the proper ACI and 'member' it succeeds to ADD
:expectedresults:
1. Operation should be successful
2. Operation should be successful
3. Operation should fail with Insufficient Access
4. Operation should be successful
"""
topology_st.standalone.log.info("\n\n######################### ADD ######################\n")
# bind as bind_entry
......@@ -143,7 +151,7 @@ def test_ticket47653_add(topology_st):
ACI_ALLOW = "(version 3.0; acl \"SelfDN add\"; allow (add)"
ACI_SUBJECT = " userattr = \"member#selfDN\";)"
ACI_BODY = ACI_TARGET + ACI_TARGETFILTER + ACI_ALLOW + ACI_SUBJECT
mod = [(ldap.MOD_ADD, 'aci', ACI_BODY)]
mod = [(ldap.MOD_ADD, 'aci', ensure_bytes(ACI_BODY))]
topology_st.standalone.modify_s(SUFFIX, mod)
# bind as bind_entry
......@@ -176,12 +184,23 @@ def test_ticket47653_add(topology_st):
topology_st.standalone.add_s(entry_with_member)
def test_ticket47653_search(topology_st):
'''
It checks that, bound as bind_entry,
- we can not search an entry without the proper SELFDN aci.
- adding the ACI, we can search the entry
'''
@pytest.mark.ds47653
def test_selfdn_permission_search(topology_st, allow_user_init):
"""Check search operation with and without SelfDN aci
:id: 06d51ef9-c675-4583-99b2-4852dbda190e
:setup: Standalone instance, add a entry which is used to bind,
enable acl error logging by setting 'nsslapd-errorlog-level' to '128',
remove aci's to start with a clean slate, and add dummy entries
:steps:
1. Check we can not search an entry without the proper SELFDN aci
2. Add proper ACI
3. Check we can search with the proper ACI
:expectedresults:
1. Operation should be successful
2. Operation should be successful
3. Operation should be successful
"""
topology_st.standalone.log.info("\n\n######################### SEARCH ######################\n")
# bind as bind_entry
topology_st.standalone.log.info("Bind as %s" % BIND_DN)
......@@ -202,7 +221,7 @@ def test_ticket47653_search(topology_st):
ACI_ALLOW = "(version 3.0; acl \"SelfDN search-read\"; allow (read, search, compare)"
ACI_SUBJECT = " userattr = \"member#selfDN\";)"
ACI_BODY = ACI_TARGET + ACI_TARGETATTR + ACI_TARGETFILTER + ACI_ALLOW + ACI_SUBJECT
mod = [(ldap.MOD_ADD, 'aci', ACI_BODY)]
mod = [(ldap.MOD_ADD, 'aci', ensure_bytes(ACI_BODY))]
topology_st.standalone.modify_s(SUFFIX, mod)
# bind as bind_entry
......@@ -215,12 +234,23 @@ def test_ticket47653_search(topology_st):
assert len(ents) == 1
def test_ticket47653_modify(topology_st):
'''
It checks that, bound as bind_entry,
- we can not modify an entry without the proper SELFDN aci.
- adding the ACI, we can modify the entry
'''
@pytest.mark.ds47653
def test_selfdn_permission_modify(topology_st, allow_user_init):
"""Check modify operation with and without SelfDN aci
:id: 97a58844-095f-44b0-9029-dd29a7d83d68
:setup: Standalone instance, add a entry which is used to bind,
enable acl error logging by setting 'nsslapd-errorlog-level' to '128',
remove aci's to start with a clean slate, and add dummy entries
:steps:
1. Check we can not modify an entry without the proper SELFDN aci
2. Add proper ACI
3. Modify the entry and check the modified value
:expectedresults:
1. Operation should be successful
2. Operation should be successful
3. Operation should be successful
"""
# bind as bind_entry
topology_st.standalone.log.info("Bind as %s" % BIND_DN)
topology_st.standalone.simple_bind_s(BIND_DN, BIND_PW)
......@@ -230,7 +260,7 @@ def test_ticket47653_modify(topology_st):
# entry to modify WITH member being BIND_DN but WITHOUT the ACI -> ldap.INSUFFICIENT_ACCESS
try:
topology_st.standalone.log.info("Try to modify %s (aci is missing)" % ENTRY_DN)
mod = [(ldap.MOD_REPLACE, 'postalCode', '9876')]
mod = [(ldap.MOD_REPLACE, 'postalCode', b'9876')]
topology_st.standalone.modify_s(ENTRY_DN, mod)
except Exception as e:
topology_st.standalone.log.info("Exception (expected): %s" % type(e).__name__)
......@@ -246,7 +276,7 @@ def test_ticket47653_modify(topology_st):
ACI_ALLOW = "(version 3.0; acl \"SelfDN write\"; allow (write)"
ACI_SUBJECT = " userattr = \"member#selfDN\";)"
ACI_BODY = ACI_TARGET + ACI_TARGETATTR + ACI_TARGETFILTER + ACI_ALLOW + ACI_SUBJECT
mod = [(ldap.MOD_ADD, 'aci', ACI_BODY)]
mod = [(ldap.MOD_ADD, 'aci', ensure_bytes(ACI_BODY))]
topology_st.standalone.modify_s(SUFFIX, mod)
# bind as bind_entry
......@@ -255,20 +285,30 @@ def test_ticket47653_modify(topology_st):
# modify the entry and checks the value
topology_st.standalone.log.info("Try to modify %s. It should succeeds" % ENTRY_DN)
mod = [(ldap.MOD_REPLACE, 'postalCode', '1928')]
mod = [(ldap.MOD_REPLACE, 'postalCode', b'1928')]
topology_st.standalone.modify_s(ENTRY_DN, mod)
ents = topology_st.standalone.search_s(ENTRY_DN, ldap.SCOPE_BASE, 'objectclass=*')
assert len(ents) == 1
assert ents[0].postalCode == '1928'
def test_ticket47653_delete(topology_st):
'''
It checks that, bound as bind_entry,
- we can not delete an entry without the proper SELFDN aci.
- adding the ACI, we can delete the entry
'''
assert ensure_str(ents[0].postalCode) == '1928'
@pytest.mark.ds47653
def test_selfdn_permission_delete(topology_st, allow_user_init):
"""Check delete operation with and without SelfDN aci
:id: 0ec4c0ec-e7b0-4ef1-8373-ab25aae34516
:setup: Standalone instance, add a entry which is used to bind,
enable acl error logging by setting 'nsslapd-errorlog-level' to '128',
remove aci's to start with a clean slate, and add dummy entries
:steps:
1. Check we can not delete an entry without the proper SELFDN aci
2. Add proper ACI
3. Check we can perform delete operation with proper ACI
:expectedresults:
1. Operation should be successful
2. Operation should be successful
"""
topology_st.standalone.log.info("\n\n######################### DELETE ######################\n")
# bind as bind_entry
......@@ -292,14 +332,14 @@ def test_ticket47653_delete(topology_st):
ACI_ALLOW = "(version 3.0; acl \"SelfDN delete\"; allow (delete)"
ACI_SUBJECT = " userattr = \"member#selfDN\";)"
ACI_BODY = ACI_TARGET + ACI_TARGETFILTER + ACI_ALLOW + ACI_SUBJECT
mod = [(ldap.MOD_ADD, 'aci', ACI_BODY)]
mod = [(ldap.MOD_ADD, 'aci', ensure_bytes(ACI_BODY))]
topology_st.standalone.modify_s(SUFFIX, mod)
# bind as bind_entry
topology_st.standalone.log.info("Bind as %s" % BIND_DN)
topology_st.standalone.simple_bind_s(BIND_DN, BIND_PW)
# entry to search with the proper aci
# entry to delete with the proper aci
topology_st.standalone.log.info("Try to delete %s should be successful" % ENTRY_DN)
topology_st.standalone.delete_s(ENTRY_DN)
......
......@@ -18,6 +18,9 @@ import ldap
from lib389 import DirSrv, Entry
from lib389._constants import *
from lib389.properties import *
from lib389.plugins import ReferentialIntegrityPlugin, MemberOfPlugin
from lib389.utils import *
from lib389.idm.directorymanager import *
log = logging.getLogger(__name__)
......@@ -25,39 +28,18 @@ NUM_USERS = 250
GROUP_DN = 'cn=stress-group,' + DEFAULT_SUFFIX
def openConnection(inst):
# Open a new connection to our LDAP server
server = DirSrv(verbose=False)
args_instance[SER_HOST] = HOST_STANDALONE
args_instance[SER_PORT] = PORT_STANDALONE
args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
args_standalone = args_instance.copy()
server.allocate(args_standalone)
server.open()
return server
# Configure Referential Integrity Plugin for stress test
def configureRI(inst):
inst.plugins.enable(name=PLUGIN_REFER_INTEGRITY)
PLUGIN_DN = 'cn=' + PLUGIN_REFER_INTEGRITY + ',cn=plugins,cn=config'
try:
inst.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE, 'referint-membership-attr', 'uniquemember')])
except ldap.LDAPError as e:
log.fatal('configureRI: Failed to configure RI plugin: error ' + e.message['desc'])
assert False
plugin = ReferentialIntegrityPlugin(inst)
plugin.enable()
plugin.replace('referint-membership-attr', 'uniquemember')
# Configure MemberOf Plugin for stress test
def configureMO(inst):
inst.plugins.enable(name=PLUGIN_MEMBER_OF)
PLUGIN_DN = 'cn=' + PLUGIN_MEMBER_OF + ',cn=plugins,cn=config'
try:
inst.modify_s(PLUGIN_DN, [(ldap.MOD_REPLACE, 'memberofgroupattr', 'uniquemember')])
except ldap.LDAPError as e:
log.fatal('configureMO: Failed to update config(uniquemember): error ' + e.message['desc'])
assert False
plugin = MemberOfPlugin(inst)
plugin.enable()
plugin.replace('memberofgroupattr', 'uniquemember')
def cleanup(conn):
......@@ -76,7 +58,8 @@ class DelUsers(threading.Thread):
self.rdnval = rdnval
def run(self):
conn = openConnection(self.inst)
dm = DirectoryManager(self.inst)
conn = dm.bind()
idx = 0
log.info('DelUsers - Deleting ' + str(NUM_USERS) + ' entries (' + self.rdnval + ')...')
while idx < NUM_USERS:
......@@ -104,17 +87,18 @@ class AddUsers(threading.Thread):
def run(self):
# Start adding users
conn = openConnection(self.inst)
dm = DirectoryManager(self.inst)
conn = dm.bind()
idx = 0
if self.addToGroup:
try:
conn.add_s(Entry((GROUP_DN,
{'objectclass': 'top groupOfNames groupOfUniqueNames extensibleObject'.split(),
'uid': 'user' + str(idx)})))
{'objectclass': b'top groupOfNames groupOfUniqueNames'.split(),
'cn': 'stress-group'})))
except ldap.LDAPError as e:
if e == ldap.UNAVAILABLE or e == ldap.SERVER_DOWN:
log.fatal('AddUsers: failed to add group (' + USER_DN + ') error: ' + e.message['desc'])
log.fatal('AddUsers: failed to add group (' + GROUP_DN + ') error: ' + e.message['desc'])
assert False
log.info('AddUsers - Adding ' + str(NUM_USERS) + ' entries (' + self.rdnval + ')...')
......@@ -122,8 +106,8 @@ class AddUsers(threading.Thread):
while idx < NUM_USERS:
USER_DN = 'uid=' + self.rdnval + str(idx) + ',' + DEFAULT_SUFFIX
try:
conn.add_s(Entry((USER_DN, {'objectclass': 'top extensibleObject'.split(),
'uid': 'user' + str(idx)})))
conn.add_s(Entry((USER_DN, {'objectclass': b'top nsOrgPerson'.split(),
'uid': ensure_bytes('user' + str(idx))})))
except ldap.LDAPError as e:
if e == ldap.UNAVAILABLE or e == ldap.SERVER_DOWN:
log.fatal('AddUsers: failed to add (' + USER_DN + ') error: ' + e.message['desc'])
......@@ -132,7 +116,7 @@ class AddUsers(threading.Thread):
if self.addToGroup:
# Add the user to the group
try:
conn.modify_s(GROUP_DN, [(ldap.MOD_ADD, 'uniquemember', USER_DN)])
conn.modify_s(GROUP_DN, [(ldap.MOD_ADD, 'uniquemember', ensure_bytes(USER_DN))])
except ldap.LDAPError as e:
if e == ldap.UNAVAILABLE or e == ldap.SERVER_DOWN:
log.fatal('AddUsers: Failed to add user' + USER_DN + ' to group: error ' + e.message['desc'])
......
......@@ -11,11 +11,14 @@ import logging
import pytest
from lib389.tasks import *
from lib389.topologies import topology_st
from lib389._constants import PASSWORD, DEFAULT_SUFFIX
from lib389._constants import PASSWORD, DEFAULT_SUFFIX, DN_DM, SUFFIX
from lib389.utils import *
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
ENTRY_NAME = 'test_entry'
def test_filter_escaped(topology_st):
"""Test we can search for an '*' in a attribute value.
......@@ -125,6 +128,100 @@ def test_filter_scope_one(topology_st):
log.info('Search should only have one entry')
assert len(results) == 1
@pytest.mark.ds47313
def test_filter_with_attribute_subtype(topology_st):
"""Adds 2 test entries and Search with
filters including subtype and !
:id: 0e69f5f2-6a0a-480e-8282-fbcc50231908
:setup: Standalone instance
:steps:
1. Add 2 entries and create 3 filters
2. Search for entry with filter: (&(cn=test_entry en only)(!(cn=test_entry fr)))
3. Search for entry with filter: (&(cn=test_entry en only)(!(cn;fr=test_entry fr)))
4. Search for entry with filter: (&(cn=test_entry en only)(!(cn;en=test_entry en)))
5. Delete the added entries
:expectedresults:
1. Operation should be successful
2. Search should be successful
3. Search should be successful
4. Search should not be successful
5. Delete the added entries
"""
# bind as directory manager
topology_st.standalone.log.info("Bind as %s" % DN_DM)
topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)
# enable filter error logging
# mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '32')]
# topology_st.standalone.modify_s(DN_CONFIG, mod)
topology_st.standalone.log.info("\n\n######################### ADD ######################\n")
# Prepare the entry with cn;fr & cn;en
entry_name_fr = '%s fr' % (ENTRY_NAME)
entry_name_en = '%s en' % (ENTRY_NAME)
entry_name_both = '%s both' % (ENTRY_NAME)
entry_dn_both = 'cn=%s, %s' % (entry_name_both, SUFFIX)
entry_both = Entry(entry_dn_both)
entry_both.setValues('objectclass', 'top', 'person')
entry_both.setValues('sn', entry_name_both)
entry_both.setValues('cn', entry_name_both)
entry_both.setValues('cn;fr', entry_name_fr)
entry_both.setValues('cn;en', entry_name_en)
# Prepare the entry with one member
entry_name_en_only = '%s en only' % (ENTRY_NAME)
entry_dn_en_only = 'cn=%s, %s' % (entry_name_en_only, SUFFIX)
entry_en_only = Entry(entry_dn_en_only)
entry_en_only.setValues('objectclass', 'top', 'person')
entry_en_only.setValues('sn', entry_name_en_only)
entry_en_only.setValues('cn', entry_name_en_only)
entry_en_only.setValues('cn;en', entry_name_en)
topology_st.standalone.log.info("Try to add Add %s: %r" % (entry_dn_both, entry_both))
topology_st.standalone.add_s(entry_both)
topology_st.standalone.log.info("Try to add Add %s: %r" % (entry_dn_en_only, entry_en_only))
topology_st.standalone.add_s(entry_en_only)
topology_st.standalone.log.info("\n\n######################### SEARCH ######################\n")
# filter: (&(cn=test_entry en only)(!(cn=test_entry fr)))
myfilter = '(&(sn=%s)(!(cn=%s)))' % (entry_name_en_only, entry_name_fr)
topology_st.standalone.log.info("Try to search with filter %s" % myfilter)
ents = topology_st.standalone.search_s(SUFFIX, ldap.SCOPE_SUBTREE, myfilter)
assert len(ents) == 1
assert ensure_str(ents[0].sn) == entry_name_en_only
topology_st.standalone.log.info("Found %s" % ents[0].dn)
# filter: (&(cn=test_entry en only)(!(cn;fr=test_entry fr)))
myfilter = '(&(sn=%s)(!(cn;fr=%s)))' % (entry_name_en_only, entry_name_fr)
topology_st.standalone.log.info("Try to search with filter %s" % myfilter)
ents = topology_st.standalone.search_s(SUFFIX, ldap.SCOPE_SUBTREE, myfilter)
assert len(ents) == 1
assert ensure_str(ents[0].sn) == entry_name_en_only
topology_st.standalone.log.info("Found %s" % ents[0].dn)
# filter: (&(cn=test_entry en only)(!(cn;en=test_entry en)))
myfilter = '(&(sn=%s)(!(cn;en=%s)))' % (entry_name_en_only, entry_name_en)
topology_st.standalone.log.info("Try to search with filter %s" % myfilter)
ents = topology_st.standalone.search_s(SUFFIX, ldap.SCOPE_SUBTREE, myfilter)
assert len(ents) == 0
topology_st.standalone.log.info("Found none")
topology_st.standalone.log.info("\n\n######################### DELETE ######################\n")
topology_st.standalone.log.info("Try to delete %s " % entry_dn_both)
topology_st.standalone.delete_s(entry_dn_both)
topology_st.standalone.log.info("Try to delete %s " % entry_dn_en_only)
topology_st.standalone.delete_s(entry_dn_en_only)
log.info('Testcase PASSED')
if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
......
......@@ -10,6 +10,7 @@ import ldap
import pytest
from lib389.topologies import topology_m2
from lib389._constants import (DEFAULT_SUFFIX, HOST_MASTER_2, PORT_MASTER_2, TASK_WAIT)
from lib389.agreement import Agreements
from lib389.idm.user import (TEST_USER_PROPERTIES, UserAccounts)
......@@ -41,7 +42,8 @@ def test_referral_during_tot(topology_m2):
u = users.create(properties=TEST_USER_PROPERTIES)
u.set('userPassword', 'password')
# Now export them to master2
master1.agreement.init(DEFAULT_SUFFIX, HOST_MASTER_2, PORT_MASTER_2)
agmts = Agreements(master1)
agmts.list()[0].begin_reinit()
# While that's happening try to bind as a user to master 2
# This should trigger the referral code.
......
......@@ -21,7 +21,7 @@ from lib389 import agreement, Entry
from lib389.idm.user import UserAccount, UserAccounts, TEST_USER_PROPERTIES
from lib389.idm.group import Groups, Group
from lib389.topologies import topology_m2 as topo_m2
from lib389.replica import Replicas
from lib389.replica import ReplicationManager
# Skip on older versions
pytestmark = pytest.mark.skipif(ds_is_older('1.3.7'), reason="Not implemented")
......@@ -383,10 +383,8 @@ def test_memberof_with_changelog_reset(topo_m2):
assert not m1.ds_error_log.match(error_msg)
log.info("Check that the replication is working fine both ways, M1 <-> M2")
replicas_m1 = Replicas(m1)
replicas_m2 = Replicas(m2)
replicas_m1.test(DEFAULT_SUFFIX, m2)
replicas_m2.test(DEFAULT_SUFFIX, m1)
repl = ReplicationManager(DEFAULT_SUFFIX)
repl.test_replication_topology(topo_m2)
if __name__ == '__main__':
......
......@@ -9,50 +9,18 @@
import pytest
from lib389.tasks import *
from lib389.utils import *
from lib389.paths import Paths
from lib389.topologies import topology_st
from lib389._constants import (PLUGIN_RETRO_CHANGELOG, BACKEND_NAME, RETROCL_SUFFIX,
VALGRIND_LEAK_STR)
from lib389._constants import *
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
ds_paths = Paths()
@pytest.fixture(scope="module")
def setup(topology_st, request):
"""Enable retro cl, and valgrind. Since valgrind tests move the ns-slapd binary
around it's important to always "valgrind_disable" before "assert False"ing,
otherwise we leave the wrong ns-slapd in place if there is a failure
"""
log.info('Initializing test_range_search...')
topology_st.standalone.plugins.enable(name=PLUGIN_RETRO_CHANGELOG)
# First stop the instance
topology_st.standalone.stop(timeout=30)
# Get the sbin directory so we know where to replace 'ns-slapd'
sbin_dir = get_sbin_dir(prefix=topology_st.standalone.prefix)
# Enable valgrind
if not topology_st.standalone.has_asan():
valgrind_enable(sbin_dir)
def fin():
if not topology_st.standalone.has_asan():
topology_st.standalone.stop(timeout=30)
sbin_dir = topology_st.standalone.get_sbin_dir()
valgrind_disable(sbin_dir)
topology_st.standalone.start()
request.addfinalizer(fin)
# Now start the server with a longer timeout
topology_st.standalone.start()
def test_range_search(topology_st, setup):
@pytest.mark.skipif(not ds_paths.asan_enabled, reason="Don't run if ASAN is not enabled")
def test_range_search(topology_st):
"""Add 100 entries, and run a range search. When we encounter an error
we still need to disable valgrind before exiting
......@@ -62,15 +30,16 @@ def test_range_search(topology_st, setup):
:steps:
1. Add 100 test entries
2. Issue a range search with a changenumber filter
3. If the system doesn't have asan, get the valgrind results file,
stop the server, and check for the leak
3. There should be no leak
:expectedresults:
1. 100 test entries should be added
2. Search should be successful
3. There should be no leak
3. Success
"""
log.info('Running test_range_search...')
topology_st.standalone.plugins.enable(name=PLUGIN_RETRO_CHANGELOG)
topology_st.standalone.restart()
success = True
......@@ -87,21 +56,10 @@ def test_range_search(topology_st, setup):
time.sleep(1)
# Issue range search
if success:
try:
topology_st.standalone.search_s(RETROCL_SUFFIX, ldap.SCOPE_SUBTREE,
'(&(changenumber>=74)(changenumber<=84))')
except ldap.LDAPError as e:
log.fatal('test_range_search: Failed to search retro changelog(%s), error: %s' %
(RETROCL_SUFFIX, e.message('desc')))
success = False
if success and not topology_st.standalone.has_asan():
# Get the results file, stop the server, and check for the leak
results_file = valgrind_get_results_file(topology_st.standalone)
topology_st.standalone.stop(timeout=30)
if valgrind_check_file(results_file, VALGRIND_LEAK_STR, 'range_candidates'):
log.fatal('test_range_search: Memory leak is still present!')
assert False
assert success
entries = topology_st.standalone.search_s(RETROCL_SUFFIX, ldap.SCOPE_SUBTREE,
'(&(changenumber>=74)(changenumber<=84))')
assert entries
if __name__ == '__main__':
......