#include "includes.h"
+#include "smbd/smbd.h"
#include "smbd/globals.h"
-#include "memcache.h"
+#include "../lib/util/memcache.h"
#include "mangle.h"
#if 1
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;
}
length = MIN(length,sizeof(fstring)-1);
strncpy(str, key, length);
str[length] = 0;
- strupper_m(str);
+ (void)strupper_m(str);
/* the length of a multi-byte string can change after a strupper_m */
length = strlen(str);
while (*name) {
if (((unsigned int)name[0]) > 128 && (name[1] != 0)) {
/* Possible start of mb character. */
- char mbc[2];
+ size_t size = 0;
+ (void)next_codepoint(name, &size);
/*
- * Note that if CH_UNIX is utf8 a string may be 3
- * bytes, but this is ok as mb utf8 characters don't
- * contain embedded ascii bytes. We are really checking
- * for mb UNIX asian characters like Japanese (SJIS) here.
- * JRA.
+ * Note that we're only looking for multibyte
+ * encoding here. No encoding with a length > 1
+ * contains invalid characters.
*/
- if (convert_string(CH_UNIX, CH_UTF16LE, name, 2, mbc, 2) == 2) {
- /* Was a good mb string. */
- name += 2;
+ if (size > 1) {
+ /* Was a mb string. */
+ name += size;
continue;
}
}
/* if the name is already a valid 8.3 name then we don't need to
* change anything */
if (is_legal_name(name) && is_8_3(name, False, False, p)) {
- safe_strcpy(new_name, name, 12);
+ strlcpy(new_name, name, 13);
return True;
}
}
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] = '_';
char c = dot_p[i];
if (FLAG_CHECK(c, FLAG_ASCII)) {
extension[extension_length++] =
- toupper_ascii(c);
+ toupper_m(c);
}
}
}