[ecryptfs-utils/f16] for file name encryption support check, module must be loaded already

Michal Hlavinka mhlavink at fedoraproject.org
Mon Jun 4 13:54:45 UTC 2012


commit df42ac8deecb5c17570cb28a71821fc136e75b3f
Author: Michal Hlavinka <mhlavink at redhat.com>
Date:   Mon Jun 4 15:54:41 2012 +0200

    for file name encryption support check, module must be loaded already

 ecryptfs-utils-75-werror.patch |   83 +++++++++++++++++++++++++++++++++-------
 ecryptfs-utils.spec            |   11 +++++-
 2 files changed, 79 insertions(+), 15 deletions(-)
---
diff --git a/ecryptfs-utils-75-werror.patch b/ecryptfs-utils-75-werror.patch
index a76a825..aee3690 100644
--- a/ecryptfs-utils-75-werror.patch
+++ b/ecryptfs-utils-75-werror.patch
@@ -1,6 +1,6 @@
 diff -up ecryptfs-utils-96/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c.werror ecryptfs-utils-96/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c
---- ecryptfs-utils-96/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c.werror	2012-02-21 14:42:39.625960362 +0100
-+++ ecryptfs-utils-96/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c	2012-02-21 14:42:39.640960446 +0100
+--- ecryptfs-utils-96/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c.werror	2012-06-04 14:47:13.021862738 +0200
++++ ecryptfs-utils-96/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c	2012-06-04 14:47:13.036862853 +0200
 @@ -86,7 +86,7 @@ static int ecryptfs_pkcs11h_deserialize(
  		pkcs11h_data->serialized_id = NULL;
  	}
@@ -152,7 +152,7 @@ diff -up ecryptfs-utils-96/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c.werror e
  
 diff -up ecryptfs-utils-96/src/libecryptfs/ecryptfs-stat.c.werror ecryptfs-utils-96/src/libecryptfs/ecryptfs-stat.c
 --- ecryptfs-utils-96/src/libecryptfs/ecryptfs-stat.c.werror	2011-12-14 00:01:38.000000000 +0100
