From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mail.saout.de (Postfix) with ESMTP for ; Thu, 22 Oct 2009 16:16:08 +0200 (CEST) Received: from relay1.suse.de (relay-ext.suse.de [195.135.221.8]) by mx2.suse.de (Postfix) with ESMTP id 3A56986391 for ; Thu, 22 Oct 2009 16:16:08 +0200 (CEST) From: Ludwig Nussel Date: Thu, 22 Oct 2009 16:16:08 +0200 Message-Id: <1256220968-2387-1-git-send-email-ludwig.nussel@suse.de> Subject: [dm-crypt] [PATCH] print warning when adding a key that contains non-ASCII characters List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: dm-crypt@saout.de Cc: Ludwig Nussel 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? 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 #include #include +#include #include #include #include @@ -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