Requestor parsing errors

Here’s a good one:

I’m having a problem with the parsing for the requestor in both the
e-mail interface and the WebUI – no matter who requests the ticket RT
always inserts a fixed integer in the requestor field. It then reacts
as if the integer (4294967295) is the username of the requestor and will
send an email to 4294967295@fqdn, etc. What’s goin’ on?

I’ve got nothing customized about RT at this point and this is my
configuration:

Mandrake Linux 2,4,8-26mdk
Apache-AdvancedExtranetServer/1.3.20 (Mandrake Linux/3mdk)
Perl 5.6.1
mod_fastcgi-2.2.12
Postfix (postfix-20010228-15mdk)
All dependencies checked out fine with 'make testdeps’
All dependencies are from CPAN less than 10 days ago.

Below is a slightly modified version of the config.pm (names & passwords
changed to protect the innocent et al).

What did I screw up here? Please cc me in response :slight_smile:

Fred

Fred Purdue General Technology Group
E: Fred@GTGCorp.com www.gtgcorp.com
P: (203) 235-7175 164 Scott St - Suite 1
C: (203) 605-6853 Meriden, CT 06450

---------8<-----------------
[root@helpdesk etc]# cat config.pm

$Header: /raid/cvsroot/rt/etc/config.pm,v 1.17 2002/02/18 21:36:46

jesse Exp $

package RT;

