Re: cryptsetup luksOpen return code with failed passphrase - redux for FC5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/06/2006 Marc Schwartz wrote:
> Hi all,
> 
> I know that this has been reported here for Debian (last month by Dick 
> Middleton), but wanted to give a heads up to those running on FC5, which 
> I now am.
> 
> The current RPM on FC5 is:
> 
>   cryptsetup-luks-1.0.3-0.rc2
> 
> 
> The return code for the function is fixed at 0, which will cause 
> problems when testing for a bad passphrase, such as for those using the 
> 'luksopen' script from the wiki.

we have a patch for fixing that in debian. i attached it.
the patch is against cryptsetup-luks 1.0.3.

...
 jonas
--- cryptsetup-1.0.3.orig/src/cryptsetup.c	2006-04-02 10:18:42.000000000 +0200
+++ cryptsetup-1.0.3/src/cryptsetup.c	2006-05-12 01:01:55.000000000 +0200
@@ -165,27 +165,29 @@
 	int r;
 
 	r = crypt_query_device(&options);
+	
 	if (r < 0) {
+		/* error */
 		show_status(-r);
-		return r;
-	}
-	if (r == 0) {
+	} else if (r == 0) {
+		/* inactive */
 		printf("%s/%s is inactive.\n", crypt_get_dir(), options.name);
-		return r;
+		r = 1;
+	} else {
+		/* active */
+		printf("%s/%s is active:\n", crypt_get_dir(), options.name);
+		printf("  cipher:  %s\n", options.cipher);
+		printf("  keysize: %d bits\n", options.key_size * 8);
+		printf("  device:  %s\n", options.device);
+		printf("  offset:  %" PRIu64 " sectors\n", options.offset);
+		printf("  size:    %" PRIu64 " sectors\n", options.size);
+		if (options.skip)
+			printf("  skipped: %" PRIu64 " sectors\n", options.skip);
+		printf("  mode:    %s\n", (options.flags & CRYPT_FLAG_READONLY)
+		                           ? "readonly" : "read/write");
+		crypt_put_options(&options);
+		r = 0;
 	}
-
-	printf("%s/%s is active:\n", crypt_get_dir(), options.name);
-	printf("  cipher:  %s\n", options.cipher);
-	printf("  keysize: %d bits\n", options.key_size * 8);
-	printf("  device:  %s\n", options.device);
-	printf("  offset:  %" PRIu64 " sectors\n", options.offset);
-	printf("  size:    %" PRIu64 " sectors\n", options.size);
-	if (options.skip)
-		printf("  skipped: %" PRIu64 " sectors\n", options.skip);
-	printf("  mode:    %s\n", (options.flags & CRYPT_FLAG_READONLY)
-	                           ? "readonly" : "read/write");
-
-	crypt_put_options(&options);
 	return r;
 }
 

---------------------------------------------------------------------
 - http://www.saout.de/misc/dm-crypt/
To unsubscribe, e-mail: dm-crypt-unsubscribe@xxxxxxxx
For additional commands, e-mail: dm-crypt-help@xxxxxxxx

[Index of Archives]     [Device Mapper Devel]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux