diff options
author | Jeremy Allison <jra@samba.org> | 2011-07-19 13:19:29 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2011-07-19 13:19:29 -0700 |
commit | ee34c25c8a989b5a7c0ad59d71bb39f8efff045c (patch) | |
tree | 25d8f09ed1c36ad18c8c54d596efeeb6c1aa66b2 /source3 | |
parent | 2052c2d6fa830b94a6b6cf8dd48b56f62de4e5ac (diff) | |
download | samba-ee34c25c8a989b5a7c0ad59d71bb39f8efff045c.tar.gz samba-ee34c25c8a989b5a7c0ad59d71bb39f8efff045c.tar.bz2 samba-ee34c25c8a989b5a7c0ad59d71bb39f8efff045c.zip |
First part of fix for bug 8310 - toupper_ascii() is broken on big-endian systems
Remove
int toupper_ascii(int c);
int tolower_ascii(int c);
int isupper_ascii(int c);
int islower_ascii(int c);
and replace with their _m equivalents, as they are identical.
Diffstat (limited to 'source3')
-rw-r--r-- | source3/auth/pass_check.c | 4 | ||||
-rw-r--r-- | source3/client/clitar.c | 2 | ||||
-rw-r--r-- | source3/lib/username.c | 4 | ||||
-rw-r--r-- | source3/lib/util_str.c | 2 | ||||
-rw-r--r-- | source3/param/loadparm.c | 6 | ||||
-rw-r--r-- | source3/passdb/passdb.c | 8 | ||||
-rw-r--r-- | source3/smbd/mangle_hash.c | 6 | ||||
-rw-r--r-- | source3/smbd/mangle_hash2.c | 12 | ||||
-rw-r--r-- | source3/web/swat.c | 2 |
9 files changed, 23 insertions, 23 deletions
diff --git a/source3/auth/pass_check.c b/source3/auth/pass_check.c index 714cc968a7..74d6f1ffbc 100644 --- a/source3/auth/pass_check.c +++ b/source3/auth/pass_check.c @@ -518,9 +518,9 @@ static NTSTATUS string_combinations2(char *s, int offset, for (i = offset; i < (len - (N - 1)); i++) { char c = s[i]; - if (!islower_ascii(c)) + if (!islower_m(c)) continue; - s[i] = toupper_ascii(c); + s[i] = toupper_m(c); nt_status = string_combinations2(s, i + 1, fn, N - 1, private_data); if (!NT_STATUS_EQUAL(nt_status, NT_STATUS_WRONG_PASSWORD)) { diff --git a/source3/client/clitar.c b/source3/client/clitar.c index a5de8ebafe..3fff081ca0 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -473,7 +473,7 @@ static int strslashcmp(char *s1, char *s2) { char *s1_0=s1; - while(*s1 && *s2 && (*s1 == *s2 || tolower_ascii(*s1) == tolower_ascii(*s2) || + while(*s1 && *s2 && (*s1 == *s2 || tolower_m(*s1) == tolower_m(*s2) || (*s1 == '\\' && *s2=='/') || (*s1 == '/' && *s2=='\\'))) { s1++; s2++; } diff --git a/source3/lib/username.c b/source3/lib/username.c index d5da532124..925b44bb06 100644 --- a/source3/lib/username.c +++ b/source3/lib/username.c @@ -196,9 +196,9 @@ static struct passwd *uname_string_combinations2(char *s, TALLOC_CTX *mem_ctx, for (i=offset;i<(len-(N-1));i++) { char c = s[i]; - if (!islower_ascii((int)c)) + if (!islower_m((int)c)) continue; - s[i] = toupper_ascii(c); + s[i] = toupper_m(c); ret = uname_string_combinations2(s, mem_ctx, i+1, fn, N-1); if(ret) return(ret); diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index a348b389e8..baa5a1f046 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -470,7 +470,7 @@ void strlower_m(char *s) (ie. they match for the first 128 chars) */ while (*s && !(((unsigned char)s[0]) & 0x80)) { - *s = tolower_ascii((unsigned char)*s); + *s = tolower_m((unsigned char)*s); s++; } diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 1258709856..3b4ff6a799 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -6923,9 +6923,9 @@ static bool handle_dos_charset(struct loadparm_context *unused, int snum, const if (len == 4 || len == 5) { /* Don't use StrCaseCmp here as we don't want to initialize iconv. */ - if ((toupper_ascii(pszParmValue[0]) == 'U') && - (toupper_ascii(pszParmValue[1]) == 'T') && - (toupper_ascii(pszParmValue[2]) == 'F')) { + if ((toupper_m(pszParmValue[0]) == 'U') && + (toupper_m(pszParmValue[1]) == 'T') && + (toupper_m(pszParmValue[2]) == 'F')) { if (len == 4) { if (pszParmValue[3] == '8') { is_utf8 = true; diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index 5116396cd1..faa608cc78 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -407,8 +407,8 @@ bool pdb_gethexpwd(const char *p, unsigned char *pwd) return false; for (i = 0; i < 32; i += 2) { - hinybble = toupper_ascii(p[i]); - lonybble = toupper_ascii(p[i + 1]); + hinybble = toupper_m(p[i]); + lonybble = toupper_m(p[i + 1]); p1 = strchr(hexchars, hinybble); p2 = strchr(hexchars, lonybble); @@ -457,8 +457,8 @@ bool pdb_gethexhours(const char *p, unsigned char *hours) } for (i = 0; i < 42; i += 2) { - hinybble = toupper_ascii(p[i]); - lonybble = toupper_ascii(p[i + 1]); + hinybble = toupper_m(p[i]); + lonybble = toupper_m(p[i + 1]); p1 = strchr(hexchars, hinybble); p2 = strchr(hexchars, lonybble); diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c index a51ea6b208..0238083e38 100644 --- a/source3/smbd/mangle_hash.c +++ b/source3/smbd/mangle_hash.c @@ -424,8 +424,8 @@ static bool is_mangled(const char *s, const struct share_params *p) magic = strchr_m( s, magic_char ); while( magic && magic[1] && magic[2] ) { /* 3 chars, 1st is magic. */ if( ('.' == magic[3] || '/' == magic[3] || !(magic[3])) /* Ends with '.' or nul or '/' ? */ - && isbasechar( toupper_ascii(magic[1]) ) /* is 2nd char basechar? */ - && isbasechar( toupper_ascii(magic[2]) ) ) /* is 3rd char basechar? */ + && isbasechar( toupper_m(magic[1]) ) /* is 2nd char basechar? */ + && isbasechar( toupper_m(magic[2]) ) ) /* is 3rd char basechar? */ return( True ); /* If all above, then true, */ magic = strchr_m( magic+1, magic_char ); /* else seek next magic. */ } @@ -479,7 +479,7 @@ static void cache_mangled_name( const char mangled_name[13], s1 = strrchr( mangled_name_key, '.' ); if( s1 && (s2 = strrchr( raw_name, '.' )) ) { size_t i = 1; - while( s1[i] && (tolower_ascii( s1[i] ) == s2[i]) ) + while( s1[i] && (tolower_m( s1[i] ) == s2[i]) ) i++; if( !s1[i] && !s2[i] ) { /* Truncate at the '.' */ diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c index 4de80cbe31..09cd44d5af 100644 --- a/source3/smbd/mangle_hash2.c +++ b/source3/smbd/mangle_hash2.c @@ -173,10 +173,10 @@ static void init_tables(void) char_flags[c2] |= FLAG_POSSIBLE2; char_flags[c3] |= FLAG_POSSIBLE3; char_flags[c4] |= FLAG_POSSIBLE4; - char_flags[tolower_ascii(c1)] |= FLAG_POSSIBLE1; - char_flags[tolower_ascii(c2)] |= FLAG_POSSIBLE2; - char_flags[tolower_ascii(c3)] |= FLAG_POSSIBLE3; - char_flags[tolower_ascii(c4)] |= FLAG_POSSIBLE4; + char_flags[tolower_m(c1)] |= FLAG_POSSIBLE1; + char_flags[tolower_m(c2)] |= FLAG_POSSIBLE2; + char_flags[tolower_m(c3)] |= FLAG_POSSIBLE3; + char_flags[tolower_m(c4)] |= FLAG_POSSIBLE4; char_flags[(unsigned char)'.'] |= FLAG_POSSIBLE4; } @@ -737,7 +737,7 @@ static bool hash2_name_to_8_3(const char *name, if (! FLAG_CHECK(lead_chars[i], FLAG_ASCII)) { lead_chars[i] = '_'; } - lead_chars[i] = toupper_ascii(lead_chars[i]); + lead_chars[i] = toupper_m(lead_chars[i]); } for (;i<mangle_prefix;i++) { lead_chars[i] = '_'; @@ -758,7 +758,7 @@ static bool hash2_name_to_8_3(const char *name, char c = dot_p[i]; if (FLAG_CHECK(c, FLAG_ASCII)) { extension[extension_length++] = - toupper_ascii(c); + toupper_m(c); } } } diff --git a/source3/web/swat.c b/source3/web/swat.c index 97c9613e25..15632b763a 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -124,7 +124,7 @@ static char *stripspaceupper(const char *str) char *p = newstring; while (*str) { - if (*str != ' ') *p++ = toupper_ascii(*str); + if (*str != ' ') *p++ = toupper_m(*str); ++str; } *p = '\0'; |