Author: vlendec
Date: 2007-08-02 18:06:45 +0000 (Thu, 02 Aug 2007)
New Revision: 24133

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24133

Log:
Explicitly pass flags2 down to push_string_fn

This needs a bit closer review, it also touches the client libs

Modified:
   branches/SAMBA_3_2/source/include/safe_string.h
   branches/SAMBA_3_2/source/lib/charcnv.c
   branches/SAMBA_3_2/source/libsmb/clistr.c
   branches/SAMBA_3_2/source/smbd/srvstr.c


Changeset:
Modified: branches/SAMBA_3_2/source/include/safe_string.h
===================================================================
--- branches/SAMBA_3_2/source/include/safe_string.h     2007-08-02 17:46:45 UTC 
(rev 24132)
+++ branches/SAMBA_3_2/source/include/safe_string.h     2007-08-02 18:06:45 UTC 
(rev 24133)
@@ -191,7 +191,7 @@
 #define push_string_fn2(fn_name, fn_line, base_ptr, dest, src, dest_len, 
flags) \
     (CHECK_STRING_SIZE(dest, dest_len) \
     ? __unsafe_string_function_usage_here_size_t__() \
-    : push_string_fn(fn_name, fn_line, base_ptr, dest, src, dest_len, flags))
+    : push_string_fn(fn_name, fn_line, base_ptr, 0, dest, src, dest_len, 
flags))
 
 #define pull_string_fn2(fn_name, fn_line, base_ptr, smb_flags2, dest, src, 
dest_len, src_len, flags) \
     (CHECK_STRING_SIZE(dest, dest_len) \

Modified: branches/SAMBA_3_2/source/lib/charcnv.c
===================================================================
--- branches/SAMBA_3_2/source/lib/charcnv.c     2007-08-02 17:46:45 UTC (rev 
24132)
+++ branches/SAMBA_3_2/source/lib/charcnv.c     2007-08-02 18:06:45 UTC (rev 
24133)
@@ -1504,7 +1504,10 @@
  is -1 then no maxiumum is used.
 **/
 
-size_t push_string_fn(const char *function, unsigned int line, const void 
*base_ptr, void *dest, const char *src, size_t dest_len, int flags)
+size_t push_string_fn(const char *function, unsigned int line,
+                     const void *base_ptr, uint16 flags2,
+                     void *dest, const char *src,
+                     size_t dest_len, int flags)
 {
 #ifdef DEVELOPER
        /* We really need to zero fill here, not clobber
@@ -1524,7 +1527,7 @@
 
        if (!(flags & STR_ASCII) && \
            ((flags & STR_UNICODE || \
-             (SVAL(base_ptr, smb_flg2) & FLAGS2_UNICODE_STRINGS)))) {
+             (flags2 & FLAGS2_UNICODE_STRINGS)))) {
                return push_ucs2(base_ptr, dest, src, dest_len, flags);
        }
        return push_ascii(dest, src, dest_len, flags);

Modified: branches/SAMBA_3_2/source/libsmb/clistr.c
===================================================================
--- branches/SAMBA_3_2/source/libsmb/clistr.c   2007-08-02 17:46:45 UTC (rev 
24132)
+++ branches/SAMBA_3_2/source/libsmb/clistr.c   2007-08-02 18:06:45 UTC (rev 
24133)
@@ -28,13 +28,21 @@
        if (dest_len == -1) {
                if (((ptrdiff_t)dest < (ptrdiff_t)cli->outbuf) || (buf_used > 
cli->bufsize)) {
                        DEBUG(0, ("Pushing string of 'unlimited' length into 
non-SMB buffer!\n"));
-                       return push_string_fn(function, line, cli->outbuf, 
dest, src, -1, flags);
+                       return push_string_fn(function, line,
+                                             cli->outbuf,
+                                             SVAL(cli->outbuf, smb_flg2),
+                                             dest, src, -1, flags);
                }
-               return push_string_fn(function, line, cli->outbuf, dest, src, 
cli->bufsize - buf_used, flags);
+               return push_string_fn(function, line, cli->outbuf,
+                                     SVAL(cli->outbuf, smb_flg2),
+                                     dest, src, cli->bufsize - buf_used,
+                                     flags);
        }
        
        /* 'normal' push into size-specified buffer */
-       return push_string_fn(function, line, cli->outbuf, dest, src, dest_len, 
flags);
+       return push_string_fn(function, line, cli->outbuf,
+                             SVAL(cli->outbuf, smb_flg2),
+                             dest, src, dest_len, flags);
 }
 
 size_t clistr_pull_fn(const char *function, unsigned int line, 

Modified: branches/SAMBA_3_2/source/smbd/srvstr.c
===================================================================
--- branches/SAMBA_3_2/source/smbd/srvstr.c     2007-08-02 17:46:45 UTC (rev 
24132)
+++ branches/SAMBA_3_2/source/smbd/srvstr.c     2007-08-02 18:06:45 UTC (rev 
24133)
@@ -33,13 +33,17 @@
 #if 0
                        DEBUG(0, ("Pushing string of 'unlimited' length into 
non-SMB buffer!\n"));
 #endif
-                       return push_string_fn(function, line, base_ptr, dest, 
src, -1, flags);
+                       return push_string_fn(function, line, base_ptr,
+                                             smb_flags2, dest, src, -1,
+                                             flags);
                }
-               return push_string_fn(function, line, base_ptr, dest, src, 
max_send - buf_used, flags);
+               return push_string_fn(function, line, base_ptr, smb_flags2,
+                                     dest, src, max_send - buf_used, flags);
        }
        
        /* 'normal' push into size-specified buffer */
-       return push_string_fn(function, line, base_ptr, dest, src, dest_len, 
flags);
+       return push_string_fn(function, line, base_ptr, smb_flags2, dest, src,
+                             dest_len, flags);
 }
 
 /*******************************************************************

Reply via email to