Re: [PATCH] print warning when adding a key that contains non-ASCII characters

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

 



On Thu, Oct 22, 2009 at 04:16:08PM +0200, Ludwig Nussel wrote:
> Hi,
> 
> There's no way to determine whether e.g. the keymap on the console is
> the same as in X. Ie a key with umlauts added in an xterm may not be
> usable during boot. So when using e.g. an encrypted root partition
> users could lock themselves out. So I wonder whether a patch like
> the following would be acceptable?
> 

Hmm.. at least rhel5/centos5 version of cryptsetup fails to use
multiline keyfiles.. wondering if this also affects those? 

ie. if the keyfile has multiple lines, it'll only use the first line
(until newline).

-- Pasi

> cu
> Ludwig
> 
> ---
>  lib/utils.c |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/lib/utils.c b/lib/utils.c
> index d23619e..df9c9a5 100644
> --- a/lib/utils.c
> +++ b/lib/utils.c
> @@ -3,6 +3,7 @@
>  #include <stdlib.h>
>  #include <stddef.h>
>  #include <stdarg.h>
> +#include <ctype.h>
>  #include <errno.h>
>  #include <linux/fs.h>
>  #include <sys/types.h>
> @@ -378,6 +379,20 @@ out_err:
>  	return failed;
>  }
>  
> +static void warnifnotascii(struct crypt_device *ctx, const char *str)
> +{
> +	for(;*str; ++str) {
> +		if(!isascii(*str)) {
> +			log_std(ctx,
> +				"* Warning: Entering non-ASCII passwords\n"
> +				"* may not be possible on all systems.\n"
> +				"* Make sure you can unlock the volume in\n"
> +				"* the intended environment!\n");
> +			break;
> +		}
> +	}
> +}
> +
>  /*
>   * Password reading behaviour matrix of get_key
>   * 
> @@ -443,6 +458,7 @@ void get_key(char *prompt, char **key, unsigned int *passLen, int key_size,
>  				goto out_err;
>  			}
>  			memset(pass_verify, 0, sizeof(pass_verify));
> +			warnifnotascii(cd, pass);
>  		}
>  		*passLen = strlen(pass);
>  		*key = pass;
> -- 
> 1.6.4.2
> 
> _______________________________________________
> dm-crypt mailing list
> dm-crypt@xxxxxxxx
> http://www.saout.de/mailman/listinfo/dm-crypt
_______________________________________________
dm-crypt mailing list
dm-crypt@xxxxxxxx
http://www.saout.de/mailman/listinfo/dm-crypt

[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