diff -Nru samba-4.7.4+dfsg/debian/changelog samba-4.7.4+dfsg/debian/changelog --- samba-4.7.4+dfsg/debian/changelog 2018-01-11 17:49:28.000000000 -0200 +++ samba-4.7.4+dfsg/debian/changelog 2018-02-14 17:46:13.000000000 -0200 @@ -1,3 +1,17 @@ +samba (2:4.7.4+dfsg-1.1) unstable; urgency=medium + + * Non-maintainer upload. + * Add extra DEP8 tests to samba (Closes: #890439): + - d/t/control, d/t/cifs-share-access: access a file in a share using cifs + - d/t/control, d/t/smbclient-anonymous-share-list: list available shares + anonymously + - d/t/control, d/t/smbclient-authenticated-share-list: list available + shares using an authenticated connection + - d/t/control, d/t/smbclient-share-access: create a share and download a + file from it + + -- Andreas Hasenack Wed, 14 Feb 2018 17:46:13 -0200 + samba (2:4.7.4+dfsg-1) unstable; urgency=medium * New upstream version diff -Nru samba-4.7.4+dfsg/debian/tests/cifs-share-access samba-4.7.4+dfsg/debian/tests/cifs-share-access --- samba-4.7.4+dfsg/debian/tests/cifs-share-access 1969-12-31 21:00:00.000000000 -0300 +++ samba-4.7.4+dfsg/debian/tests/cifs-share-access 2018-02-09 11:39:04.000000000 -0200 @@ -0,0 +1,40 @@ +#!/bin/sh -x + +if ! testparm -s 2>&1 | grep -qE "^\[homes\]"; then + echo "Adding [homes] share" + cat >> /etc/samba/smb.conf </dev/null | base64 > ${userhome}/data +chown ${username}:${username} ${userhome}/data +cd ${userhome} +md5sum data > data.md5 + +echo "Mounting //localhost/${username} via CIFS" +temp_mount=$(mktemp -d) +mount -t cifs //localhost/${username} "$temp_mount" -o user=${username},username=${username},password=${password} + +echo "Verifying MD5 via cifs" +cd "$temp_mount" +md5sum -c data.md5 +result=$? +cd - +umount "$temp_mount" +rmdir "$temp_mount" +exit "$result" diff -Nru samba-4.7.4+dfsg/debian/tests/control samba-4.7.4+dfsg/debian/tests/control --- samba-4.7.4+dfsg/debian/tests/control 2018-01-11 11:15:14.000000000 -0200 +++ samba-4.7.4+dfsg/debian/tests/control 2018-02-09 11:44:54.000000000 -0200 @@ -1,2 +1,18 @@ +Tests: cifs-share-access +Depends: samba, coreutils, systemd, cifs-utils, passwd +Restrictions: needs-root, allow-stderr, isolation-machine + Tests: python-smoke Depends: python-samba + +Tests: smbclient-anonymous-share-list +Depends: samba, smbclient +Restrictions: allow-stderr, isolation-container + +Tests: smbclient-authenticated-share-list +Depends: samba, smbclient, passwd +Restrictions: needs-root, allow-stderr, isolation-container + +Tests: smbclient-share-access +Depends: samba, smbclient, coreutils, systemd, passwd +Restrictions: needs-root, allow-stderr, isolation-container diff -Nru samba-4.7.4+dfsg/debian/tests/smbclient-anonymous-share-list samba-4.7.4+dfsg/debian/tests/smbclient-anonymous-share-list --- samba-4.7.4+dfsg/debian/tests/smbclient-anonymous-share-list 1969-12-31 21:00:00.000000000 -0300 +++ samba-4.7.4+dfsg/debian/tests/smbclient-anonymous-share-list 2018-02-09 11:44:53.000000000 -0200 @@ -0,0 +1,3 @@ +#!/bin/sh -x + +smbclient -N -L localhost diff -Nru samba-4.7.4+dfsg/debian/tests/smbclient-authenticated-share-list samba-4.7.4+dfsg/debian/tests/smbclient-authenticated-share-list --- samba-4.7.4+dfsg/debian/tests/smbclient-authenticated-share-list 1969-12-31 21:00:00.000000000 -0300 +++ samba-4.7.4+dfsg/debian/tests/smbclient-authenticated-share-list 2018-02-09 11:44:54.000000000 -0200 @@ -0,0 +1,17 @@ +#!/bin/sh -x + +username="smbtest$$" +password="$$" + +echo "Creating a local test user called ${username}" +useradd -m "$username" + +echo "Setting samba password for the ${username} user" +echo "${password}\n${password}" | smbpasswd -s -a ${username} + +echo "Testing with incorrect password: must fail" +smbclient -L localhost -U ${username}%wrongpass && exit 1 + +echo "Testing with correct password: must work" +smbclient -L localhost -U ${username}%${password} + diff -Nru samba-4.7.4+dfsg/debian/tests/smbclient-share-access samba-4.7.4+dfsg/debian/tests/smbclient-share-access --- samba-4.7.4+dfsg/debian/tests/smbclient-share-access 1969-12-31 21:00:00.000000000 -0300 +++ samba-4.7.4+dfsg/debian/tests/smbclient-share-access 2018-02-09 11:44:54.000000000 -0200 @@ -0,0 +1,34 @@ +#!/bin/sh -x + +if ! testparm -s 2>&1 | grep -qE "^\[homes\]"; then + echo "Adding [homes] share" + cat >> /etc/samba/smb.conf </dev/null | base64 > ${userhome}/data +chown ${username}:${username} ${userhome}/data +cd ${userhome} +md5sum data > data.md5 + +rm -f downloaded-data +echo "Downloading file and comparing its md5" +smbclient //localhost/${username} -U ${username}%${password} -c "get data downloaded-data" + +mv -f downloaded-data data +md5sum -c data.md5