{{{ Base Configuration

$rtname the string that RT will look for in mail messages to

figure out what ticket a new piece of mail belongs to

Your domain name is recommended, so as not to pollute the namespace.

once you start using a given tag, you should probably never change it.

(otherwise, mail for existing tickets won’t get put in the right place

$rtname=“corp.newoppinc.org”;

You should set this to your organization’s DNS domain. For example,

fsck.com or asylum.arkham.ma.us. It’s used by the linking interface to

guarantee that ticket URIs are unique and easy to construct.

$Organization = “newopportunitiesinc.org”;

$user_passwd_min defines the minimum length for user passwords.

Setting

it to 0 disables this check

$MinimumPasswordLength = “0”;

$Timezone is used to convert times entered by users into GMT and back

again

It should be set to a timezone recognized by your local unix box.

$Timezone = ‘US/Eastern’;

LogDir is where RT writes its logfiles.

This directory should be writable by your rt group

$LogDir = “/usr/local/rt/log”;

}}}

{{{ Database Configuration

Database driver beeing used - i.e. MySQL.

$DatabaseType=“mysql”;

The domain name of your database server

If you’re running mysql and it’s on localhost,

leave it blank for enhanced performance

$DatabaseHost=“localhost”;

The port that your database server is running on. Ignored unless it’s

a positive integer. It’s usually safe to leave this blank

$DatabasePort="";

#The name of the database user (inside the database)
$DatabaseUser=’<rt_user account>’;

Password the DatabaseUser should use to access the database

$DatabasePassword=’<rt_user password>’;

The name of the RT’s database on your database server

$DatabaseName=‘rt2’;

If you’re using Postgres and have compiled in SSL support,

set DatabaseRequireSSL to 1 to turn on SSL communication

$DatabaseRequireSSL=undef;

}}}

{{{ Incoming mail gateway configuration

OwnerEmail is the address of a human who manages RT. RT will send

errors generated by the mail gateway to this address. This address

should not be an address that’s managed by your RT instance.

$OwnerEmail = ‘fpurdue@newopportunitiesinc.org’;

If $LoopsToRTOwner is defined, RT will send mail that it believes

might be a loop to $RT::OwnerEmail

$LoopsToRTOwner = 1;

If $StoreLoopss is defined, RT will record messages that it believes

to be part of mail loops.

As it does this, it will try to be careful not to send mail to the

sender of these messages

$StoreLoops = undef;

$MaxAttachmentSize sets the maximum size (in bytes) of attachments

stored

in the database.

For mysql and oracle, we set this size at 10 megabytes.

If you’re running a postgres version earlier than 7.1, you will need

to drop this to 8192. (8k)

$MaxAttachmentSize = 10000000;

$TruncateLongAttachments: if this is set to a non-undef value,

RT will truncate attachments longer than MaxAttachmentLength.

$TruncateLongAttachments = undef;

$DropLongAttachments: if this is set to a non-undef value,

RT will silently drop attachments longer than MaxAttachmentLength.

$DropLongAttachments = undef;

If $ParseNewMessageForTicketCcs is true, RT will attempt to divine

Ticket ‘Cc’ watchers from the To and Cc lines of incoming messages

Be forewarned that if you have any addresses which forward mail to

RT automatically and you enable this option without modifying

“IsRTAddress” below, you will get yourself into a heap of trouble.

And well, this is free software, so there isn’t a warrantee, but

I disclaim all ability to help you if you do enable this without

modifying IsRTAddress below.

$ParseNewMessageForTicketCcs = undef;

IsRTAddress is used to make sure RT doesn’t add itself as a ticket CC

if

the setting above is enabled.

not sure that I’m putting here so i’m make a note of this

the original below line was ’ my $address = shift; ’

sub IsRTAddress {

my $address = ~ /^support@helpdesk.newopportunitiesinc.org$/i);

my $address = 'support@helpdesk.newopportunitiesinc.org';	

# Example: the following rule would tell RT not to Cc 
#	"tickets@noc.example.com"
# return(1) if ($address =~ /^tickets\@noc.example.com$/i);

return(undef)

}

CanonicalizeAddress converts email addresses into canonical form.

it takes one email address in and returns the proper canonical

form. You can dump whatever your proper local config is in here

sub CanonicalizeAddress {
my $email = ~
s/@(.).newopportunitiesinc.org/@newopportunitiesinc.org/;
# Example: the following rule would treat all email
# coming from a subdomain as coming from second level domain
# foo.com
#$email =~ s/@(.
).foo.com/@foo.com/;
return ($email)
}

If $LookupSenderInExternalDatabase is defined, RT will attempt to

verify the incoming message sender with a known source, using the

LookupExternalUserInfo routine below

$LookupSenderInExternalDatabase = undef;

If $SenderMustExistInExternalDatabase is true, RT will refuse to

create non-privileged accounts for unknown users if you are using

the “LookupSenderInExternalDatabase” option.

Instead, an error message will be mailed and RT will forward the

message to $RTOwner.

If you are not using $LookupSenderInExternalDatabase, this option

has no effect.

If you define an AutoRejectRequest template, RT will use this

template for the rejection message.

$SenderMustExistInExternalDatabase = undef;

LookupExternalUserInfo is a site-definable method for synchronizing

incoming users with an external data source.

This routine takes a tuple of EmailAddress and FriendlyName

EmailAddress is the user’s email address, ususally taken from

an email message’s From: header.

FriendlyName is a freeform string, ususally taken from the “comment”

portion of an email message’s From: header.

It returns (FoundInExternalDatabase, ParamHash);

FoundInExternalDatabase must be set to 1 before return if the user

was

found in the external database.

ParamHash is a Perl parameter hash which can contain at least the

following

fields. These fields are used to populate RT’s users database when

the user # is created

EmailAddress is the email address that RT should use for this user.

Name is the ‘Name’ attribute RT should use for this user.

‘Name’ is used for things like access control and user

lookups.

RealName is what RT should display as the user’s name when displaying

‘friendly’ names

sub LookupExternalUserInfo {
my ($EmailAddress, $RealName) = @_;

my $FoundInExternalDatabase = 1;
my %params = {};

#Name is the RT username you want to use for this user.
$params{‘Name’} = $EmailAddress;
$params{‘EmailAddress’} = $EmailAddress;
$params{‘RealName’} = $RealName;

See RT’s contributed code for examples.

http://www.fsck.com/pub/rt/contrib/

return ($FoundInExternalDatabase, %params);
}

}}}

