CanonicalizeEmailAddressMatch/Replace Problems

Alle,

Running RT 3.6.6, RHEL 5.3, Apache 2.2.3 and Perl v5.8.8. When we try 

to use the following in RT_SiteConfig.pm, nothing changes:

Set($CanonicalizeEmailAddressMatch , ‘@domain.example.ac.jp$’);
Set($CanonicalizeEmailAddressReplace , ‘@domain.example.org’);

Internally, we are domain.example.ac.jp but externally we are 

domain.example.org (long story). What are we missing. Below are the
relevant(?) log entries:

[Wed Apr 22 20:59:49 2009] [debug]: RT::User::CanonicalizeEmailAddress :
called with “naojtest@domain.example.ac.jp” by RT::CurrentUser
/opt/rt3/lib/RT/CurrentUser.pm 218 (/opt/rt3/local/lib/RT/User_Local.pm:328)
[Wed Apr 22 20:59:49 2009] [info]: RT::User::CanonicalizeEmailAddress
naojtest@domain.example.ac.jp => naojtest@domain.example.ac.jp
(/opt/rt3/local/lib/RT/User_Local.pm:347)
[Wed Apr 22 20:59:49 2009] [debug]: RT::User::CanonicalizeUserInfo
called by RT::User /opt/rt3/lib/RT/User_Overlay.pm 192 with: Comments:
Autocreated on ticket submission, Disabled: 0, EmailAddress:
naojtest@domain.example.ac.jp, Name: naojtest@domain.example.ac.jp,
Password: , Privileged: 0, RealName: (Test User)
(/opt/rt3/local/lib/RT/User_Local.pm:380)
[Wed Apr 22 20:59:49 2009] [info]: RT::User::CanonicalizeUserInfo
returning Comments: Autocreated on ticket submission, Disabled: 0,
EmailAddress: naojtest@domain.example.ac.jp, Name:
naojtest@domain.example.ac.jp, Password: , Privileged: 0, RealName:
(Test User) (/opt/rt3/local/lib/RT/User_Local.pm:413)
[Wed Apr 22 20:59:49 2009] [debug]: RT::User::CanonicalizeEmailAddress :
called with “naojtest@domain.example.ac.jp” by RT::User
/opt/rt3/lib/RT/User_Overlay.pm 196
(/opt/rt3/local/lib/RT/User_Local.pm:328)
[Wed Apr 22 20:59:49 2009] [info]: RT::User::CanonicalizeEmailAddress
naojtest@domain.example.ac.jp => naojtest@domain.example.ac.jp
(/opt/rt3/local/lib/RT/User_Local.pm:347)
[Wed Apr 22 20:59:49 2009] [debug]: RT::User::CanonicalizeEmailAddress :
called with “naojtest@domain.example.ac.jp” by RT::User
/opt/rt3/lib/RT/User_Overlay.pm 563
(/opt/rt3/local/lib/RT/User_Local.pm:328)
[Wed Apr 22 20:59:49 2009] [info]: RT::User::CanonicalizeEmailAddress
naojtest@domain.example.ac.jp => naojtest@domain.example.ac.jp
(/opt/rt3/local/lib/RT/User_Local.pm:347)
[Wed Apr 22 20:59:49 2009] [debug]: RT::User::CanonicalizeEmailAddress :
called with “naojtest@domain.example.ac.jp” by RT::User
/opt/rt3/lib/RT/User_Overlay.pm 563
(/opt/rt3/local/lib/RT/User_Local.pm:328)
[Wed Apr 22 20:59:49 2009] [info]: RT::User::CanonicalizeEmailAddress
naojtest@domain.example.ac.jp => naojtest@domain.example.ac.jp
(/opt/rt3/local/lib/RT/User_Local.pm:347)
[Wed Apr 22 20:59:50 2009] [debug]: RT::User::CanonicalizeEmailAddress :
called with “naojtest@domain.example.ac.jp” by RT::CurrentUser
/opt/rt3/lib/RT/CurrentUser.pm 218 (/opt/rt3/local/lib/RT/User_Local.pm:328)
[Wed Apr 22 20:59:50 2009] [info]: RT::User::CanonicalizeEmailAddress
naojtest@domain.example.ac.jp => naojtest@domain.example.ac.jp
(/opt/rt3/local/lib/RT/User_Local.pm:347)

Best Regards,
Camron

Camron W. Fox
Hilo Office
High Performance Computing Group
Fujitsu Management Services of America, Inc.
E-mail: cwfox@us.fujitsu.com

Camron,

We do not include the ‘@’ in our regex here, but if you do,
shouldn’t it be escaped as well as the ‘.’ characters?

Cheers,
KenOn Wed, Apr 22, 2009 at 11:14:33AM -1000, Camron W. Fox wrote:

Alle,

Running RT 3.6.6, RHEL 5.3, Apache 2.2.3 and Perl v5.8.8. When we try
to use the following in RT_SiteConfig.pm, nothing changes:

Set($CanonicalizeEmailAddressMatch , ‘@domain.example.ac.jp$’);
Set($CanonicalizeEmailAddressReplace , ‘@domain.example.org’);

