File: smoke

package info (click to toggle)
vsftpd 3.0.3-13
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 2,628 kB
  • sloc: ansic: 16,636; sh: 267; makefile: 51; python: 18
file content (45 lines) | stat: -rw-r--r-- 1,143 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
set -ex

# Simple smoke test for vsftpd. Tests get and put functionality.
# Author: Robie Basak <robie.basak@canonical.com>
# dep8 restrictions: breaks-bestbed needs-root allow-stderr

# Written in response to https://launchpad.net/bugs/1219857
# This passed on LXC, affecting qemu only. So it is advisable to test both.

# Enable writes, to test both get and put
sed -i 's/^#\(write_enable=YES\)$/\1/' /etc/vsftpd.conf
service vsftpd reload

# Create test user
adduser --disabled-password --gecos '' ftptest
echo ftptest:dep8|chpasswd ftptest

# Set up .netrc so that the ftp client can login in automatically
> ~ftptest/.netrc
chown ftptest: ~ftptest/.netrc
chmod 600 ~ftptest/.netrc
cat > ~ftptest/.netrc <<EOT
machine localhost
login ftptest
password dep8
EOT

# Test get and put

mkdir ~ftptest/local ~ftptest/remote
echo "Hello, world! 1." > ~ftptest/local/put
echo "Hello, world! 2." > ~ftptest/remote/get
chown -R ftptest: ~ftptest/local ~ftptest/remote

su -c 'ftp localhost' - ftptest <<EOT
lcd local
cd remote
get get
put put
quit
EOT

cmp ~ftptest/local/put ~ftptest/remote/put
cmp ~ftptest/local/get ~ftptest/remote/get