diff options
author | Jeremy Allison <jra@samba.org> | 1998-05-19 22:06:41 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-05-19 22:06:41 +0000 |
commit | 00516da27e0293f66549488e87321a49bb4af4fd (patch) | |
tree | e607b5fbd246dc998120775558dc17e5191cdbc8 | |
parent | 1b412a501e22602ac5edcd875e09bd3814b6e841 (diff) | |
download | samba-00516da27e0293f66549488e87321a49bb4af4fd.tar.gz samba-00516da27e0293f66549488e87321a49bb4af4fd.tar.bz2 samba-00516da27e0293f66549488e87321a49bb4af4fd.zip |
Fix to do NT wildcard matching.
Jeremy.
(This used to be commit 170070b9c793805df9f8629e70027f17b949425f)
-rw-r--r-- | source3/lib/util.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c index 75c3de541f..ebf66c56f4 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -3097,8 +3097,30 @@ BOOL mask_match(char *str, char *regexp, int case_sig,BOOL trans2) } } - matched = do_match(sbase,ebase,case_sig) && - (trans2 || do_match(sext,eext,case_sig)); + if(trans2) { + /* + * Match each component of the path, split up by '.' + * characters. + */ + char *fp, *rp, *cp2, *cp1; + matched = False; + for( cp1 = ebase, cp2 = sbase; cp1;) { + fp = strchr(cp2, '.'); + if(fp) + *fp = '\0'; + rp = strchr(cp1, '.'); + if(rp) + *rp = '\0'; + if(!do_match(cp2, cp1, case_sig)) + break; + cp2 = fp ? fp + 1 : ""; + cp1 = rp ? rp + 1 : NULL; + } + if(cp1 == NULL) + matched = True; + } else { + matched = do_match(sbase,ebase,case_sig) && do_match(sext,eext,case_sig); + } DEBUG(8,("mask_match returning %d\n", matched)); |