From 2886df93860f983d875b7d6acb418faa31491d5a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 13:11:40 +0200 Subject: Adding debian version 2.4.57+dfsg-3+deb11u1. Signed-off-by: Daniel Baumann --- debian/tests/check_upgradepath | 173 +++++++++++++++++++++++++++++++++++++ debian/tests/control | 3 + debian/tests/create_account | 24 +++++ debian/tests/find_unused_functions | 30 +++++++ debian/tests/hammer_slapd | 98 +++++++++++++++++++++ debian/tests/slapd | 15 ++++ 6 files changed, 343 insertions(+) create mode 100755 debian/tests/check_upgradepath create mode 100644 debian/tests/control create mode 100755 debian/tests/create_account create mode 100755 debian/tests/find_unused_functions create mode 100755 debian/tests/hammer_slapd create mode 100755 debian/tests/slapd (limited to 'debian/tests') diff --git a/debian/tests/check_upgradepath b/debian/tests/check_upgradepath new file mode 100755 index 0000000..d1f2578 --- /dev/null +++ b/debian/tests/check_upgradepath @@ -0,0 +1,173 @@ +#! /bin/sh + +set -e + +# WARNING: This script is obsolete and will require a fair bit of work to get +# working again. It assumes woody, uses debconf questions that don't exist +# any more, and probably doesn't check everything that you would want to +# check. Preserved just because I haven't done the work to see if puiparts +# can now do the same thing in a cleaner way. + +# Setup +: ${chroot_dir:=../chroot} +: ${debmirror:=http://ftp.de.debian.org/debian} +: ${proxy:=http://proxy.galaxy:3128/} +unset LC_ALL +unset LC_CTYPE +unset LC_MESSAGES +# XXX: comment out when testing new versions. Needed so libc6 does not +# ask for restarting services. +export DEBIAN_FRONTEND=noninteractive + +woodytar=$chroot_dir/woody_base.tar.gz + +# List our packages +list_packages() { + local p ver + ver=`dpkg-parsechangelog|sed -ne 's/^Version: //p'` + for p in `dh_listpackages`; do + (cd .. && echo ${p}_$ver*deb) + done +} + +# Run a command inside the chroot + +in_target() { + chroot $chroot_dir/woody "$@" +} + +# Set a debconf variable inside the chroot + +debconf_set() { + local name=$1 + shift + cat >>$chroot_dir/woody/var/cache/debconf/config.dat < $chroot_dir/woody/etc/apt/sources.list + echo "Acquire::HTTP::Proxy \"$proxy\";" \ + > $chroot_dir/woody/etc/apt/apt.conf + in_target apt-get update + in_target mount -t proc none /proc + + # We don't want any debconf interaction + #debconf_set debconf/frontend Noninteractive +} + +# These are our example configurations for testing the upgrade + +conf_domain_or_host() { + debconf_set slapd/fill_method auto + debconf_set slapd/suffix_type "domain or host" + debconf_set slapd/domain "some.example.net" + debconf_set slapd/replicate false + debconf_set shared/organization Some Organization +} + + +check_domain_or_host() { + sleep 2 # wait for slapd to startup + in_target ldapsearch -h localhost -b dc=some,dc=example,dc=net -x \ + objectclass=\* +} + +conf_location() { + debconf_set slapd/fill_method auto + debconf_set slapd/suffix_type "location" + debconf_set shared/locale/countrycode de + debconf_set shared/organization "Sample Organization" + debconf_set slapd/replicate false + debconf_set shared/organization Some Organization +} + +check_location() { + sleep 2 # wait for slapd to startup + in_target ldapsearch -h localhost -b "o=Some Organization, c=de" \ + -x objectclass=\* +} +# Install slapd inside the chroot + +install_slapd() { + in_target apt-get -y install slapd ldap-utils +} + +# Do an upgrade of our packages inside the chroot + +upgrade() { + # Link our packages into the chroot + for p in `list_packages`; do + ln ../$p $chroot_dir/woody/root/ + done + + # Create a packages file + (cd $chroot_dir/woody/root && dpkg-scanpackages . /dev/null >Packages) + + # Switch to unstable + echo "deb $debmirror unstable main" \ + > $chroot_dir/woody/etc/apt/sources.list + echo "deb file:/root ./" >> $chroot_dir/woody/etc/apt/sources.list + + # Update package lists + in_target apt-get update + + # Tell our scripts to fix the config + debconf_set slapd/fix_directory true + debconf_set slapd/password1 foobar + debconf_set slapd/allow_ldap_v2 + + # Do an upgrade of our packages + in_target apt-get install -y `dh_listpackages` +} + +# Checks if upgrading a woody system with slapd configured with the +# command given works. + +check_upgrade() { + setup_chroot + conf_$1 + debconf_set slapd/password1 foobar + debconf_set slapd/password2 foobar + install_slapd + check_$1 + upgrade + check_$1 + in_target /etc/init.d/slapd stop + in_target umount /proc +} + +# Try upgrading our example setups + +for i in location domain_or_host; do + check_upgrade $i +done + +echo "SUCCESS testing upgrading from woody" diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..7a6c820 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,3 @@ +Tests: slapd +Depends: ldap-utils +Restrictions: allow-stderr, isolation-container, needs-root, superficial diff --git a/debian/tests/create_account b/debian/tests/create_account new file mode 100755 index 0000000..a5051af --- /dev/null +++ b/debian/tests/create_account @@ -0,0 +1,24 @@ +#! /usr/bin/perl -w + +# Shows how to create an entry on the LDAP server + +$host = "localhost"; # LDAP server +$basedn = "dc=galaxy"; # Base DN +$admindn = "cn=admin, $basedn"; # Admin entry +$adminpass = "foo"; # Password + +use Net::LDAP; + +$ldap = Net::LDAP->new("$host", onerror => "die"); +$ldap->bind($admindn, password => $adminpass); + +# Create "ou=People" entry if not there + +$results = $ldap->search(base => "$basedn", + filter => "ou=People", scope => "one"); +unless ($results->count > 0) { + $ldap->add("ou=People, $basedn", attr => [ + ou => "People", + objectClass => [ "top", "organizationalUnit" ] + ]); +} diff --git a/debian/tests/find_unused_functions b/debian/tests/find_unused_functions new file mode 100755 index 0000000..bd31d45 --- /dev/null +++ b/debian/tests/find_unused_functions @@ -0,0 +1,30 @@ +#! /usr/bin/perl -w + +use autouse Data::Dumper, qw{Dumper}; + +# Script to find the unused shell functions in slapd.scripts-common + +our @code; + +# Get all shell code from maintainer scripts + +foreach my $file ((, , , + )) { + open SCRIPT, "<$file" or + die "Can't open $file: $!"; + push @code,