Source: samba
Severity: wishlist
Tags: patch

Dear samba maintainers,

Please, find attached an autopkgtest that checks if %U variable
substitution in include config files works correctly.

I have include it and verified it works in the recent buster update
https://tracker.debian.org/news/1520926/accepted-samba-2495dfsg-5deb10u5-source-into-oldoldstable/
to confirm it didn't introduce regressions like the one described at:
https://bugs.launchpad.net/ubuntu/+source/samba/+bug/2003867

Cheers,

  -- Santiago
#!/bin/sh -x
#
# Test to check regressions such as:
# https://bugs.launchpad.net/ubuntu/+source/samba/+bug/2003867

username="smbtest$$"
password="$$"

cat >> /etc/samba/smb.conf <<EOFEOF
include = /etc/samba/%U.conf
EOFEOF

cat >> /etc/samba/${username}.conf <<EOFEOF
[smbtest]
    browseable = yes
    writeable = yes
    guest ok = no
    path =  /home/%U/
EOFEOF

systemctl reload smbd.service

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}
userhome=$(eval echo ~$username)
echo "Creating file with random data and computing its md5"
dd if=/dev/urandom bs=1 count=128 2>/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

Attachment: signature.asc
Description: PGP signature

Reply via email to