diff options
author | Jeremy Allison <jra@samba.org> | 2000-01-11 02:18:46 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2000-01-11 02:18:46 +0000 |
commit | f5fedf80bce84dba1468631202337077511bcd25 (patch) | |
tree | 55a4fb9f4941cde2d7af63f0e7972f1675ea5d36 /source/lib | |
parent | 3362fcdfa492cfd1d9d4ec35ef2108192302b984 (diff) | |
download | samba-f5fedf80bce84dba1468631202337077511bcd25.tar.gz samba-f5fedf80bce84dba1468631202337077511bcd25.tar.xz samba-f5fedf80bce84dba1468631202337077511bcd25.zip |
Fixed bug in unix_mask_match() that caused veto files not to work.
Jeremy.
Diffstat (limited to 'source/lib')
-rw-r--r-- | source/lib/util.c | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/source/lib/util.c b/source/lib/util.c index 5063dab9c4e..a39dc1a516e 100644 --- a/source/lib/util.c +++ b/source/lib/util.c @@ -1135,6 +1135,10 @@ BOOL unix_do_match(char *str, char *regexp, BOOL case_sig) { char *p; + + while(*str && (case_sig ? (*p != *str) : (toupper(*p)!=toupper(*str)))) + str++; + for( p = regexp; *p && *str; ) { switch(*p) { case '?': @@ -1229,22 +1233,17 @@ BOOL unix_do_match(char *str, char *regexp, BOOL case_sig) * This is the 'original code' used by the unix matcher. *********************************************************/ -static BOOL unix_mask_match(char *str, char *regexp, BOOL case_sig, BOOL trans2) +static BOOL unix_mask_match(char *str, char *regexp, BOOL case_sig) { char *p; pstring p1, p2; fstring ebase,eext,sbase,sext; - BOOL matched; /* Make local copies of str and regexp */ StrnCpy(p1,regexp,sizeof(pstring)-1); StrnCpy(p2,str,sizeof(pstring)-1); - if (!strchr(p2,'.')) { - pstrcat(p2,"."); - } - /* Remove any *? and ** as they are meaningless */ for(p = p1; *p; p++) while( *p == '*' && (p[1] == '?' ||p[1] == '*')) @@ -1254,31 +1253,10 @@ static BOOL unix_mask_match(char *str, char *regexp, BOOL case_sig, BOOL trans2) DEBUG(8,("unix_mask_match str=<%s> regexp=<%s>, case_sig = %d\n", p2, p1, case_sig)); - if (trans2) { - fstrcpy(ebase,p1); - fstrcpy(sbase,p2); - } else { - if ((p=strrchr(p1,'.'))) { - *p = 0; - fstrcpy(ebase,p1); - fstrcpy(eext,p+1); - } else { - fstrcpy(ebase,p1); - eext[0] = 0; - } - - if (!strequal(p2,".") && !strequal(p2,"..") && (p=strrchr(p2,'.'))) { - *p = 0; - fstrcpy(sbase,p2); - fstrcpy(sext,p+1); - } else { - fstrcpy(sbase,p2); - fstrcpy(sext,""); - } - } + fstrcpy(ebase,p1); + fstrcpy(sbase,p2); - matched = unix_do_match(sbase,ebase,case_sig) && - (trans2 || unix_do_match(sext,eext,case_sig)); + matched = unix_do_match(sbase,ebase,case_sig); DEBUG(8,("unix_mask_match returning %d\n", matched)); @@ -2593,7 +2571,7 @@ BOOL is_in_path(char *name, name_compare_entry *namelist) * 'unix style' mask match, rather than the * new NT one. */ - if (unix_mask_match(last_component, namelist->name, case_sensitive, False)) + if (unix_mask_match(last_component, namelist->name, case_sensitive)) { DEBUG(8,("is_in_path: mask match succeeded\n")); return True; |