From cc38992e3f6c6ca04ae7170cb03028d3d1c06ae3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Aug 2003 16:19:48 +0000 Subject: fixed some places where we don't brace (flags & STR_UNICODE) this fixes the samba4 server with ascii clients (This used to be commit c770603ac6c3331a4ac79a650cbbbeb21c778137) --- source4/lib/charcnv.c | 4 ++-- source4/libcli/raw/rawrequest.c | 2 +- source4/smbd/request.c | 2 +- source4/torture/torture_util.c | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source4/lib/charcnv.c b/source4/lib/charcnv.c index 90ddbb4d53..622de26ab8 100644 --- a/source4/lib/charcnv.c +++ b/source4/lib/charcnv.c @@ -769,7 +769,7 @@ ssize_t pull_utf8_allocate(void **dest, const char *src) ssize_t push_string(const void *base_ptr, void *dest, const char *src, size_t dest_len, int flags) { if (!(flags & STR_ASCII) && \ - ((flags & STR_UNICODE || \ + (((flags & STR_UNICODE) || \ (SVAL(base_ptr, NBT_HDR_SIZE+HDR_FLG2) & FLAGS2_UNICODE_STRINGS)))) { return push_ucs2(base_ptr, dest, src, dest_len, flags); } @@ -794,7 +794,7 @@ ssize_t push_string(const void *base_ptr, void *dest, const char *src, size_t de ssize_t pull_string(const void *base_ptr, char *dest, const void *src, size_t dest_len, size_t src_len, int flags) { if (!(flags & STR_ASCII) && \ - ((flags & STR_UNICODE || \ + (((flags & STR_UNICODE) || \ (SVAL(base_ptr, NBT_HDR_SIZE+HDR_FLG2) & FLAGS2_UNICODE_STRINGS)))) { return pull_ucs2(base_ptr, dest, src, dest_len, src_len, flags); } diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c index 52349d415c..fa3b3ab627 100644 --- a/source4/libcli/raw/rawrequest.c +++ b/source4/libcli/raw/rawrequest.c @@ -754,7 +754,7 @@ size_t cli_req_pull_string(struct cli_request *req, TALLOC_CTX *mem_ctx, char **dest, const char *src, int byte_len, unsigned flags) { if (!(flags & STR_ASCII) && - ((flags & STR_UNICODE || (req->flags2 & FLAGS2_UNICODE_STRINGS)))) { + (((flags & STR_UNICODE) || (req->flags2 & FLAGS2_UNICODE_STRINGS)))) { return cli_req_pull_ucs2(req, mem_ctx, dest, src, byte_len, flags); } diff --git a/source4/smbd/request.c b/source4/smbd/request.c index 564bb07f90..47660d8435 100644 --- a/source4/smbd/request.c +++ b/source4/smbd/request.c @@ -483,7 +483,7 @@ static size_t req_pull_ascii(struct request_context *req, const char **dest, con size_t req_pull_string(struct request_context *req, const char **dest, const char *src, int byte_len, unsigned flags) { if (!(flags & STR_ASCII) && - ((flags & STR_UNICODE || (req->flags2 & FLAGS2_UNICODE_STRINGS)))) { + (((flags & STR_UNICODE) || (req->flags2 & FLAGS2_UNICODE_STRINGS)))) { return req_pull_ucs2(req, dest, src, byte_len, flags); } diff --git a/source4/torture/torture_util.c b/source4/torture/torture_util.c index 7fa8e1133b..2dea3039aa 100644 --- a/source4/torture/torture_util.c +++ b/source4/torture/torture_util.c @@ -195,6 +195,7 @@ void *shm_setup(int size) BOOL wire_bad_flags(WIRE_STRING *str, int flags) { int len; + if (!str || !str->s) return True; len = strlen(str->s); if (flags & STR_TERMINATE) len++; if ((flags & STR_UNICODE) || !getenv("CLI_FORCE_ASCII")) { -- cgit