From ec5b3043bfdf2a92e1dfeead0fa70f1c5d61cbdb Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 11 Jan 2000 02:18:46 +0000 Subject: Fixed bug in unix_mask_match() that caused veto files not to work. Jeremy. (This used to be commit f5fedf80bce84dba1468631202337077511bcd25) --- source3/lib/util.c | 40 +++++++++------------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/source3/lib/util.c b/source3/lib/util.c index 5063dab9c4..a39dc1a516 100644 --- a/source3/lib/util.c +++ b/source3/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; -- cgit