-+++ ecryptfs-utils-96/src/libecryptfs/ecryptfs-stat.c	2012-02-21 14:42:39.640960446 +0100
++++ ecryptfs-utils-96/src/libecryptfs/ecryptfs-stat.c	2012-06-04 14:47:13.036862853 +0200
 @@ -146,7 +146,7 @@ int ecryptfs_parse_stat(struct ecryptfs_
  	if (buf_size < (ECRYPTFS_FILE_SIZE_BYTES
  			+ MAGIC_ECRYPTFS_MARKER_SIZE_BYTES
@@ -164,7 +164,7 @@ diff -up ecryptfs-utils-96/src/libecryptfs/ecryptfs-stat.c.werror ecryptfs-utils
  			+ MAGIC_ECRYPTFS_MARKER_SIZE_BYTES
 diff -up ecryptfs-utils-96/src/pam_ecryptfs/pam_ecryptfs.c.werror ecryptfs-utils-96/src/pam_ecryptfs/pam_ecryptfs.c
 --- ecryptfs-utils-96/src/pam_ecryptfs/pam_ecryptfs.c.werror	2011-12-14 00:01:38.000000000 +0100
-+++ ecryptfs-utils-96/src/pam_ecryptfs/pam_ecryptfs.c	2012-02-21 14:42:39.640960446 +0100
++++ ecryptfs-utils-96/src/pam_ecryptfs/pam_ecryptfs.c	2012-06-04 14:47:13.036862853 +0200
 @@ -39,35 +39,11 @@
  #include <sys/stat.h>
  #include <fcntl.h>
@@ -259,8 +259,8 @@ diff -up ecryptfs-utils-96/src/pam_ecryptfs/pam_ecryptfs.c.werror ecryptfs-utils
  	}
  	saved_uid = geteuid();
 diff -up ecryptfs-utils-96/src/utils/mount.ecryptfs.c.werror ecryptfs-utils-96/src/utils/mount.ecryptfs.c
---- ecryptfs-utils-96/src/utils/mount.ecryptfs.c.werror	2012-02-21 14:42:39.637960431 +0100
-+++ ecryptfs-utils-96/src/utils/mount.ecryptfs.c	2012-02-21 14:42:39.641960452 +0100
+--- ecryptfs-utils-96/src/utils/mount.ecryptfs.c.werror	2012-06-04 14:47:13.033862831 +0200
++++ ecryptfs-utils-96/src/utils/mount.ecryptfs.c	2012-06-04 14:47:13.037862861 +0200
 @@ -461,7 +461,7 @@ static int ecryptfs_do_mount(int argc, c
  {
  	int rc;
@@ -280,8 +280,8 @@ diff -up ecryptfs-utils-96/src/utils/mount.ecryptfs.c.werror ecryptfs-utils-96/s
  		rc = -ENOMEM;
  		goto out;
 diff -up ecryptfs-utils-96/src/utils/mount.ecryptfs_private.c.werror ecryptfs-utils-96/src/utils/mount.ecryptfs_private.c
---- ecryptfs-utils-96/src/utils/mount.ecryptfs_private.c.werror	2012-02-21 14:42:39.630960389 +0100
-+++ ecryptfs-utils-96/src/utils/mount.ecryptfs_private.c	2012-02-21 14:42:39.641960452 +0100
+--- ecryptfs-utils-96/src/utils/mount.ecryptfs_private.c.werror	2012-06-04 14:47:13.027862783 +0200
++++ ecryptfs-utils-96/src/utils/mount.ecryptfs_private.c	2012-06-04 14:47:13.037862861 +0200
 @@ -95,7 +95,6 @@ int read_config(char *pw_dir, int uid, c
  	*s = strdup(e->mnt_fsname);
  	if (!*s)
@@ -301,7 +301,7 @@ diff -up ecryptfs-utils-96/src/utils/mount.ecryptfs_private.c.werror ecryptfs-ut
  			goto fail;
 diff -up ecryptfs-utils-96/src/utils/test.c.werror ecryptfs-utils-96/src/utils/test.c
 --- ecryptfs-utils-96/src/utils/test.c.werror	2011-12-14 00:01:38.000000000 +0100
-+++ ecryptfs-utils-96/src/utils/test.c	2012-02-21 14:42:39.642960459 +0100
++++ ecryptfs-utils-96/src/utils/test.c	2012-06-04 14:47:13.038862869 +0200
 @@ -281,7 +281,7 @@ int ecryptfs_encrypt_page(int page_cache
  	struct inode *lower_inode;
  	struct ecryptfs_crypt_stat *crypt_stat;
@@ -313,7 +313,7 @@ diff -up ecryptfs-utils-96/src/utils/test.c.werror ecryptfs-utils-96/src/utils/t
  #define ECRYPTFS_PAGE_STATE_UNREAD    0
 diff -up ecryptfs-utils-96/tests/kernel/directory-concurrent/test.c.werror ecryptfs-utils-96/tests/kernel/directory-concurrent/test.c
 --- ecryptfs-utils-96/tests/kernel/directory-concurrent/test.c.werror	2012-02-13 17:30:32.000000000 +0100
-+++ ecryptfs-utils-96/tests/kernel/directory-concurrent/test.c	2012-02-21 14:42:39.642960459 +0100
++++ ecryptfs-utils-96/tests/kernel/directory-concurrent/test.c	2012-06-04 14:47:13.038862869 +0200
 @@ -149,7 +149,7 @@ int hang_check(int option, const char *f
  
  int test_dirs(const char *path, const int max_dirs)
@@ -323,9 +323,37 @@ diff -up ecryptfs-utils-96/tests/kernel/directory-concurrent/test.c.werror ecryp
  	char *filename;
  	size_t len = strlen(path) + 32;
  	int ret = TEST_PASSED;
+diff -up ecryptfs-utils-96/tests/kernel/extend-file-random/test.c.werror ecryptfs-utils-96/tests/kernel/extend-file-random/test.c
+--- ecryptfs-utils-96/tests/kernel/extend-file-random/test.c.werror	2012-02-13 17:30:32.000000000 +0100
++++ ecryptfs-utils-96/tests/kernel/extend-file-random/test.c	2012-06-04 14:48:48.034597731 +0200
+@@ -48,7 +48,7 @@ int test_write(int fd, char *buffer, siz
+ 	}
+ 
+ 	if (write(fd, buffer, len) != len) {
+-		fprintf(stderr, "Failed to write %lu bytes, position %lu: %s\n", 
++		fprintf(stderr, "Failed to write %zu bytes, position %lu: %s\n", 
+ 			len, offset, strerror(errno));
+ 		return TEST_FAILED;
+ 	}
+@@ -58,13 +58,13 @@ int test_write(int fd, char *buffer, siz
+ int test_read(int fd, char *buffer, size_t len, off_t offset)
+ {
+ 	if (lseek(fd, offset, SEEK_SET) < 0) {
+-		fprintf(stderr, "Failed to seek to position %lu: %s\n", 
++		fprintf(stderr, "Failed to seek to position %ld: %s\n", 
+ 			offset, strerror(errno));
+ 		return TEST_FAILED;
+ 	}
+ 
+ 	if (read(fd, buffer, len) != len) {
+-		fprintf(stderr, "Failed to read %lu bytes, position %lu: %s\n", 
++		fprintf(stderr, "Failed to read %zu bytes, position %lu: %s\n", 
+ 			len, offset, strerror(errno));
+ 		return TEST_FAILED;
+ 	}
 diff -up ecryptfs-utils-96/tests/kernel/file-concurrent/test.c.werror ecryptfs-utils-96/tests/kernel/file-concurrent/test.c
 --- ecryptfs-utils-96/tests/kernel/file-concurrent/test.c.werror	2012-02-13 17:30:32.000000000 +0100
-+++ ecryptfs-utils-96/tests/kernel/file-concurrent/test.c	2012-02-21 14:42:39.642960459 +0100
++++ ecryptfs-utils-96/tests/kernel/file-concurrent/test.c	2012-06-04 14:47:13.038862869 +0200
 @@ -178,7 +178,7 @@ int hang_check(int option, const char *f
  
  int test_dirs(const char *path, const int max_files)
@@ -336,8 +364,8 @@ diff -up ecryptfs-utils-96/tests/kernel/file-concurrent/test.c.werror ecryptfs-u
  	size_t len = strlen(path) + 32;
  	int ret = TEST_PASSED;
 diff -up ecryptfs-utils-96/tests/kernel/inode-race-stat/test.c.werror ecryptfs-utils-96/tests/kernel/inode-race-stat/test.c
---- ecryptfs-utils-96/tests/kernel/inode-race-stat/test.c.werror	2012-02-21 14:43:30.646252841 +0100
-+++ ecryptfs-utils-96/tests/kernel/inode-race-stat/test.c	2012-02-21 14:44:11.720488580 +0100
+--- ecryptfs-utils-96/tests/kernel/inode-race-stat/test.c.werror	2012-02-16 03:56:20.000000000 +0100
++++ ecryptfs-utils-96/tests/kernel/inode-race-stat/test.c	2012-06-04 14:47:13.040862885 +0200
 @@ -106,7 +106,6 @@ static void do_test(const int fdin, cons
  {
  	for (;;) {
@@ -346,6 +374,24 @@ diff -up ecryptfs-utils-96/tests/kernel/inode-race-stat/test.c.werror ecryptfs-u
  		char cmd[32];
  
  		if ((n = read(fdin, cmd, sizeof(cmd))) < 1) {
+@@ -122,7 +121,7 @@ static void do_test(const int fdin, cons
+ 		if (cmd[0] == CMD_TEST) {
+ 			int ret;
+ 			off_t sz;
+-			sscanf(cmd+1, "%zd", &sz);
++			sscanf(cmd+1, "%ld", &sz);
+ 
+ 			ret = check_size(filename, sz);
+ 			switch (ret) {
+@@ -290,7 +289,7 @@ int main(int argc, char **argv)
+ 		}
+ 
+ 		/* Now tell children to stat the file */
+-		snprintf(cmd, sizeof(cmd), "%c%zd", CMD_TEST, sz);
++		snprintf(cmd, sizeof(cmd), "%c%ld", CMD_TEST, sz);
+ 		for (i = 0; i < threads; i++) {
+ 			if (write(pipe_to[i][1], cmd, strlen(cmd)+1) < 0) {
+ 				fprintf(stderr, "write to pipe failed: %s\n",
 @@ -347,6 +346,7 @@ abort:
  		int ret;
  
@@ -356,7 +402,7 @@ diff -up ecryptfs-utils-96/tests/kernel/inode-race-stat/test.c.werror ecryptfs-u
  		(void)close(pipe_to[i][1]);
 diff -up ecryptfs-utils-96/tests/kernel/trunc-file/test.c.werror ecryptfs-utils-96/tests/kernel/trunc-file/test.c
 --- ecryptfs-utils-96/tests/kernel/trunc-file/test.c.werror	2012-02-13 17:30:32.000000000 +0100
-+++ ecryptfs-utils-96/tests/kernel/trunc-file/test.c	2012-02-21 14:42:39.643960466 +0100
++++ ecryptfs-utils-96/tests/kernel/trunc-file/test.c	2012-06-04 14:47:13.040862885 +0200
 @@ -39,7 +39,7 @@
  
  int write_buff(int fd, unsigned char *data, ssize_t size)
@@ -402,3 +448,12 @@ diff -up ecryptfs-utils-96/tests/kernel/trunc-file/test.c.werror ecryptfs-utils-
  
  	if (argc < 2) {
  		fprintf(stderr, "Syntax: %s filename [size_in_K]\n", argv[0]);
+@@ -272,7 +268,7 @@ int main(int argc, char **argv)
+ 
+ 	len *= 1024;
+ 	if (len > SSIZE_MAX) {
+-		fprintf(stderr, "size should be < %zd\n", SSIZE_MAX / 1024);
++		fprintf(stderr, "size should be < %zd\n", (size_t)SSIZE_MAX / 1024);
+ 		exit(TEST_ERROR);
+ 	}
+ 
diff --git a/ecryptfs-utils.spec b/ecryptfs-utils.spec
index bb7f716..4caf9de 100644
--- a/ecryptfs-utils.spec
+++ b/ecryptfs-utils.spec
@@ -5,7 +5,7 @@
 
 Name: ecryptfs-utils
 Version: 96
-Release: 2%{?dist}
+Release: 3%{?dist}
 Summary: The eCryptfs mount helper and support libraries
 Group: System Environment/Base
 License: GPLv2+
@@ -156,6 +156,10 @@ touch -r src/desktop/ecryptfs-setup-private.desktop \
      $RPM_BUILD_ROOT%{_datadir}/%{name}/ecryptfs-mount-private.desktop
 rm -f $RPM_BUILD_ROOT/%{_datadir}/%{name}/ecryptfs-record-passphrase
 
+#we need ecryptfs kernel module
+mkdir -p $RPM_BUILD_ROOT/usr/lib/modules-load.d/
+echo -e "# ecryptfs module is needed before ecryptfs mount, so mount helper can \n# check for file name encryption support\necryptfs" >$RPM_BUILD_ROOT/usr/lib/modules-load.d/ecryptfs.conf
+
 %find_lang %{name}
 
 %check
@@ -163,6 +167,7 @@ if ldd $RPM_BUILD_ROOT%{_sbindir}/umount.ecryptfs | grep -q '/usr/'
 then
   exit 1
 fi
+export LD_LIBRARY_PATH=$(pwd)/src/libecryptfs/.libs
 make check
 
 %pre
@@ -204,6 +209,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/ecryptfs
 %{_libdir}/libecryptfs.so.*
 %{_libdir}/security/pam_ecryptfs.so
+/usr/lib/modules-load.d/ecryptfs.conf
 %dir %{_datadir}/%{name}
 %{_datadir}/%{name}/ecryptfs-mount-private.txt
 %{_datadir}/%{name}/ecryptfs-mount-private.desktop
@@ -250,6 +256,9 @@ rm -rf $RPM_BUILD_ROOT
 %{python_sitearch}/ecryptfs-utils/_libecryptfs.so
 
 %changelog
+* Mon Jun 04 2012 Michal Hlavinka <mhlavink at redhat.com> - 96-3
+- for file name encryption support check, module must be loaded already
+
 * Mon Apr 16 2012 Michal Hlavinka <mhlavink at redhat.com> - 96-2
 - when ecryptfs-mount-fails, check if user is member of ecryptfs group
 


More information about the scm-commits mailing list