Bug 1623 - wildcard characters as filenames
wildcard characters as filenames
Status: RESOLVED INVALID
Product: Samba 3.0
Classification: Unclassified
Component: File Services
3.0.6
All Linux
: P3 normal
: none
Assigned To: Jeremy Allison
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-08-18 02:47 UTC by Olaf Flebbe
Modified: 2005-02-22 00:40 UTC (History)
0 users

See Also:


Attachments
patch as attachment (1.24 KB, patch)
2004-08-18 02:49 UTC, Olaf Flebbe
no flags Details
reworked patch (1.22 KB, patch)
2004-08-18 04:15 UTC, Olaf Flebbe
no flags Details
reworked patch (1.22 KB, patch)
2004-08-18 04:15 UTC, Olaf Flebbe
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olaf Flebbe 2004-08-18 02:47:19 UTC
If a filename exists with an wildcat character (i.e. ? or *) then samba does not
displays all files in the directory.
 
Patch:
--- 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);
Comment 1 Olaf Flebbe 2004-08-18 02:49:14 UTC
Created attachment 603 [details]
patch as attachment
Comment 2 Olaf Flebbe 2004-08-18 04:15:06 UTC
Created attachment 606 [details]
reworked patch

Sorry, first patch was broken while porting from samba-2.2.x
Comment 3 Olaf Flebbe 2004-08-18 04:15:24 UTC
Created attachment 607 [details]
reworked patch

Sorry, first patch was broken while porting from samba-2.2.x
Comment 4 Björn Jacke 2004-08-18 06:01:32 UTC
can you show us a bunch of files, where this happens? I can add filenames with
wildcards in it without a problem and no files disappearing.
Comment 5 Gerald (Jerry) Carter 2004-08-25 07:56:59 UTC
jeremy, another small one up your alley.  
Comment 6 Gerald (Jerry) Carter 2005-02-07 09:40:48 UTC
originally against 3.0.6rc2
Comment 7 Gerald (Jerry) Carter 2005-02-21 06:13:32 UTC
is this patch still valid for 3.0.11 ?
Comment 8 Olaf Flebbe 2005-02-22 00:40:09 UTC
Patch seems unnecessary as of 3.0.11, since bug is not reproduceable any more. 
samba seems to mangle the wildcards before attempting a directory match.

Bug closed. Thanks.