summaryrefslogtreecommitdiffstats
path: root/source/smbd/reply.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-03-29 00:36:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:22 -0500
commit8c64cd368fdd2c5a4b361904855c135ade3f449e (patch)
tree8ae7cb5344a8228af2d81dcdfa4bec8d36a5bd29 /source/smbd/reply.c
parentd1ff66f6cde844bf0312747c50b402e81846891f (diff)
downloadsamba-8c64cd368fdd2c5a4b361904855c135ade3f449e.tar.gz
samba-8c64cd368fdd2c5a4b361904855c135ade3f449e.tar.xz
samba-8c64cd368fdd2c5a4b361904855c135ade3f449e.zip
r6106: Fix bug #2551. It turns out that the incoming flags2 flag FLAGS2_LONG_PATH_COMPONENTS
determines if a reply is uppercased on a SMBsearch request, not the protocol level. This could clear up quite a few hacks going forward I think. Jeremy.
Diffstat (limited to 'source/smbd/reply.c')
-rw-r--r--source/smbd/reply.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/source/smbd/reply.c b/source/smbd/reply.c
index 6cc6a97afca..9a811c14a36 100644
--- a/source/smbd/reply.c
+++ b/source/smbd/reply.c
@@ -931,6 +931,8 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
BOOL can_open = True;
BOOL bad_path = False;
NTSTATUS nt_status;
+ BOOL allow_long_path_components = (SVAL(inbuf,smb_flg2) & FLAGS2_LONG_PATH_COMPONENTS) ? True : False;
+
START_PROFILE(SMBsearch);
*mask = *directory = *fname = 0;
@@ -1030,7 +1032,8 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
if (ok) {
if ((dirtype&0x1F) == aVOLID) {
memcpy(p,status,21);
- make_dir_struct(p,"???????????",volume_label(SNUM(conn)),0,aVOLID,0);
+ make_dir_struct(p,"???????????",volume_label(SNUM(conn)),
+ 0,aVOLID,0,!allow_long_path_components);
dptr_fill(p+12,dptr_num);
if (dptr_zero(p+12) && (status_len==0))
numentries = 1;
@@ -1050,7 +1053,8 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
finished = !get_dir_entry(conn,mask,dirtype,fname,&size,&mode,&date,check_descend);
if (!finished) {
memcpy(p,status,21);
- make_dir_struct(p,mask,fname,size,mode,date);
+ make_dir_struct(p,mask,fname,size, mode,date,
+ !allow_long_path_components);
dptr_fill(p+12,dptr_num);
numentries++;
p += DIR_STRUCT_SIZE;
@@ -1088,8 +1092,11 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
SCVAL(smb_buf(outbuf),0,5);
SSVAL(smb_buf(outbuf),1,numentries*DIR_STRUCT_SIZE);
- if (Protocol >= PROTOCOL_NT1)
- SSVAL(outbuf,smb_flg2,SVAL(outbuf, smb_flg2) | FLAGS2_IS_LONG_NAME);
+ /* The replies here are never long name. */
+ SSVAL(outbuf,smb_flg2,SVAL(outbuf, smb_flg2) & (~FLAGS2_IS_LONG_NAME));
+ if (!allow_long_path_components) {
+ SSVAL(outbuf,smb_flg2,SVAL(outbuf, smb_flg2) & (~FLAGS2_LONG_PATH_COMPONENTS));
+ }
/* This SMB *always* returns ASCII names. Remove the unicode bit in flags2. */
SSVAL(outbuf,smb_flg2, (SVAL(outbuf, smb_flg2) & (~FLAGS2_UNICODE_STRINGS)));