Internally, we are domain.example.ac.jp but externally we are
domain.example.org (long story). What are we missing. Below are the
relevant(?) log entries:

[Wed Apr 22 20:59:49 2009] [debug]: RT::User::CanonicalizeEmailAddress :
called with “naojtest@domain.example.ac.jp” by RT::CurrentUser
/opt/rt3/lib/RT/CurrentUser.pm 218 (/opt/rt3/local/lib/RT/User_Local.pm:328)
[Wed Apr 22 20:59:49 2009] [info]: RT::User::CanonicalizeEmailAddress
naojtest@domain.example.ac.jp => naojtest@domain.example.ac.jp
(/opt/rt3/local/lib/RT/User_Local.pm:347)
[Wed Apr 22 20:59:49 2009] [debug]: RT::User::CanonicalizeUserInfo
called by RT::User /opt/rt3/lib/RT/User_Overlay.pm 192 with: Comments:
Autocreated on ticket submission, Disabled: 0, EmailAddress:
naojtest@domain.example.ac.jp, Name: naojtest@domain.example.ac.jp,
Password: , Privileged: 0, RealName: (Test User)
(/opt/rt3/local/lib/RT/User_Local.pm:380)
[Wed Apr 22 20:59:49 2009] [info]: RT::User::CanonicalizeUserInfo
returning Comments: Autocreated on ticket submission, Disabled: 0,
EmailAddress: naojtest@domain.example.ac.jp, Name:
naojtest@domain.example.ac.jp, Password: , Privileged: 0, RealName:
(Test User) (/opt/rt3/local/lib/RT/User_Local.pm:413)
[Wed Apr 22 20:59:49 2009] [debug]: RT::User::CanonicalizeEmailAddress :
called with “naojtest@domain.example.ac.jp” by RT::User
/opt/rt3/lib/RT/User_Overlay.pm 196
(/opt/rt3/local/lib/RT/User_Local.pm:328)
[Wed Apr 22 20:59:49 2009] [info]: RT::User::CanonicalizeEmailAddress
naojtest@domain.example.ac.jp => naojtest@domain.example.ac.jp
(/opt/rt3/local/lib/RT/User_Local.pm:347)
[Wed Apr 22 20:59:49 2009] [debug]: RT::User::CanonicalizeEmailAddress :
called with “naojtest@domain.example.ac.jp” by RT::User
/opt/rt3/lib/RT/User_Overlay.pm 563
(/opt/rt3/local/lib/RT/User_Local.pm:328)
[Wed Apr 22 20:59:49 2009] [info]: RT::User::CanonicalizeEmailAddress
naojtest@domain.example.ac.jp => naojtest@domain.example.ac.jp
(/opt/rt3/local/lib/RT/User_Local.pm:347)
[Wed Apr 22 20:59:49 2009] [debug]: RT::User::CanonicalizeEmailAddress :
called with “naojtest@domain.example.ac.jp” by RT::User
/opt/rt3/lib/RT/User_Overlay.pm 563
(/opt/rt3/local/lib/RT/User_Local.pm:328)
[Wed Apr 22 20:59:49 2009] [info]: RT::User::CanonicalizeEmailAddress
naojtest@domain.example.ac.jp => naojtest@domain.example.ac.jp
(/opt/rt3/local/lib/RT/User_Local.pm:347)
[Wed Apr 22 20:59:50 2009] [debug]: RT::User::CanonicalizeEmailAddress :
called with “naojtest@domain.example.ac.jp” by RT::CurrentUser
/opt/rt3/lib/RT/CurrentUser.pm 218 (/opt/rt3/local/lib/RT/User_Local.pm:328)
[Wed Apr 22 20:59:50 2009] [info]: RT::User::CanonicalizeEmailAddress
naojtest@domain.example.ac.jp => naojtest@domain.example.ac.jp
(/opt/rt3/local/lib/RT/User_Local.pm:347)

Best Regards,
Camron


Camron W. Fox
Hilo Office
High Performance Computing Group
Fujitsu Management Services of America, Inc.
E-mail: cwfox@us.fujitsu.com


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Kenneth Marshall wrote:

Camron,

We do not include the ‘@’ in our regex here, but if you do,
shouldn’t it be escaped as well as the ‘.’ characters?

Cheers,
Ken

Ken,

We're just following the example from the documentation and RT_Config.pm:

RT provides functionality which allows the system to rewrite

incoming email addresses. In its simplest form,

you can substitute the value in CanonicalizeEmailAddressReplace

for the value in CanonicalizeEmailAddressMatch

(These values are passed to the CanonicalizeEmailAddress subroutine in

RT/User.pm)

By default, that routine performs a s/$Match/$Replace/gi on any

address passed to it

#Set($CanonicalizeEmailAddressMatch , ‘@subdomain.example.com$’);
#Set($CanonicalizeEmailAddressReplace , ‘@example.com’);

We've tested s/$Match/$Replace/gi with the same regex and it works, so 

that’s why we thought we might be missing something.

