it was a mask_match bug

Andrew Tridgell tridge at
Sat Jul 17 08:56:07 GMT 1999


It was a mask_match() bug. I haven't found the bug, but I've found a
workaround. I've added:

  /* special case - if it is exactly the same then it always matches! */
  if (strcmp(str, regexp) == 0) return True;

the one that fails is:

  mask_match str=<.kderc> regexp=<.kderc>, case_sig = 0

I found one bug:

        if(cp1[strlen(cp1)-1] == '*')
          last_wcard_was_star = True;
          last_wcard_was_star = False;

cp1 can be the empty string in which case you are looking in a random
memory location. Fixing this didn't fix the problem, but I suspect a
similar bug is somewhere else in mask_match().

We _really_ need a standalone mask_match() module with a huge pile of
test cases. Then we need to run it through purify. I'm CCing this to
samba-technical in case someone volunteers. The wildcard matching has
grown to be one of the most complex and worst bits of code in Samba. A
standalone mask_match utility would save us a _lot_ of trouble in the

Any volunteers?

Cheers, Tridge

PS: This bug probably explains a bunch of random problems with Samba
2.0. It would randomly fail to find files.

More information about the samba-technical mailing list