s4: Use same function signature for convert_* as s3.
[bbaumbach/samba-autobuild/.git] / source4 / smb_server / smb / request.c
index 87073517ddcdf799d2d230fff8ba8a1935ec708a..6846f80594f937c73b10395e4397953a1fb0786e 100644 (file)
@@ -27,7 +27,6 @@
 #include "smbd/service_stream.h"
 #include "lib/stream/packet.h"
 #include "ntvfs/ntvfs.h"
-#include "param/param.h"
 
 
 /* we over allocate the data buffer to prevent too many realloc calls */
@@ -135,7 +134,12 @@ void smbsrv_setup_reply(struct smbsrv_request *req, uint_t wct, size_t buflen)
        flags2 = FLAGS2_LONG_PATH_COMPONENTS | 
                FLAGS2_EXTENDED_ATTRIBUTES | 
                FLAGS2_IS_LONG_NAME;
-       flags2 |= (req->flags2 & (FLAGS2_UNICODE_STRINGS|FLAGS2_EXTENDED_SECURITY));
+#define _SMB_FLAGS2_ECHOED_FLAGS ( \
+       FLAGS2_UNICODE_STRINGS | \
+       FLAGS2_EXTENDED_SECURITY | \
+       FLAGS2_SMB_SECURITY_SIGNATURES \
+)
+       flags2 |= (req->flags2 & _SMB_FLAGS2_ECHOED_FLAGS);
        if (req->smb_conn->negotiate.client_caps & CAP_STATUS32) {
                flags2 |= FLAGS2_32_BIT_ERROR_CODES;
        }
@@ -423,7 +427,7 @@ size_t req_push_str(struct smbsrv_request *req, uint8_t *dest, const char *str,
                dest = req->out.buffer + PTR_DIFF(dest, buf0);
        }
 
-       len = push_string(lp_iconv_convenience(req->smb_conn->lp_ctx), dest, str, len, flags);
+       len = push_string(dest, str, len, flags);
 
        grow_size = len + PTR_DIFF(dest, req->out.data);
 
@@ -478,7 +482,7 @@ size_t req_append_var_block(struct smbsrv_request *req,
 static size_t req_pull_ucs2(struct request_bufinfo *bufinfo, const char **dest, const uint8_t *src, int byte_len, uint_t flags)
 {
        int src_len, src_len2, alignment=0;
-       ssize_t ret;
+       bool ret;
        char *dest2;
 
        if (!(flags & STR_NOALIGN) && ucs2_align(bufinfo->align_base, src, flags)) {
@@ -509,9 +513,9 @@ static size_t req_pull_ucs2(struct request_bufinfo *bufinfo, const char **dest,
                return src_len2 + alignment;
        }
 
-       ret = convert_string_talloc(bufinfo->mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2);
+       ret = convert_string_talloc(bufinfo->mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2, NULL, false);
 
-       if (ret == -1) {
+       if (!ret) {
                *dest = NULL;
                return 0;
        }
@@ -536,7 +540,7 @@ static size_t req_pull_ucs2(struct request_bufinfo *bufinfo, const char **dest,
 static size_t req_pull_ascii(struct request_bufinfo *bufinfo, const char **dest, const uint8_t *src, int byte_len, uint_t flags)
 {
        int src_len, src_len2;
-       ssize_t ret;
+       bool ret;
        char *dest2;
 
        if (flags & STR_NO_RANGE_CHECK) {
@@ -558,9 +562,9 @@ static size_t req_pull_ascii(struct request_bufinfo *bufinfo, const char **dest,
                src_len2++;
        }
 
-       ret = convert_string_talloc(bufinfo->mem_ctx, lp_iconv_convenience(global_loadparm), CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2);
+       ret = convert_string_talloc(bufinfo->mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2, NULL, false);
 
-       if (ret == -1) {
+       if (!ret) {
                *dest = NULL;
                return 0;
        }
@@ -651,10 +655,10 @@ bool req_data_oob(struct request_bufinfo *bufinfo, const uint8_t *ptr, uint32_t
        }
        
        /* be careful with wraparound! */
-       if (ptr < bufinfo->data ||
-           ptr >= bufinfo->data + bufinfo->data_size ||
+       if ((uintptr_t)ptr < (uintptr_t)bufinfo->data ||
+           (uintptr_t)ptr >= (uintptr_t)bufinfo->data + bufinfo->data_size ||
            count > bufinfo->data_size ||
-           ptr + count > bufinfo->data + bufinfo->data_size) {
+           (uintptr_t)ptr + count > (uintptr_t)bufinfo->data + bufinfo->data_size) {
                return true;
        }
        return false;