rpms/cryptsetup-luks/devel cryptsetup-descriptive-errors.patch, NONE, 1.1 cryptsetup-detect-dm.patch, NONE, 1.1 cryptsetup-luks.spec, 1.61, 1.62 cryptsetup-remove-udev.patch, 1.1, 1.2

Milan Broz mbroz at fedoraproject.org
Tue Sep 23 15:09:17 UTC 2008


Author: mbroz

Update of /cvs/pkgs/rpms/cryptsetup-luks/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv3465

Modified Files:
	cryptsetup-luks.spec cryptsetup-remove-udev.patch 
Added Files:
	cryptsetup-descriptive-errors.patch cryptsetup-detect-dm.patch 
Log Message:
- Change new project home page.
- Print more descriptive messages for initialization errors.
- Refresh patches to versions commited upstream.



cryptsetup-descriptive-errors.patch:

--- NEW FILE cryptsetup-descriptive-errors.patch ---
Do not replace error message for IO or format errors.

--- cryptsetup-1.0.6.old/lib/setup.c	2008-09-23 15:18:25.000000000 +0200
+++ cryptsetup-1.0.6/lib/setup.c	2008-09-23 15:25:45.000000000 +0200
@@ -484,13 +484,14 @@ start:
 	if(!password) {
 		r = -EINVAL; goto out;
 	}
-        
+
         r = LUKS_open_any_key(options->device, password, passwordLen, &hdr, &mk, backend);
-	if(r < 0) {
+	if (r == -EPERM)
 		set_error("No key available with this passphrase.\n");
+	if (r < 0)
 		goto out1;
-	} else
-                logger(options, CRYPT_LOG_NORMAL,"key slot %d unlocked.\n", r);
+
+	logger(options, CRYPT_LOG_NORMAL,"key slot %d unlocked.\n", r);
 
 	
 	options->offset = hdr.payloadOffset;

cryptsetup-detect-dm.patch:

--- NEW FILE cryptsetup-detect-dm.patch ---
Properly detect if device-mapper is loaded.

--- cryptsetup-1.0.6.old/lib/libdevmapper.c	2008-09-23 15:18:05.000000000 +0200
+++ cryptsetup-1.0.6/lib/libdevmapper.c	2008-09-23 15:18:25.000000000 +0200
@@ -32,9 +32,16 @@ static void set_dm_error(int level, cons
 	va_end(va);
 }
 
+static int _dm_simple(int task, const char *name);
+
 static int dm_init(void)
 {
 	dm_log_init(set_dm_error);
+	if (!_dm_simple(DM_DEVICE_LIST_VERSIONS, "test")) {
+		set_error("Cannot communicate with device-mapper. Is the dm_mod module loaded?");
+		return -1;
+	}
+
 	return 1;	/* unsafe memory */
 }
 