{{{ Outgoing mail configuration

RT is designed such that any mail which already has a ticket-id

associated

with it will get to the right place automatically.

$CorrespondAddress and $CommentAddress are the default addresses

that will be listed in From: and Reply-To: headers of correspondence

and comment mail tracked by RT, unless overridden by a queue-specific

address.

$CorrespondAddress=‘Support@NewOpportuntiesInc.org’;

$CommentAddress=‘Support-Comments@NewOpportuntiesInc.org’;

#Sendmail Configuration

$MailCommand defines which method RT will use to try to send mail

We know that ‘sendmail’ works fairly well.

If ‘sendmail’ doesn’t work well for you, try ‘sendmailpipe’

But note that you have to configure $SendmailPath and add a -t

to $SendmailArguments

$MailCommand = ‘sendmail’;

$SendmailArguments defines what flags to pass to $Sendmail

assuming you picked ‘sendmail’ or ‘sendmailpipe’ as the $MailCommand

above.

If you picked ‘sendmailpipe’, you MUST add a -t flag to

$SendmailArguments

These options are good for most sendmail wrappers and workalikes

$SendmailArguments="-oi";

These arguments are good for sendmail brand sendmail 8 and newer

#$SendmailArguments="-oi -ODeliveryMode=b -OErrorMode=m";

If you selected ‘sendmailpipe’ above, you MUST specify the path

to your sendmail binary in $SendmailPath.

!! If you did not # select ‘sendmailpipe’ above, this has no effect!!

$SendmailPath = “/usr/sbin/sendmail”;

RT can optionally set a “Friendly” ‘To:’ header when sending messages

to

Ccs or AdminCcs (rather than having a blank ‘To:’ header.

This feature DOES NOT WORK WITH SENDMAIL[tm] BRAND SENDMAIL

If you are using sendmail, rather than postfix, qmail, exim or some

other MTA,# you must disable this option.

$UseFriendlyToLine = 0;

}}}

{{{ Logging

Logging. The default is to log anything except debugging

information to a logfile. Check the Log::Dispatch POD for

information about how to get things by syslog, mail or anything

else, get debugging info in the log, etc.

It might generally make

sense to send error and higher by email to some administrator.

If you do this, be careful that this email isn’t sent to this RT

instance.

the minimum level error that will be logged to the specific device.

levels from lowest to highest:

debug info notice warning error critical alert emergency

Mail loops will generate a critical log message.

$LogToScreen = ‘error’;
$LogToFile = ‘error’;
$LogToFileNamed = “$LogDir/rt.log.”.$$.".".$<; #log to
rt.log..

}}}

{{{ Web interface configuration

Define the directory name to be used for images in rt web

documents.

If you’re putting the web ui somewhere other than at the root of

your server

$WebPath requires a leading / but no trailing /

$WebPath = “”;

This is the Scheme, server and port for constructing urls to webrt

$WebBaseURL doesn’t need a trailing

/

$WebBaseURL = “http://helpdesk.corp.newoppinc.org”;

$WebURL = $WebBaseURL . $WebPath . “/”;

$WebImagesURL points to the base URL where RT can find its images.

If you’re running the FastCGI version of the RT web interface,

you should make RT’s WebRT/html/NoAuth/images directory available on

a static web server and supply that URL as $WebImagesURL.

$WebImagesURL = $WebURL.“NoAuth/images/”;

$RTLogoURL points to the URL of the RT logo displayed in the web UI

$LogoURL = $WebImagesURL.“rt.jpg”;

If $WebExternalAuth is defined, RT will defer to the environment’s

REMOTE_USER variable.

$WebExternalAuth = undef;

$MasonComponentRoot is where your rt instance keeps its mason html

files

(this should be autoconfigured during ‘make install’ or 'make

upgrade’)

$MasonComponentRoot = “/usr/local/rt/WebRT/html”;

$MasonLocalComponentRoot is where your rt instance keeps its

site-local

mason html files.

(this should be autoconfigured during ‘make install’ or 'make

upgrade’)

$MasonLocalComponentRoot = “/usr/local/rt/local/WebRT/html”;

$MasonDataDir Where mason keeps its datafiles

(this should be autoconfigured during ‘make install’ or 'make

upgrade’)

$MasonDataDir = “/usr/local/rt/WebRT/data”;

RT needs to put session data (for preserving state between connections

via the web interface)

$MasonSessionDir = “/usr/local/rt/WebRT/sessiondata”;

#This is from tobias’ prototype web search UI. it may stay and it may
go.
%WebOptions=
(
# This is for putting in more user-actions at the Transaction
# bar. I will typically add “Enter bug in Bugzilla” here.:
ExtraTransactionActions => sub { return “”; },

 # Here you can modify the list view.  Be aware that the web
 # interface might crash if TicketAttribute is wrongly set.
 
 QueueListingCols => 
  [
   { Header     => 'Id',
 TicketLink => 1,
 TicketAttribute => 'Id'
 },

  { Header     => 'Subject',
 TicketAttribute => 'Subject'
 },
   { Header => 'Requestor(s)',
 TicketAttribute => 'RequestorsAsString'
 },
   { Header => 'Status',
 TicketAttribute => 'Status'
 },


   { Header => 'Queue',
 TicketAttribute => 'QueueObj->Name'
 },



   { Header => 'Told',
 TicketAttribute => 'ToldObj->AgeAsString'
 },

   { Header => 'Age',
 TicketAttribute => 'CreatedObj->AgeAsString'
 },

   { Header => 'Last',
 TicketAttribute => 'LastUpdatedObj->AgeAsString'
 },

   # TODO: It would be nice with a link here to the Owner and all
   # other request owned by this Owner.
   { Header => 'Owner',
 TicketAttribute => 'OwnerObj->Name'
   },


   { Header     => 'Take',
 TicketLink => 1,
 Constant   => 'Take',
 ExtraLinks => '&Action=Take'
 },

  ]
 );

}}}

{{{ RT Linking Interface

$TicketBaseURI is the Base path of the URI for local tickets

You shouldn’t need to touch this. it’s used to link tickets both

locally

and remotely

$TicketBaseURI = “fsck.com-rt://$Organization/$rtname/ticket/”;

A hash table of conversion subs to be used for transforming RT Link

URIs to URLs in the web interface. If you want to use RT towards

locally installed databases, this is the right place to configure it.

%URI2HTTP=
(
‘http’ => sub {return @;},
‘https’ => sub {return @
;},
‘ftp’ => sub {return @_;},
‘fsck.com-rt’ => sub {warn “stub!”;},
‘mozilla.org-bugzilla’ => sub {warn “stub!”},
‘fsck.com-kb’ => sub {warn “stub!”}
);

A hash table of subs for fetching content from an URI

%ContentFromURI=
(
‘fsck.com-rt’ => sub {warn “stub!”;},
‘mozilla.org-bugzilla’ => sub {warn “stub!”},
‘fsck.com-kb’ => sub {warn “stub!”}
);

}}}

{{{ No User servicable parts inside

Don’t edit anything below this line unless you really know

what you’re doing

TODO: get this stuff out of the config file and into RT.pm

#Set up us the timezone
$ENV{‘TZ’} = $Timezone; #TODO: Bogus hack to deal with Date::Manip
whining

Configure sendmail if we’re using Entity->send(‘sendmail’)

if ($MailCommand eq ‘sendmail’) {
$MailParams = $SendmailArguments;
}

}}}

1;

|+ Mandrake Linux 2,4,8-26mdk
|+ Apache-AdvancedExtranetServer/1.3.20 (Mandrake Linux/3mdk)
|+ Perl 5.6.1
|+ mod_fastcgi-2.2.12
|+ Postfix (postfix-20010228-15mdk)
|+ All dependencies checked out fine with ‘make testdeps’
|+ All dependencies are from CPAN less than 10 days ago.

What version of RT?

Darrin,

The version is 2.0.12

I found the cause of the problem (but not really the solution)

" my $email = ~
s/@(.*).newopportunitiesinc.org/@newopportunitiesinc.org/; "

The Canonical address translation was nuking anything that went through
it. Once I replaced it with shift; and restarted httpd everything
worked fine. My string looks exactly like the foo.com example that
comes in config.pm. Any ideas what is wrong with it? Could the problem
be that some of the mail is coming from/to another domain?
(corp.newoppinc.org)?

Fred Purdue General Technology Group
E: Fred@GTGCorp.com www.gtgcorp.com
P: (203) 235-7175 164 Scott St - Suite 1
C: (203) 605-6853 Meriden, CT 06450

  |+ Mandrake Linux 2,4,8-26mdk
  |+ Apache-AdvancedExtranetServer/1.3.20 (Mandrake Linux/3mdk)
  |+ Perl 5.6.1
  |+ mod_fastcgi-2.2.12
  |+ Postfix (postfix-20010228-15mdk)
  |+ All dependencies checked out fine with 'make testdeps'
  |+ All dependencies are from CPAN less than 10 days ago.

What version of RT?

Fred Purdue General Technology Group
E: Fred@GTGCorp.com www.gtgcorp.com
P: (203) 235-7175 164 Scott St - Suite 1
C: (203) 605-6853 Meriden, CT 06450

Hi!

Loving RT, this time round my experience has been much more fun, given I
understand a bit more about Perl and Mason since the last time.

In fact I’m going to put this into production for our sales team in a week
or so.

There are a couple of things I’d like to do first though. The first one is
that we have an existing web-based app that handles our clients and
billing. Each object in that is referred to be a unique ID (a single
character check letter, and some digits).

I managed to modify the user stuff to allow me to use the
ExternalContactInfoId for this ID. And I can edit the id in the user
editor. No sweat so far.

I can even display the id next to the email address next to each email
address in the Requestors list (in the People boxes).

What I can’t do, is link to the other web application using this. If I
provide a string with <A HREF … etc in it, RT (Mason?) escapes it and I
of course see the actual string.

It seems that the ‘right’ way to do this might have something to do with
the URI2HTTP hash in in etc/config.pm - so rather than provide a entire
link in my code, I would do something like: ext://A123456. I may be wrong
here though. I can’t get that to work though:

%URI2HTTP=
(
‘http’ => sub {return @;},
‘https’ => sub {return @
;},
‘ftp’ => sub {return @_;},
‘ext’ => sub {return “http://ext.intranet:8999”;},
‘fsck.com-rt’ => sub {warn “stub!”;},
‘mozilla.org-bugzilla’ => sub {warn “stub!”},
‘fsck.com-kb’ => sub {warn “stub!”}
);

Doesn’t seem to do anything at all.

Otherwise, I am happy to do the <A HREFing myself, if I can stop the GUI
from escaping my code somehow.

My other web application needs to be simply referenced as
http://ext.intranet:8999/idnum

Any clues much appreciated.

- Justin

Justin Hawkins
Internode Professional Access

Steinbach’s Guideline for Systems Programming:
Never test for an error condition you don’t know how to
handle.

Justin Hawkins wrote:

Otherwise, I am happy to do the <A HREFing myself, if I can stop the GUI
from escaping my code somehow.

You can put |n at the end of a Mason expression to prevent it being
escaped, for example:

<%$name%>

For details see perldoc HTML::Mason::Devel and search for “Escaping
expressions”.

My other web application needs to be simply referenced as
http://ext.intranet:8999/idnum

But if your IDs are just letters and digits surely it isn’t being
escaped anyway:

other web app

Smylers
GBdirect
http://www.gbdirect.co.uk/

<%$name%>

For details see perldoc HTML::Mason::Devel and search for “Escaping
expressions”.

This isn’t going to help me.

Even things like the “<a href” are being escaped at some point, turning
into something like “<a href” etc. Obviously this stops it from working
as a link :slight_smile:

To be more precise, I’ve added a method to Watcher.pm called ‘Ext’ which
fetches the ExternalContactInfoId from the OwnerObj, and creates an A HREF
string URL of it.

Then in the Emails method in Watchers.pm, I modified the method such:

while (my $watcher=$self->Next()) {
    push(@list, $watcher->Email . " (" .  $watcher->Ext . ")");
}

This has the right effect, except the string is escaped at some point that
I can’t yet determine, and isn’t a link anymore by the time it gets to the
client.

- Justin

Justin Hawkins
Internode Professional Access

We have only two things to worry about: That things will never get
back to normal, and that they already have.

You can put |n at the end of a Mason expression to prevent it being
escaped, for example:

<%$name%>

Hi Smylers,

I must apologize, my head must have been filled with wool when I read (and
replied) to this response originally.

What you’ve said does indeed work perfectly, I’ve appeneded it to the end
of the $Ticket->RequestorsAsString in
WebRT/html/Ticket/Elements/ShowPeople, and I’m getting the desired
behaviour.

Thanks!

I’ll have to ensure that the requestors strings can’t inadvertantly have
HTMl in them, to make sure this doesn’t break stuff. I think I’m safe but
will do some investigation.

- Justin

Justin Hawkins
Internode Professional Access

Absurdity, n.:
A statement or belief manifestly inconsistent with one’s own
opinion.
– Ambrose Bierce, “The Devil’s Dictionary”