- the 8.3 name in BOTH_DIRECTORY_INFO is supposed to be always unicode
authorAndrew Tridgell <tridge@samba.org>
Fri, 6 Jun 2003 05:15:28 +0000 (05:15 +0000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 6 Jun 2003 05:15:28 +0000 (05:15 +0000)
  (to match win2003 behaviour)

- added the STR_TERMINATE_ASCII flag from samba4 so we can get the
  string termination right for the case where it is supposed to be
  non-terminated for UCS2 and terminated when ASCII
(This used to be commit 791a4cc7cf84eca77116bca00aeb5f95560f6705)

source3/include/smb.h
source3/lib/charcnv.c
source3/smbd/trans2.c

index 4dacf79a13343565df1e51a5a7aa93dc4ddd4307..27c966914fb1bf0474ea95c8aa3d65b3a46f9967 100644 (file)
@@ -66,6 +66,7 @@ typedef int BOOL;
 #define STR_ASCII 4
 #define STR_UNICODE 8
 #define STR_NOALIGN 16
+#define STR_TERMINATE_ASCII 128
 
 /* how long to wait for secondary SMB packets (milli-seconds) */
 #define SMB_SECONDARY_WAIT (60*1000)
index eb427cc0fce23ac39a3b4dc88ca98a9efeb7b116..1a74318439a25bd0cf58ba4f0babdf707064f504 100644 (file)
@@ -367,7 +367,7 @@ size_t push_ascii(void *dest, const char *src, size_t dest_len, int flags)
                src = tmpbuf;
        }
 
-       if (flags & STR_TERMINATE)
+       if (flags & (STR_TERMINATE | STR_TERMINATE_ASCII))
                src_len++;
 
        return convert_string(CH_UNIX, CH_DOS, src, src_len, dest, dest_len);
index fa6488362099ee19893f2bafdee82450d059d83e..b20ec84eeae709efaefcac07b800c971aef23a08 100644 (file)
@@ -681,14 +681,14 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
                                pstrcpy(mangled_name, fname);
                                mangle_map(mangled_name,True,True,SNUM(conn));
                                mangled_name[12] = 0;
-                               len = srvstr_push(outbuf, p+2, mangled_name, 24, STR_UPPER);
+                               len = srvstr_push(outbuf, p+2, mangled_name, 24, STR_UPPER|STR_UNICODE);
                                SSVAL(p, 0, len);
                        } else {
                                SSVAL(p,0,0);
                                *(p+2) = 0;
                        }
                        p += 2 + 24;
-                       len = srvstr_push(outbuf, p, fname, -1, 0);
+                       len = srvstr_push(outbuf, p, fname, -1, STR_TERMINATE_ASCII);
                        SIVAL(q,0,len);
                        p += len;
                        len = PTR_DIFF(p, pdata);
@@ -709,7 +709,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
                        p += 16;
                        SIVAL(p,0,nt_extmode); p += 4;
                        p += 4;
-                       len = srvstr_push(outbuf, p, fname, -1, 0);
+                       len = srvstr_push(outbuf, p, fname, -1, STR_TERMINATE_ASCII);
                        SIVAL(p, -4, len);
                        p += len;
                        len = PTR_DIFF(p, pdata);
@@ -732,7 +732,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
                        p += 4;
 
                        SIVAL(p,4,0); /* ea size */
-                       len = srvstr_push(outbuf, p+8, fname, -1, 0);
+                       len = srvstr_push(outbuf, p+8, fname, -1, STR_TERMINATE_ASCII);
                        SIVAL(p, 0, len);
                        p += 8 + len;
 
@@ -748,7 +748,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
                        p += 4;
                        /* this must *not* be null terminated or w2k gets in a loop trying to set an
                           acl on a dir (tridge) */
-                       len = srvstr_push(outbuf, p, fname, -1, 0);
+                       len = srvstr_push(outbuf, p, fname, -1, STR_TERMINATE_ASCII);
                        SIVAL(p, -4, len);
                        p += len;
                        len = PTR_DIFF(p, pdata);