--- cryptsetup-1.0.6.old/lib/setup.c	2008-09-23 15:18:05.000000000 +0200
+++ cryptsetup-1.0.6/lib/setup.c	2008-09-23 15:18:25.000000000 +0200
@@ -695,7 +695,10 @@ static int crypt_job(int (*job)(int arg,
 
 	backend = get_setup_backend(default_backend);
 
-	setup_enter(backend,options->icb->log);
+	if (setup_enter(backend,options->icb->log) < 0) {
+		r = -ENOSYS;
+		goto out;
+	}
 
 	if (!backend) {
 		set_error("No setup backend available");


Index: cryptsetup-luks.spec
===================================================================
RCS file: /cvs/pkgs/rpms/cryptsetup-luks/devel/cryptsetup-luks.spec,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- cryptsetup-luks.spec	7 Sep 2008 08:54:51 -0000	1.61
+++ cryptsetup-luks.spec	23 Sep 2008 15:08:46 -0000	1.62
@@ -3,20 +3,20 @@
 Summary: A utility for setting up encrypted filesystems
 Name: cryptsetup-luks
 Version: 1.0.6
-Release: 4%{?devrelease:.%{devrelease}}%{?dist}
+Release: 5%{?devrelease:.%{devrelease}}%{?dist}
 License: GPLv2
 Group: Applications/System
-URL: http://luks.endorphin.org/
-Source: http://luks.endorphin.org/source/cryptsetup-%{version}%{?devrelease:-%{devrelease}}.tar.bz2
+URL: http://cryptsetup.googlecode.com/
+Source: http://cryptsetup.googlecode.com/files/cryptsetup-%{version}%{?devrelease:-%{devrelease}}.tar.bz2
 # 2008-04-15: sent to upstream via personal e-mail to Clemens Fruhwirth
 Patch0: cryptsetup-prompt.patch
 # 2008-05-28: sent to upstream via newsgroup:
 # http://permalink.gmane.org/gmane.linux.kernel.device-mapper.dm-crypt/2735
 Patch1: cryptsetup-luks-1.0.6-duplicate_sentence.patch
-# http://permalink.gmane.org/gmane.linux.kernel.device-mapper.dm-crypt/2803
 Patch2: cryptsetup-fix-fd.patch
-# http://permalink.gmane.org/gmane.linux.kernel.device-mapper.dm-crypt/2804
 Patch3: cryptsetup-remove-udev.patch
+Patch4: cryptsetup-detect-dm.patch
+Patch5: cryptsetup-descriptive-errors.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: libgcrypt-devel, popt-devel, device-mapper-devel
 BuildRequires: libgpg-error-devel, e2fsprogs-devel, libsepol-devel
@@ -48,6 +48,9 @@
 %patch1 -p1 -b .duplicate_sentence
 %patch2 -p1 -b .fd
 %patch3 -p1 -b .udev
+%patch4 -p1 -b .dm
+%patch5 -p1 -b .errors
+
 iconv -f latin1 -t utf8 ChangeLog > ChangeLog.new
 mv -f ChangeLog.new ChangeLog 
 
@@ -92,6 +95,11 @@
 
 
 %changelog
+* Sat Sep 23 2008 Milan Broz <mbroz at redhat.com> - 1.0.6-5
+- Change new project home page.
+- Print more descriptive messages for initialization errors.
+- Refresh patches to versions commited upstream.
+
 * Sat Sep 06 2008 Milan Broz <mbroz at redhat.com> - 1.0.6-4
 - Fix close of zero decriptor.
 - Fix udevsettle delays - use temporary crypt device remapping.

cryptsetup-remove-udev.patch:

Index: cryptsetup-remove-udev.patch
===================================================================
RCS file: /cvs/pkgs/rpms/cryptsetup-luks/devel/cryptsetup-remove-udev.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- cryptsetup-remove-udev.patch	7 Sep 2008 08:54:51 -0000	1.1
+++ cryptsetup-remove-udev.patch	23 Sep 2008 15:08:46 -0000	1.2
@@ -1,7 +1,7 @@
 Replace udevsettle with remmaping to error target.
 
 --- cryptsetup-1.0.6.old/lib/internal.h	2007-10-25 09:11:19.000000000 +0200
-+++ cryptsetup-1.0.6/lib/internal.h	2008-09-06 14:27:41.000000000 +0200
++++ cryptsetup-1.0.6/lib/internal.h	2008-09-23 15:15:19.000000000 +0200
 @@ -40,7 +40,7 @@ struct setup_backend {
  			          const char *key);
  	int		(*status)(int details, struct crypt_options *options,
@@ -12,7 +12,7 @@
  	const char *	(*dir)(void);
  };
 --- cryptsetup-1.0.6.old/lib/libdevmapper.c	2007-10-25 09:11:19.000000000 +0200
-+++ cryptsetup-1.0.6/lib/libdevmapper.c	2008-09-06 14:28:56.000000000 +0200
++++ cryptsetup-1.0.6/lib/libdevmapper.c	2008-09-23 15:15:19.000000000 +0200
 @@ -17,13 +17,7 @@
  #define DEVICE_DIR	"/dev"
  
@@ -24,7 +24,7 @@
 -{
 -	system(UDEVSETTLE);
 -}
-+#define RETRY_COUNT	5
++#define	RETRY_COUNT	5
  
  static void set_dm_error(int level, const char *file, int line,
                           const char *f, ...)
@@ -200,8 +200,8 @@
  }
  
  
---- cryptsetup-1.0.6.old/lib/setup.c	2008-09-06 14:20:24.000000000 +0200
-+++ cryptsetup-1.0.6/lib/setup.c	2008-09-06 14:27:41.000000000 +0200
+--- cryptsetup-1.0.6.old/lib/setup.c	2008-09-23 15:14:34.000000000 +0200
++++ cryptsetup-1.0.6/lib/setup.c	2008-09-23 15:15:19.000000000 +0200
 @@ -369,7 +369,7 @@ static int __crypt_remove_device(int arg
  		return -EBUSY;
  	}
@@ -211,83 +211,79 @@
  }
  
  static int __crypt_luks_format(int arg, struct setup_backend *backend, struct crypt_options *options)
---- cryptsetup-1.0.6.old/luks/keyencryption.c	2008-09-06 14:24:21.000000000 +0200
-+++ cryptsetup-1.0.6/luks/keyencryption.c	2008-09-06 14:27:41.000000000 +0200
-@@ -50,10 +50,8 @@ static int setup_mapping(const char *cip
+--- cryptsetup-1.0.6.old/luks/keyencryption.c	2008-09-23 15:14:34.000000000 +0200
++++ cryptsetup-1.0.6/luks/keyencryption.c	2008-09-23 15:15:19.000000000 +0200
+@@ -45,6 +45,11 @@ static inline int round_up_modulo(int x,
+ 	return div_round_up(x, m) * m;
+ }
+ 
++static struct setup_backend *cleaner_backend=NULL;
++static const char *cleaner_name=NULL;
++static uint64_t cleaner_size = 0;
++static int devfd=-1;
++
+ static int setup_mapping(const char *cipher, const char *name, 
+ 			 const char *device, unsigned int payloadOffset,
  			 const char *key, size_t keyLength, 
- 			 unsigned int sector, size_t srcLength, 
+@@ -52,7 +57,7 @@ static int setup_mapping(const char *cip
  			 struct setup_backend *backend,
--			 int mode)
-+			 int mode, struct crypt_options *options)
+ 			 int mode)
  {
 -	struct crypt_options k;
--	struct crypt_options *options = &k;
++	struct crypt_options k = {0};
+ 	struct crypt_options *options = &k;
  	int device_sector_size = sector_size_for_device(device);
  	int r;
+@@ -66,6 +71,7 @@ static int setup_mapping(const char *cip
+ 		return -EINVAL;
+ 	}
+ 	options->size = round_up_modulo(srcLength,device_sector_size)/SECTOR_SIZE;
++	cleaner_size = options->size;
  
-@@ -87,16 +85,14 @@ static int setup_mapping(const char *cip
+ 	options->offset = sector;
+ 	options->cipher = cipher;
+@@ -87,25 +93,21 @@ static int setup_mapping(const char *cip
  	return r;
  }
  
 -static int clear_mapping(const char *name, struct setup_backend *backend)
-+static int clear_mapping(struct crypt_options *options, struct setup_backend *backend)
++static int clear_mapping(const char *name, uint64_t size, struct setup_backend *backend)
  {
 -	struct crypt_options options;
--	options.name=name;
++	struct crypt_options options = {0};
+ 	options.name=name;
 -	return backend->remove(&options);
-+	return backend->remove(1, options);
++	options.size = size;
++	return backend->remove(1, &options);
  }
  
- /* I miss closures in C! */
- static struct setup_backend *cleaner_backend=NULL;
+-/* I miss closures in C! */
+-static struct setup_backend *cleaner_backend=NULL;
 -static const char *cleaner_name=NULL; 
-+static struct crypt_options *cleaner_options = NULL;
- static int devfd=-1;
- 
+-static int devfd=-1;
+-
  static void sigint_handler(int sig)
-@@ -104,8 +100,8 @@ static void sigint_handler(int sig)
+ {
          if(devfd >= 0)
                  close(devfd);
          devfd = -1;
--        if(cleaner_backend && cleaner_name) 
+         if(cleaner_backend && cleaner_name) 
 -                clear_mapping(cleaner_name, cleaner_backend);
-+        if(cleaner_backend && cleaner_options)
-+                clear_mapping(cleaner_options, cleaner_backend);
++                clear_mapping(cleaner_name, cleaner_size, cleaner_backend);
          signal(SIGINT, SIG_DFL);
          kill(getpid(), SIGINT);
  }
-@@ -120,6 +116,7 @@ static int LUKS_endec_template(char *src
- 			       ssize_t (*func)(int, void *, size_t),
- 			       int mode)
- {
-+	struct crypt_options options = {0};
- 	char *name = NULL;
- 	char *fullpath = NULL;
- 	char *dmCipherSpec = NULL;
-@@ -138,10 +135,11 @@ static int LUKS_endec_template(char *src
-         }
- 	
- 	signal(SIGINT, sigint_handler);
--	cleaner_name = name;
-+	options.name = name;
-+	cleaner_options = &options;
- 	cleaner_backend = backend;
- 
--	r = setup_mapping(dmCipherSpec,name,device,hdr->payloadOffset,key,keyLength,sector,srcLength,backend,mode);
-+	r = setup_mapping(dmCipherSpec,name,device,hdr->payloadOffset,key,keyLength,sector,srcLength,backend,mode,&options);
- 	if(r < 0) {
- 		if(!get_error())
- 			set_error("Failed to setup dm-crypt key mapping.\nCheck kernel for support for the %s cipher spec and verify that %s contains at least %d sectors",
-@@ -163,10 +161,10 @@ static int LUKS_endec_template(char *src
+@@ -163,11 +165,12 @@ static int LUKS_endec_template(char *src
  	close(devfd);
  	devfd = -1;
   out2:
 -	clear_mapping(name,backend);
-+	clear_mapping(&options,backend);
++	clear_mapping(cleaner_name, cleaner_size, cleaner_backend);
   out1:
  	signal(SIGINT, SIG_DFL);
--	cleaner_name = NULL;
-+	cleaner_options = NULL;
+ 	cleaner_name = NULL;
  	cleaner_backend = NULL;
++	cleaner_size = 0;
  	free(dmCipherSpec);
  	free(fullpath); 
+ 	free(name); 




More information about the fedora-extras-commits mailing list