mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-17 15:44:34 +02:00
jnlib/
* stringhelp.c (utf8_charcount): New. agent/ * genkey.c (check_passphrase_constraints): Use UTF-8 aware strlen.
This commit is contained in:
parent
39fbda4e3c
commit
0d4b205630
4
TODO
4
TODO
@ -120,6 +120,4 @@
|
|||||||
There is at least one couple of duplicate files: inttype[_-]h.m4.
|
There is at least one couple of duplicate files: inttype[_-]h.m4.
|
||||||
|
|
||||||
* UTF-8
|
* UTF-8
|
||||||
** we need a function to count characters.
|
UTF-8 specific TODO.
|
||||||
Something like utf8_strlen. This is needed to correclty count the
|
|
||||||
lengtgh of a passphrase.
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
2007-01-25 Werner Koch <wk@g10code.com>
|
2007-01-25 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* genkey.c (check_passphrase_constraints): Get ngettext call right.
|
* genkey.c (check_passphrase_constraints): Get ngettext call right
|
||||||
|
and use UTF-8 aware strlen.
|
||||||
|
|
||||||
* protect-tool.c (get_passphrase): New arg OPT_CHECK.
|
* protect-tool.c (get_passphrase): New arg OPT_CHECK.
|
||||||
(get_new_passphrase): Enable OTP_CHECK on the first call.
|
(get_new_passphrase): Enable OPT_CHECK on the first call.
|
||||||
* command.c (cmd_get_passphrase): Implement option --check.
|
* command.c (cmd_get_passphrase): Implement option --check.
|
||||||
|
|
||||||
2007-01-24 Werner Koch <wk@g10code.com>
|
2007-01-24 Werner Koch <wk@g10code.com>
|
||||||
|
@ -84,7 +84,7 @@ check_passphrase_constraints (ctrl_t ctrl, const char *pw)
|
|||||||
if (!pw)
|
if (!pw)
|
||||||
pw = "";
|
pw = "";
|
||||||
|
|
||||||
if (strlen (pw) < minlen ) /* FIXME: should be an utf-8 length. */
|
if (utf8_charcount (pw) < minlen )
|
||||||
{
|
{
|
||||||
char *desc = xtryasprintf
|
char *desc = xtryasprintf
|
||||||
( ngettext ("Warning: You have entered a passphrase that%%0A"
|
( ngettext ("Warning: You have entered a passphrase that%%0A"
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2007-01-25 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* stringhelp.c (utf8_charcount): New.
|
||||||
|
|
||||||
2006-11-29 Werner Koch <wk@g10code.com>
|
2006-11-29 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* utf8conv.c (set_native_charset) [HAVE_W32_SYSTEM]: Fixed typo in
|
* utf8conv.c (set_native_charset) [HAVE_W32_SYSTEM]: Fixed typo in
|
||||||
|
@ -547,6 +547,23 @@ sanitize_buffer (const void *p_arg, size_t n, int delim)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Given a string containing an UTF-8 encoded text, return the number
|
||||||
|
of characters in this string. It differs from strlen in that it
|
||||||
|
only counts complete UTF-8 characters. Note, that this function
|
||||||
|
does not take combined characters into account. */
|
||||||
|
size_t
|
||||||
|
utf8_charcount (const char *s)
|
||||||
|
{
|
||||||
|
size_t n;
|
||||||
|
|
||||||
|
for (n=0; *s; s++)
|
||||||
|
if ( (*s&0xc0) != 0x80 ) /* Exclude continuation bytes: 10xxxxxx */
|
||||||
|
n++;
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************
|
/****************************************************
|
||||||
********** W32 specific functions ****************
|
********** W32 specific functions ****************
|
||||||
****************************************************/
|
****************************************************/
|
||||||
|
@ -57,6 +57,9 @@ size_t print_sanitized_utf8_string (FILE *fp, const char *string, int delim);
|
|||||||
char *sanitize_buffer (const void *p, size_t n, int delim);
|
char *sanitize_buffer (const void *p, size_t n, int delim);
|
||||||
|
|
||||||
|
|
||||||
|
size_t utf8_charcount (const char *s);
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
const char *w32_strerror (int ec);
|
const char *w32_strerror (int ec);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user