HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Problem with empty sender's TSI



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.

Hope to hear from you soon,
Dmitry





Project hosted by iFAX Solutions