From 7d32679e9683c81aca538f0267684332a28a286f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 8 Oct 2004 08:13:00 +0000 Subject: r2857: this commit gets rid of smb_ucs2_t, wpstring and fpstring, plus lots of associated functions. The motivation for this change was to avoid having to convert to/from ucs2 strings for so many operations. Doing that was slow, used many static buffers, and was also incorrect as it didn't cope properly with unicode codepoints above 65536 (which could not be represented correctly as smb_ucs2_t chars) The two core functions that allowed this change are next_codepoint() and push_codepoint(). These functions allow you to correctly walk a arbitrary multi-byte string a character at a time without converting the whole string to ucs2. While doing this cleanup I also fixed several ucs2 string handling bugs. See the commit for details. The following code (which counts the number of occuraces of 'c' in a string) shows how to use the new interface: size_t count_chars(const char *s, char c) { size_t count = 0; while (*s) { size_t size; codepoint_t c2 = next_codepoint(s, &size); if (c2 == c) count++; s += size; } return count; } (This used to be commit 814881f0e50019196b3aa9fbe4aeadbb98172040) --- source4/auth/pass_check.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'source4/auth') diff --git a/source4/auth/pass_check.c b/source4/auth/pass_check.c index c468db5558..34faa5e03a 100644 --- a/source4/auth/pass_check.c +++ b/source4/auth/pass_check.c @@ -583,6 +583,30 @@ static NTSTATUS password_check(const char *password) } +/** + Does a string have any lowercase chars in it? +**/ +static BOOL strhaslower(const char *s) +{ + while (*s) { + if (islower(*s)) return True; + s++; + } + return False; +} + +/** + Does a string have any uppercase chars in it? +**/ +static BOOL strhasupper(const char *s) +{ + while (*s) { + if (isupper(*s)) return True; + s++; + } + return False; +} + /**************************************************************************** CHECK if a username/password is OK -- cgit