summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-03-29 19:40:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:19:01 -0500
commit75b4e240671067e1e94825b9e923eb4a4de0b708 (patch)
treecca4959e768317c2a5e72c575bbfb76641c2fba1 /source3
parentbc2b6436d0f5f3e9ffdfaeb7f1b32996a83d5478 (diff)
downloadsamba-75b4e240671067e1e94825b9e923eb4a4de0b708.tar.gz
samba-75b4e240671067e1e94825b9e923eb4a4de0b708.tar.bz2
samba-75b4e240671067e1e94825b9e923eb4a4de0b708.zip
r22010: Now I'm looking at mangling again, make sure
that we mangle any illegal names before doing any wildcard matches. That way lies least suprises. Don't merge this for 3.0.25, too dangerous. Thanks. Jeremy. (This used to be commit 8e15ef476cada7a900ff17c7ba70c729d56718bd)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/trans2.c47
1 files changed, 31 insertions, 16 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index b06b53b299..dfba188b74 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1160,16 +1160,28 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
DEBUG(8,("get_lanman2_dir_entry:readdir on dirptr 0x%lx now at offset %ld\n",
(long)conn->dirptr,curr_dirpos));
- if (!dname)
+ if (!dname) {
return(False);
+ }
+
+ /*
+ * fname may get mangled, dname is never mangled.
+ * Whenever we're accessing the filesystem we use
+ * pathreal which is composed from dname.
+ */
pstrcpy(fname,dname);
- if(!(got_match = *got_exact_match = exact_match(conn, fname, mask)))
+ /* This will mangle fname if it's an illegal name. */
+ mangle_map(fname,False,True,conn->params);
+
+ if(!(got_match = *got_exact_match = exact_match(conn, fname, mask))) {
got_match = mask_match(fname, mask, conn->case_sensitive);
+ }
if(!got_match && check_mangled_names &&
!mangle_is_8_3(fname, False, conn->params)) {
+ pstring mangled_name;
/*
* It turns out that NT matches wildcards against
@@ -1178,21 +1190,25 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
* that some people have been seeing.... JRA.
*/
- pstring newname;
- pstrcpy( newname, fname);
- mangle_map( newname, True, False, conn->params);
- if(!(got_match = *got_exact_match = exact_match(conn, newname, mask)))
- got_match = mask_match(newname, mask, conn->case_sensitive);
+ pstrcpy(mangled_name, fname);
+
+ /* Force the mangling into 8.3. */
+ mangle_map( mangled_name, True, False, conn->params);
+ if(!(got_match = *got_exact_match = exact_match(conn, mangled_name, mask))) {
+ got_match = mask_match(mangled_name, mask, conn->case_sensitive);
+ }
}
- if(got_match) {
- BOOL isdots = (strequal(fname,"..") || strequal(fname,"."));
- if (dont_descend && !isdots)
+ if (got_match) {
+ BOOL isdots = (strequal(dname,"..") || strequal(dname,"."));
+ if (dont_descend && !isdots) {
continue;
+ }
pstrcpy(pathreal,conn->dirpath);
- if(needslash)
+ if(needslash) {
pstrcat(pathreal,"/");
+ }
pstrcat(pathreal,dname);
if (INFO_LEVEL_IS_UNIX(info_level)) {
@@ -1230,12 +1246,13 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
}
if (!dir_check_ftype(conn,mode,dirtype)) {
- DEBUG(5,("[%s] attribs didn't match %x\n",fname,dirtype));
+ DEBUG(5,("get_lanman2_dir_entry: [%s] attribs didn't match %x\n",fname,dirtype));
continue;
}
- if (!(mode & aDIR))
+ if (!(mode & aDIR)) {
file_size = get_file_size(sbuf);
+ }
allocation_size = get_allocation_size(conn,NULL,&sbuf);
mdate_ts = get_mtimespec(&sbuf);
@@ -1252,7 +1269,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
mdate = convert_timespec_to_time_t(mdate_ts);
adate = convert_timespec_to_time_t(adate_ts);
- DEBUG(5,("get_lanman2_dir_entry found %s fname=%s\n",pathreal,fname));
+ DEBUG(5,("get_lanman2_dir_entry: found %s fname=%s\n",pathreal,fname));
found = True;
@@ -1260,8 +1277,6 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
}
}
- mangle_map(fname,False,True,conn->params);
-
p = pdata;
last_entry_ptr = p;