mirror of
https://github.com/atmoz/sftp.git
synced 2024-12-01 13:00:56 -05:00
Merge branch 'master' into debian-jessie
This commit is contained in:
commit
662bc14ece
2 changed files with 14 additions and 11 deletions
|
@ -36,21 +36,21 @@ skipIndex=0
|
||||||
chpasswdOptions=""
|
chpasswdOptions=""
|
||||||
useraddOptions=(--no-user-group)
|
useraddOptions=(--no-user-group)
|
||||||
|
|
||||||
user="${args[0]}"; validateArg "username" "$user" "$reUser" || return 1
|
user="${args[0]}"; validateArg "username" "$user" "$reUser" || exit 1
|
||||||
pass="${args[1]}"; validateArg "password" "$pass" "$rePass" || return 1
|
pass="${args[1]}"; validateArg "password" "$pass" "$rePass" || exit 1
|
||||||
|
|
||||||
if [ "${args[2]}" == "e" ]; then
|
if [ "${args[2]}" == "e" ]; then
|
||||||
chpasswdOptions="-e"
|
chpasswdOptions="-e"
|
||||||
skipIndex=1
|
skipIndex=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
uid="${args[$((skipIndex+2))]}"; validateArg "UID" "$uid" "$reUid" || return 1
|
uid="${args[$((skipIndex+2))]}"; validateArg "UID" "$uid" "$reUid" || exit 1
|
||||||
gid="${args[$((skipIndex+3))]}"; validateArg "GID" "$gid" "$reGid" || return 1
|
gid="${args[$((skipIndex+3))]}"; validateArg "GID" "$gid" "$reGid" || exit 1
|
||||||
dir="${args[$((skipIndex+4))]}"; validateArg "dirs" "$dir" "$reDir" || return 1
|
dir="${args[$((skipIndex+4))]}"; validateArg "dirs" "$dir" "$reDir" || exit 1
|
||||||
|
|
||||||
if getent passwd "$user" > /dev/null; then
|
if getent passwd "$user" > /dev/null; then
|
||||||
log "WARNING: User \"$user\" already exists. Skipping."
|
log "WARNING: User \"$user\" already exists. Skipping."
|
||||||
return 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$uid" ]; then
|
if [ -n "$uid" ]; then
|
||||||
|
|
13
tests/run
13
tests/run
|
@ -253,22 +253,25 @@ function testCreateUsersUsingCombo() {
|
||||||
function testWriteAccessToAutocreatedDirs() {
|
function testWriteAccessToAutocreatedDirs() {
|
||||||
docker run --name "$containerName" -d \
|
docker run --name "$containerName" -d \
|
||||||
-v "/tmp/atmoz_sftp_test_rsa.pub":/home/test/.ssh/keys/id_rsa.pub:ro \
|
-v "/tmp/atmoz_sftp_test_rsa.pub":/home/test/.ssh/keys/id_rsa.pub:ro \
|
||||||
"$imageName" test::::dir1,dir2 \
|
"$imageName" "test::::testdir,dir with spaces" \
|
||||||
> "$redirect" 2>&1
|
> "$redirect" 2>&1
|
||||||
|
|
||||||
waitForServer "$containerName"
|
waitForServer "$containerName"
|
||||||
assertTrue "waitForServer" $?
|
assertTrue "waitForServer" $?
|
||||||
|
|
||||||
runSftpCommands "$containerName" "test" \
|
runSftpCommands "$containerName" "test" \
|
||||||
"cd dir1" \
|
"cd testdir" \
|
||||||
"mkdir test" \
|
"mkdir test" \
|
||||||
"cd ../dir2" \
|
"cd '../dir with spaces'" \
|
||||||
"mkdir test" \
|
"mkdir test" \
|
||||||
"exit"
|
"exit"
|
||||||
assertTrue "runSftpCommands" $?
|
assertTrue "runSftpCommands" $?
|
||||||
|
|
||||||
docker exec "$containerName" test -d /home/test/dir1/test -a -d /home/test/dir2/test
|
docker exec "$containerName" test -d /home/test/testdir/test
|
||||||
assertTrue "dirs exists" $?
|
assertTrue "testdir write access" $?
|
||||||
|
|
||||||
|
docker exec "$containerName" test -d "/home/test/dir with spaces/test"
|
||||||
|
assertTrue "dir with spaces write access" $?
|
||||||
}
|
}
|
||||||
|
|
||||||
function testBindmountDirScript() {
|
function testBindmountDirScript() {
|
||||||
|
|
Loading…
Reference in a new issue