summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-03-11 22:48:24 +0000
committerJeremy Allison <jra@samba.org>2004-03-11 22:48:24 +0000
commite3f5b542707e2328030b9d5eff0836a904eccde5 (patch)
tree13124522e17aa9464fa9e4b965f6b34112af0307 /source3/smbd
parent3d18997afda94504e9db24115aaa56a58086a653 (diff)
downloadsamba-e3f5b542707e2328030b9d5eff0836a904eccde5.tar.gz
samba-e3f5b542707e2328030b9d5eff0836a904eccde5.tar.bz2
samba-e3f5b542707e2328030b9d5eff0836a904eccde5.zip
Restore the contract on all convert_stringXX() interfaces. Add a "allow_bad_conv"
boolean parameter that allows broken iconv conversions to work. Gets rid of the nasty errno checks in mangle_hash2 and check_path_syntax and allows correct return code checking. Jeremy. (This used to be commit 7b96765c23637613f079d37566d95d5edd511f05)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/mangle_hash2.c6
-rw-r--r--source3/smbd/message.c2
-rw-r--r--source3/smbd/reply.c28
3 files changed, 8 insertions, 28 deletions
diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c
index 8dfa84d054..62087e7e59 100644
--- a/source3/smbd/mangle_hash2.c
+++ b/source3/smbd/mangle_hash2.c
@@ -453,17 +453,13 @@ static BOOL is_legal_name(const char *name)
/* Possible start of mb character. */
char mbc[2];
/*
- * We know the following will return 2 bytes. What
- * we need to know was if errno was set.
* 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.
*/
- errno = 0;
- convert_string(CH_UNIX, CH_UCS2, name, 2, mbc, 2);
- if (!errno) {
+ if (convert_string(CH_UNIX, CH_UCS2, name, 2, mbc, 2, False) == 2) {
/* Was a good mb string. */
name += 2;
continue;
diff --git a/source3/smbd/message.c b/source3/smbd/message.c
index 88f833e468..f853a91475 100644
--- a/source3/smbd/message.c
+++ b/source3/smbd/message.c
@@ -64,7 +64,7 @@ static void msg_deliver(void)
* Incoming message is in DOS codepage format. Convert to UNIX.
*/
- if ((len = convert_string_allocate(NULL,CH_DOS, CH_UNIX, msgbuf, msgpos, (void **) &msg)) < 0 || !msg) {
+ if ((len = (int)convert_string_allocate(NULL,CH_DOS, CH_UNIX, msgbuf, msgpos, (void **) &msg, True)) < 0 || !msg) {
DEBUG(3,("Conversion failed, delivering message in DOS codepage format\n"));
for (i = 0; i < msgpos;) {
if (msgbuf[i] == '\r' && i < (msgpos-1) && msgbuf[i+1] == '\n') {
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index dc9f0be401..4a0c06f442 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -117,35 +117,19 @@ NTSTATUS check_path_syntax(pstring destname, const pstring srcname)
* conversion to unicode. If the one byte char converts then
* it really is a directory separator following. Otherwise if
* the two byte character converts (and it should or our assumption
- * about character sets is broken and we panic) then copy both
+ * about character sets is broken and we return an error) then copy both
* bytes as it's a MB character, not a directory separator.
*/
uint16 ucs2_val;
- /*
- * We know the following will return 2 bytes. What
- * we need to know was if errno was set.
- * 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 directory separators. We are really checking
- * for mb UNIX asian characters like Japanese (SJIS) here.
- * JRA.
- */
-
- errno = 0;
- convert_string(CH_UNIX, CH_UCS2, s, 1, &ucs2_val, 2);
- if (errno == 0) {
+ if (convert_string(CH_UNIX, CH_UCS2, s, 1, &ucs2_val, 2, False) == 2) {
;
+ } else if (convert_string(CH_UNIX, CH_UCS2, s, 2, &ucs2_val, 2, False) == 2) {
+ *d++ = *s++;
} else {
- errno = 0;
- convert_string(CH_UNIX, CH_UCS2, s, 2, &ucs2_val, 2);
- if (errno == 0) {
- *d++ = *s++;
- } else {
- DEBUG(0,("check_path_syntax: directory separator assumptions invalid !\n"));
- return NT_STATUS_INVALID_PARAMETER;
- }
+ DEBUG(0,("check_path_syntax: directory separator assumptions invalid !\n"));
+ return NT_STATUS_INVALID_PARAMETER;
}
}
/* Just copy the char (or the second byte of the mb char). */