Best Regards,
Camron

Camron W. Fox
Hilo Office
High Performance Computing Group
Fujitsu Management Services of America, Inc.
E-mail: cwfox@us.fujitsu.com

It is a bit pedantic, but have you flushed the Mason cache
and restarted RT?

KenOn Thu, Apr 23, 2009 at 07:42:50AM -1000, Camron W. Fox wrote:

Kenneth Marshall wrote:

Camron,

We do not include the ‘@’ in our regex here, but if you do,
shouldn’t it be escaped as well as the ‘.’ characters?

Cheers,
Ken

Ken,

We’re just following the example from the documentation and RT_Config.pm:

RT provides functionality which allows the system to rewrite

incoming email addresses. In its simplest form,

you can substitute the value in CanonicalizeEmailAddressReplace

for the value in CanonicalizeEmailAddressMatch

(These values are passed to the CanonicalizeEmailAddress subroutine in

RT/User.pm)

By default, that routine performs a s/$Match/$Replace/gi on any

address passed to it

#Set($CanonicalizeEmailAddressMatch , ‘@subdomain.example.com$’);
#Set($CanonicalizeEmailAddressReplace , ‘@example.com’);

We’ve tested s/$Match/$Replace/gi with the same regex and it works, so
that’s why we thought we might be missing something.

Best Regards,
Camron

Camron W. Fox
Hilo Office
High Performance Computing Group
Fujitsu Management Services of America, Inc.
E-mail: cwfox@us.fujitsu.com


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Kenneth Marshall wrote:

It is a bit pedantic, but have you flushed the Mason cache
and restarted RT?

Ken

Ken,

We *did* restart Apache, but as we weren't using 

CanonicalizeEmailAddressMatch/Replace prior to this, there shouldn’t be
anything cached there, should there?

Best Regards,
Camron

Camron W. Fox
Hilo Office
High Performance Computing Group
Fujitsu Management Services of America, Inc.
E-mail: cwfox@us.fujitsu.com

Do a recursive grep on the files in the Mason cache for the
variable or regex. It may be cached but I am not familiar enough
with the startup process to know without checking. A cached
“no value” would result in the behavior you are seeing.

Cheers,
KenOn Thu, Apr 23, 2009 at 08:19:24AM -1000, Camron W. Fox wrote:

Kenneth Marshall wrote:

It is a bit pedantic, but have you flushed the Mason cache
and restarted RT?

Ken

Ken,

We did restart Apache, but as we weren’t using
CanonicalizeEmailAddressMatch/Replace prior to this, there shouldn’t be
anything cached there, should there?

Best Regards,
Camron

Camron W. Fox
Hilo Office
High Performance Computing Group
Fujitsu Management Services of America, Inc.
E-mail: cwfox@us.fujitsu.com


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Kenneth Marshall wrote:

Do a recursive grep on the files in the Mason cache for the
variable or regex. It may be cached but I am not familiar enough
with the startup process to know without checking. A cached
“no value” would result in the behavior you are seeing.

Cheers,
Ken

Ken,

And the winner is...neither...

[root@admin mason_data]# find . -exec grep -i canon {} ;

This code canonicalizes time inputs in hours into minutes

 if ( RT::Interface::Web::WebCanonicalizeInfo() ) {
     $user = RT::Interface::Web::WebCanonicalizeInfo();

[root@admin mason_data]# find . -exec grep ‘domain.example.ac.jp’ {} ;
[root@admin mason_data]# find . -exec grep ‘domain.example.org’ {} ;
[root@admin mason_data]#

Best Regards,
Camron

Camron W. Fox
Hilo Office
High Performance Computing Group
Fujitsu Management Services of America, Inc.
E-mail: cwfox@us.fujitsu.com

Are you making the changes to the RT_SiteConfig.pm file in
the correct directory, on the right host? I know that I have
spent some time trying to figure out why changes had no effect
myself… :slight_smile: If it is not that, it sounds like time for the
standalone perl httpd and a debugger – ugh.

Good luck,
KenOn Thu, Apr 23, 2009 at 08:38:55AM -1000, Camron W. Fox wrote:

Kenneth Marshall wrote:

Do a recursive grep on the files in the Mason cache for the
variable or regex. It may be cached but I am not familiar enough
with the startup process to know without checking. A cached
“no value” would result in the behavior you are seeing.

Cheers,
Ken

Ken,

And the winner is…neither…

[root@admin mason_data]# find . -exec grep -i canon {} ;

This code canonicalizes time inputs in hours into minutes

 if ( RT::Interface::Web::WebCanonicalizeInfo() ) {
     $user = RT::Interface::Web::WebCanonicalizeInfo();

[root@admin mason_data]# find . -exec grep ‘domain.example.ac.jp’ {} ;
[root@admin mason_data]# find . -exec grep ‘domain.example.org’ {} ;
[root@admin mason_data]#

Best Regards,
Camron

Camron W. Fox
Hilo Office
High Performance Computing Group
Fujitsu Management Services of America, Inc.
E-mail: cwfox@us.fujitsu.com


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com