diff -ur samba-3.0.6rc2.orig/source/smbd/trans2.c samba-3.0.6rc2/source/smbd/trans2.c --- samba-3.0.6rc2.orig/source/smbd/trans2.c 2004-08-06 23:38:18.000000000 +0200 +++ samba-3.0.6rc2/source/smbd/trans2.c 2004-08-18 11:25:41.000000000 +0200 @@ -1346,6 +1346,7 @@ BOOL finished = False; BOOL dont_descend = False; BOOL out_of_space = False; + BOOL name_has_wildcard = False; int space_remaining; BOOL bad_path = False; SMB_STRUCT_STAT sbuf; @@ -1732,6 +1733,9 @@ } /* end if current_pos */ } /* end if requires_resume_key && !continue_bit */ + if(strchr(mask,'?') || strchr(mask,'*')) + name_has_wildcard = True; + for (i=0;(i<(int)maxentries) && !finished && !out_of_space ;i++) { BOOL got_exact_match = False; @@ -1757,12 +1761,12 @@ /* * As an optimisation if we know we aren't looking - * for a wildcard name (ie. the name matches the wildcard exactly) + * for a wildcard name (ie. the mask does not contain wildcards) * then we can finish on any (first) match. * This speeds up large directory searches. JRA. */ - if(got_exact_match) + if(got_exact_match && !name_has_wildcard) finished = True; space_remaining = max_data_bytes - PTR_DIFF(p,pdata); Only in samba-3.0.6rc2/source/smbd: trans2.c~