Hylafax Mailing List Archives
|
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
Re: tsi problem
RICK_@t-online.de (Juergen Anzer) writes:
> > Hylafax incorrectly rejects incoming fax with empty (but present) TSI
> > despite of "^.*$" rule in the etc/tsi. The problem is in the following code
> > (util/RegEx.c++):
> >
> > [---cut--]
> > fxBool
> > RegEx::Find(const char* text, u_int length, u_int off)
> > {
> > if (compResult == 0) {
> > /*
> > * These two checks are for compatibility with the old
> > * InterViews code; yech (but the DialRules logic needs it).
> > */
> > if (off >= length || (off != 0 && _pattern[0] == '^'))
> > execResult = REG_NOMATCH;
> > else {
> > matches[0].rm_so = off;
> > matches[0].rm_eo = length;
> > execResult = regexec(&c_pattern, text, c_pattern.re_nsub+1,
> > matches, REG_STARTEND);
> > }
> > }
> > return (execResult == 0);
> > }
> > [---cut---]
> >
> > Needless to say that Find() reports no match in case of empty string
> > because of the first if() condition ( length and ofs == 0 ). I would change
> > this to something like
> >
> > ((off || length) && off >= length) || (off && _pattern[0] == '^')
> >
> > if not the reference to "InterViews code" in the comment. Does anybody know
> > that is this? BTW, DialRules logic should not be broken if the above
> > changes are applied.
>
> I have no chance to have a look into the source right now, but I think the problem
> is more difficult.
>
> If you apply the above changes, wouldn´t you open the door to all (null)-TSI spam
> faxes although TSI checking is enabled?
No way, because if you apply my patch, regexec() in else{} branch will
decide if "" string is acceptable. If there is a suitable pattern like
"^.*$" it will be accepted, otherwise rejected (at least it should unless
regex library used in Hylafax is totally broken). The cause of problems is
buggy _extra_ check (besides regex matching), which seems to be mostly
redundant. What is why I asked for explanation what is "InterViews code"
mentioned in the original comments.
Hope to hear from you soon,
Dmitry