Created an attachment (id=290963)
Alternative patch for wildcard matching v3, addressing review comments
(In reply to comment #33)
Thanks for the review, Nelson.
> I suggest that the
> patch should call PL_strcasecmp directly, to ensure that it gets
> an implementation that has the desired property.
>
> I'd prefer if PORT_Strchr(hn, '.') was called separately, and its
> result stored in a pointer, and used only if it is non-NULL.
I did the latter, so it's not necessary to switch to PL_strcasecmp, I think. I also changed the name of two variables (since I'm introducing "firsthndot"), but other than that, there are no changes to the code logic.
> Eliminate the elses immediately after returns. They serve no purpose.
Done.
> Unindent the final block and remove the braces from it.
Done.
> Did you mean to disallow trailing dots from the patterns?
> The present rules allow
> *.a.b.
> but do not allow
> *.a.
> Is that intentional?
Yes. It follows from implementing your suggestion in comment 25:
> a new restriction, that wildcards must be followed by at least
> two dots (that is, two domains) excluding a trailing dot
["*.a." is only followed by one dot, not counting the trailing one.]
> Oh, and put an asterisk in every line in the block comment, so they
> form a column.
Created an attachment (id=290963)
Alternative patch for wildcard matching v3, addressing review comments
(In reply to comment #33)
Thanks for the review, Nelson.
> I suggest that the
> patch should call PL_strcasecmp directly, to ensure that it gets
> an implementation that has the desired property.
>
> I'd prefer if PORT_Strchr(hn, '.') was called separately, and its
> result stored in a pointer, and used only if it is non-NULL.
I did the latter, so it's not necessary to switch to PL_strcasecmp, I think. I also changed the name of two variables (since I'm introducing "firsthndot"), but other than that, there are no changes to the code logic.
> Eliminate the elses immediately after returns. They serve no purpose.
Done.
> Unindent the final block and remove the braces from it.
Done.
> Did you mean to disallow trailing dots from the patterns?
> The present rules allow
> *.a.b.
> but do not allow
> *.a.
> Is that intentional?
Yes. It follows from implementing your suggestion in comment 25:
> a new restriction, that wildcards must be followed by at least
> two dots (that is, two domains) excluding a trailing dot
["*.a." is only followed by one dot, not counting the trailing one.]
> Oh, and put an asterisk in every line in the block comment, so they
> form a column.
Done.