~ubuntu-branches/ubuntu/trusty/ecryptfs-utils/trusty-security

« back to all changes in this revision

Viewing changes to tests/kernel/lp-872905.sh

  • Committer: Package Import Robot
  • Author(s): Dustin Kirkland, Eric Lammerts, Tyler Hicks, Colin King, Dustin Kirkland
  • Date: 2012-10-25 16:13:28 UTC
  • mfrom: (1.1.46) (43.1.1 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20121025161328-wb9k7d5h8xiur2hv
[ Eric Lammerts ]
* src/libecryptfs/sysfs.c: LP: #1007880
  - Handle NULL mnt pointer when sysfs is not mounted

[ Tyler Hicks ]
* src/utils/ecryptfs-migrate-home: LP: #1026180
  - Correct minor misspelling
* src/utils/ecryptfs-recover-private: LP: #1004082
  - Fix option parsing when --rw is specified
* src/utils/ecryptfs-recover-private: LP: #1028923
  - Simplify success message to prevent incorrectly reporting that a
    read-only mount was performed when the --rw option is specified
* tests/lib/etl_func.sh:
  - Add test library function to return a lower path from an upper path,
    based on inode numbers
* tests/kernel/mmap-close.sh, tests/kernel/mmap-close/test.c:
  - Add regression test for open->mmap()->close()->dirty memory->munmap()
    pattern
* tests/kernel/lp-561129.sh:
  - Add test for checking that a pre-existing target inode is properly
    evicted after a rename
* tests/README:
  - Add documentation on the steps to take when adding new test cases

[ Colin King ]
* tests/kernel/lp-911507.sh:
  - Add test case for initializing empty lower files during open()
* tests/kernel/lp-872905.sh:
  - Add test case to check for proper unlinking of lower files when
    lower file initialization fails
* src/key_mod/ecryptfs_key_mod_openssl.c,
  src/key_mod/ecryptfs_key_mod_pkcs11_helper.c,
  src/libecryptfs/key_management.c,
  src/utils/mount.ecryptfs_private.c, src/utils/umount.ecryptfs.c:
  - address some issues raised by smatch static analysis
  - fix some memory leaks with frees
  - fix some pointer refs and derefs
  - fix some comment typos

[ Dustin Kirkland ]
* src/libecryptfs/key_management.c:
  - silence pam error message when errno == EACCES
    + "Error attempting to parse .ecryptfsrc file; rc = [-13]"
* src/utils/mount.ecryptfs_private.c: LP: #1052038
  - fix race condition, which typically manifests itself with a user
    saying that their home directory is not accessible, or that their
    filenames are not decrypted
  - the root of the problem is that we were reading the signature file,
    ~/.ecryptfs/Private.sig, twice; in some cases, the first one succeeds,
    so the file encryption signature is read and key is loaded, but then
    some other process (usually from PAM, perhaps a cron job or a
    subsequent login) mounts the home directory before the filename
    encryption key is loaded;  thus, $HOME is mounted but filenames are
    not decrypted, so the second read of ~/.ecryptfs/Private.sig fails
    as that file is not found
  - the solution is to rework the internal fetch_sig() function and read
    one or both signatures within a single open/read/close operation of
    the file
  - free memory used by char **sig on failure
* debian/copyright:
  - fix lintian warning
* precise

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
#
 
3
# lp-872905: Test for https://launchpad.net/bugs/872905
 
4
# Author: Colin Ian King <colin.king@canonical.com>
 
5
#
 
6
# Copyright (C) 2012 Canonical, Ltd.
 
7
#
 
8
# This program is free software; you can redistribute it and/or
 
9
# modify it under the terms of the GNU General Public License
 
10
# as published by the Free Software Foundation; either version 2
 
11
# of the License, or (at your option) any later version.
 
12
#
 
13
# This program is distributed in the hope that it will be useful,
 
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
# GNU General Public License for more details.
 
17
#
 
18
# You should have received a copy of the GNU General Public License
 
19
# along with this program; if not, write to the Free Software
 
20
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 
21
 
 
22
test_script_dir=$(dirname $0)
 
23
rc=1
 
24
test_dir=""
 
25
 
 
26
. ${test_script_dir}/../lib/etl_funcs.sh
 
27
 
 
28
test_cleanup()
 
29
{
 
30
        etl_remove_test_dir $test_dir
 
31
        etl_umount
 
32
        etl_lumount
 
33
        etl_unlink_keys
 
34
        exit $rc
 
35
}
 
36
trap test_cleanup 0 1 2 3 15
 
37
 
 
38
etl_add_keys || exit
 
39
etl_lmount || exit
 
40
etl_mount_i || exit
 
41
test_dir=$(etl_create_test_dir `basename $0`) || exit
 
42
test_file="${test_dir}/test_file"
 
43
 
 
44
lower_test_dir=$(etl_find_lower_path $test_dir)
 
45
if [ $? -ne 0 ]; then
 
46
        exit
 
47
fi
 
48
 
 
49
#
 
50
# Fill the lower
 
51
#
 
52
dd if=/dev/zero of=${lower_test_dir}/filler bs=4K > /dev/null 2>&1
 
53
 
 
54
#
 
55
# Now attempt to create an upper and see how big it is
 
56
#
 
57
touch $test_file >& /dev/null
 
58
if [ $? -ne 0 ]; then
 
59
        rc=0
 
60
        exit
 
61
fi
 
62
 
 
63
lower_test_file=$(etl_find_lower_path $test_file)
 
64
if [ $? -ne 0 ]; then
 
65
        exit
 
66
fi
 
67
 
 
68
#
 
69
# We shouldn't have a lower file created of zero bytes size if
 
70
# the bug is fixed
 
71
 
72
sz=$(stat -c%s $lower_test_file)
 
73
if [ $sz -ne 0 ]; then
 
74
        rc=0
 
75
fi
 
76
 
 
77
exit