Content Type Header

Ok below is the code that I tried and the error that it produced. It is
probably due to the way that I used the code you provided for the
header, however any help is greatly appreciated.

I have not included the ENTIRE script here as the other part is
irrelevant, and works when not associated with mason, also I did not get
errors when this ran without the new $r->content_type(blah) code below,
it simply didn’t work and printed out the header as text.

START CODE
<%perl>

use strict;
use DBI();
use Spreadsheet::WriteExcel;
use CGI qw(:standard);

my $dbh;
my $worksheet;
my $q=new CGI;
my $row;

#my $type = $q->param(‘type’);
my $type = “Spam”;

Set the filename and send the content type

my $filename =“cgitest.xls”;
$r->content_type(‘application/vnd.ms-excel’);
print “Content-Disposition: attachment; filename=$filename\n”;

END CODE

START ERROR

error: Error during compilation of
/usr/local/rt3/local/html/cgi-bin/reporting/reports/offendersbytypeexcel
.mas:
Prototype mismatch: sub HTML::Mason::Commands::url ($;$) vs none at
/usr/lib/perl5/5.8.3/CGI.pm line 274.

context:

code stack: /usr/lib/perl5/site_perl/5.8.3/HTML/Mason/Interp.pm:317
/usr/lib/perl5/site_perl/5.8.3/HTML/Mason/Request.pm:198
/usr/lib/perl5/site_perl/5.8.3/HTML/Mason/Request.pm:166
/usr/lib/perl5/site_perl/5.8.3/HTML/Mason/ApacheHandler.pm:60
/usr/lib/perl5/site_perl/5.8.3/Class/Container.pm:265
/usr/lib/perl5/site_perl/5.8.3/Class/Container.pm:343
/usr/lib/perl5/site_perl/5.8.3/HTML/Mason/Interp.pm:213
/usr/lib/perl5/site_perl/5.8.3/HTML/Mason/ApacheHandler.pm:863
/usr/lib/perl5/site_perl/5.8.3/HTML/Mason/ApacheHandler.pm:789
/usr/local/rt3/bin/webmux.pl:138
/dev/null:0

END ERROR

Chris Hood
Investigator Verizon Global Security Operations Center
Email: christopher.l.hood@verizon.com
Desk: 972.399.5900

Verizon Proprietary

NOTICE - This message and any attached files may contain information
that is confidential and/or subject of legal privilege intended only for
the use by the intended recipient. If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, be advised that you have received this message in
error and that any dissemination, copying or use of this message or
attachment is strictly forbidden, as is the disclosure of the
information therein. If you have received this message in error please
notify the sender immediately and delete the message.From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of
rt-users-request@lists.bestpractical.com
Sent: Monday, August 02, 2004 6:03 PM
To: rt-users@lists.bestpractical.com
Subject: RT-Users Digest, Vol 5, Issue 4

Send RT-Users mailing list submissions to
rt-users@lists.bestpractical.com

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
or, via email, send a message with subject or body ‘help’ to
rt-users-request@lists.bestpractical.com

You can reach the person managing the list at
rt-users-owner@lists.bestpractical.com

When replying, please edit your Subject line so it is more specific
than “Re: Contents of RT-Users digest…”

Today’s Topics:

  1. Strange RT-Mailgate error (Forrest Stanley)
  2. Re: RT 3.2.1 Custom field in $RT::DefaultSearchResultFormat
    (Jeremy Baumgartner)
  3. RE: RT-Users Digest, Vol 4, Issue 100
    (christopher.l.hood@verizon.com)
  4. Re: RE: RT-Users Digest, Vol 4, Issue 100 (Ruslan U. Zakirov)
  5. problem with rt-3.2.1 & oracle. (Joop van de Wege)
  6. Password Encryption (MikeHamilton@clovisusd.k12.ca.us)
  7. Re: Password Encryption (Ruslan U. Zakirov)
  8. Re: Password Encryption (MikeHamilton@clovisusd.k12.ca.us)

Message: 1
Date: Mon, 02 Aug 2004 11:10:58 -0800
From: Forrest Stanley fstanley@netburner.com
Subject: [rt-users] Strange RT-Mailgate error
To: rt-users@lists.bestpractical.com
Message-ID: 6.1.2.0.2.20040802105846.01f351b8@mail.netburner.com
Content-Type: text/plain; charset=“us-ascii”; format=flowed

Hello,

I have been struggling with this error for about a week. I never saw
this
error running rt2, and started occurring when I updated our version of
RT
to the latest release in the past 2 weeks. Basically, RT works
perfectly
for about 2-3 hours after each time I restart sendmail. Then, for some
reason, I start getting escalation amounts of EX_TEMPFAIL errors
stemming
from mailgate. Sometimes new tickets are created, usually they are
delayed,
and sendmail will try again after a few minutes. This error quickly
expands
to the point of the maillog showing EX_TEMPFAIL errors almost every
second.
I can fix the problem by restarting sendmail (in fact, I set up a cron
job
to do this until I can figure out the error).

I did make a slight change to the way emails are handled via RT. This
may
be causing my errors, but honestly, I don’t see how it could be causing
an
error. I had a similair hack in place in RT2, and had no problems. What
I
did was modify MailFrom.pm, specifially the GetCurrentUser function. I
commented out the parts that allow unknown users the right to create
tickets or even create a user. We use a registration system for RT, so I

don’t want users to be autocreated via Email. After commenting out the
last
half of GetCurrentUser, the function now looks like this:

sub GetCurrentUser {
my %args = ( Message => undef,
CurrentUser => undef,
AuthLevel => undef,
Ticket => undef,
Queue => undef,
Action => undef,
@_ );

 # We don't need to do any external lookups
 my ( $Address, $Name ) = ParseSenderAddressFromHead( 

$args{‘Message’}->head );
my $CurrentUser = RT::CurrentUser->new();
$CurrentUser->LoadByEmail($Address);

 unless ( $CurrentUser->Id ) {
     $CurrentUser->LoadByName($Address);
 }

 if ( $CurrentUser->Id ) {
     return ( $CurrentUser, 1 );
 }

####### Code from this point down is what I added ########

 unless ($CurrentUser->Id) {
         my $Message = "Sender's email address was not found in the 

user database.";
require RT::Template;
my $template = new RT::Template($RT::Nobody);
$template->Load(‘AutoRejectRequest’);
$Message = $template->Content || $Message;

         MailError( To => $ErrorsTo,
                        Subject => "ATTN: NetBurner Support Account 

Required",
Explanation => “$Message”,
MIMEObj => $entity,
LogLevel => ‘crit’
);
return ( $args{‘CurrentUser’}, 0 );
}
}

I am also considering the possibility that this newer version of
sendmail
handles spam differently than the version of sendmail I had running with

rt2. I do get a lot of spam to the account, and it may be flooding the
server.

What really stumps me is the fact that the server will run perfectly for
a
few hours, then slowly degrade to nothing. If anyone has any input, it
would be greatly appreciated.

Forrest Stanley
NetBurner Inc.
fstanley@netburner.com
858-558-0293 x204
"Networking in 1 Day!"
Find out how at http://www.netburner.com

Message: 2
Date: Mon, 02 Aug 2004 14:05:17 -0500
From: Jeremy Baumgartner baumgart@cae.wisc.edu
Subject: Re: [rt-users] RT 3.2.1 Custom field in
$RT::DefaultSearchResultFormat
To: rt-users@lists.bestpractical.com
Message-ID: 1091473517.3503.14.camel@localhost
Content-Type: text/plain

I found a way to make it do what I was looking for. I’ll submit it to
rt-devel to see what they think.

This doesn’t allow sorting by custom field, but that’s not a major issue
for us.

The DefaultSearchResultFormat simply has ‘Area’ listed in it where I
want this to be.

–snip–
— Elements/TicketList.backup Mon Aug 2 13:00:43 2004
+++ Elements/TicketList Mon Aug 2 13:52:10 2004
@@ -131,6 +131,15 @@
}
}
$COLUMN_MAP = {

  • Area => {
  •   title => 'Area',
    
  •   value => sub {
    
  •           my $cf = RT::CustomField->new( $session{'CurrentUser'}
    

);

  •           $cf->LoadByNameAndQueue( Queue => $_[0]->QueueObj->id,
    

Name => ‘area’ );

  •           my $values = $_[0]->CustomFieldValues('".$cf->id."');
    
  •           return ( join( ', ', map { $_->Content } @{
    

$values->ItemsArrayRef } ))

  •   }
    
  • },
    QueueName => {
    attribute => ‘Queue’,
    title => ‘Queue’,
    –snip–

We have several queues, each with their own custom field named “area”.

How can I update the $RT::DefaultSearchResultFormat to display the
correct custom field for the correct queue?

CF.15.{area} works wonderfully. But only for queue id 15. I am
trying
to do something like “CF.$QueueObj->id.{area}”. But I don’t think
$QueueObj is defined at that point. Is there any way to do this?
Jeremy Baumgartner
CAE UNIX Systems Staff

“Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.”

  • Brian W. Kernighan

Message: 3
Date: Mon, 2 Aug 2004 14:03:07 -0500
From: christopher.l.hood@verizon.com
Subject: [rt-users] RE: RT-Users Digest, Vol 4, Issue 100
To: rt-users@lists.bestpractical.com
Message-ID: OF3D1122C3.271647BE-ON05256EE4.00687C0C@CORE.VERIZON.COM
Content-Type: text/plain; charset=us-ascii

I need to send a different header when a script runs, I know how to
create and send the header but the RT header of text/html gets sent
first, and then mine just shows up as text on the page.

How can I circumvent the default RT http header, so the browser gets
mine first or solely ??

Chris Hood
Investigator Verizon Global Security Operations Center
Email: christopher.l.hood@verizon.com
Desk: 972.399.5900

Verizon Proprietary

NOTICE - This message and any attached files may contain information
that is confidential and/or subject of legal privilege intended only for
the use by the intended recipient. If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, be advised that you have received this message in
error and that any dissemination, copying or use of this message or
attachment is strictly forbidden, as is the disclosure of the
information therein. If you have received this message in error please
notify the sender immediately and delete the message.

Message: 4
Date: Mon, 02 Aug 2004 23:23:21 +0400
From: “Ruslan U. Zakirov” cubic@acronis.ru
Subject: Re: [rt-users] RE: RT-Users Digest, Vol 4, Issue 100
To: christopher.l.hood@verizon.com
Cc: rt-users@lists.bestpractical.com
Message-ID: 410E94A9.2080309@acronis.ru
Content-Type: text/plain; charset=us-ascii; format=flowed

christopher.l.hood@verizon.com wrote:

I need to send a different header when a script runs, I know how to
create and send the header but the RT header of text/html gets sent
first, and then mine just shows up as text on the page.

How can I circumvent the default RT http header, so the browser gets
mine first or solely ??
Generic call:
$r->header_out(‘xxx’, ‘value’);
mod_perl has some special calls that can setup multiple headers or are
just aliases for common used headers.
For example:
$r->content_type(‘text/html; charset=utf-8’);
$r->no_cache(…);
$r->expires(…);

One-two weeks ago it was discussed deeply on mod_perl users list.
perldoc Apache
perldoc Apache::Request

Chris Hood
Investigator Verizon Global Security Operations Center
Email: christopher.l.hood@verizon.com
Desk: 972.399.5900

Verizon Proprietary

NOTICE - This message and any attached files may contain information
that is confidential and/or subject of legal privilege intended only
for
the use by the intended recipient. If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, be advised that you have received this message in
error and that any dissemination, copying or use of this message or
attachment is strictly forbidden, as is the disclosure of the
information therein. If you have received this message in error
please
notify the sender immediately and delete the message.


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Be sure to check out the RT wiki at http://wiki.bestpractical.com

Message: 5
Date: Mon, 02 Aug 2004 22:55:14 +0200
From: Joop van de Wege JoopvandeWege@mococo.nl
Subject: [rt-users] problem with rt-3.2.1 & oracle.
To: rt-users@lists.fsck.com
Message-ID: 20040802224931.0A6A.JOOPVANDEWEGE@mococo.nl
Content-Type: text/plain; charset=“US-ASCII”

Just having a prob creating the schema on a non-local oracle database.
I have had this working before with a local database, so it’s probably
something obvious that I’m missing… - but since moving the db onto
another box it’s a no go. It lookslike it’s not seeing the
–with-db-host, but the correct host is appearing in RT_Config.

./configure --prefix=/export/rt/rt-3.2.1 --with-db-type=Oracle
–with-db-host=rtdbhost --with-db-dba=RTUSER --with-db-database=RTDB
–with-db-rt-user=RTUSER --with-db-rt-pass=rtpass
–with-web-user=httpd --with-web-group=httpd

[configure and make install run without error]

make initialize-database
/usr/bin/perl //export/rt/rt-3.2.1/sbin/rt-setup-database --action
init --dba rtuser --prompt-for-dba-password
In order to create a new database and grant RT access to that
database,
this script needs to connect to your Oracle instance on rtdbhost as
RTUSER.
Please specify that user’s database password below. If the user has no
database
password, just press return.

Password: DBI connect(‘RTDB’,‘RTUSER’,…) failed: ORA-12541: TNS:no
listener (DBD ERROR: OCIServerAttach) at
//export/rt/rt-3.2.1/sbin/rt-setup-database line 80
Failed to connect to dbi:Oracle:RTDB as RTUSER: ORA-12541: TNS:no
listener (DBD ERROR: OCIServerAttach) at
//export/rt/rt-3.2.1/sbin/rt-setup-database line 80, line 1.
*** Error code 255
make: Fatal error: Command failed for target `initialize-database’
Are you sure ORACLE_SID is set correctly and that you have an entry in
your TNSNAMES.ORA pointing to your new db server?
Please provide more data on what is your Oracle client, how did you
install
My guess is that -with-db-host isn’t needed with Oracle since all the
needed data is in the tnsnames.ora or whatever Oracle db resolver you
use, could be Oracle Names or something else.
Check that you’re running your Oracle listener process on your database
machine and that you instance you’re referring to is running.

I have both RT2 and RT3 (3.2.1) running against Oracle on different
machines from the webserver so it can work but the big problem most of
the time is getting your Oracle stuff sorted out.

Joop
.

Joop van de Wege JoopvandeWege@mococo.nl

Message: 6
Date: Mon, 2 Aug 2004 15:09:32 -0700
From: MikeHamilton@clovisusd.k12.ca.us
Subject: [rt-users] Password Encryption
To: rt-users@lists.bestpractical.com
Message-ID:

<OF05964B20.0C0CF621-ON88256EE4.00795DDE-88256EE4.007BDB61@clovisusd.k12
.ca.us>

Content-Type: text/plain; charset=“us-ascii”

I am considering using RT to authenticate our techs to a little Perl
application that I have written. Since I would like to keep the number
of
passwords for them down and we do not yet have an LDAP server, I thought
I
would try to use RT. I am using mod_auth_mysql with Apache with
AuthMySQLMD5Passwords set to “On” and the auth isn’t working. If I put
an
MD5 sum in a test database and test that, I can use mod_auth_mysql to
authenticate. When I use the password from RT however, the resulting
hash
is different. Am I missing something?
-------------- next part --------------
An HTML attachment was scrubbed…
URL:
http://lists.bestpractical.com/pipermail/rt-users/attachments/20040802/e
7563aeb/attachment.htm

Message: 7
Date: Tue, 03 Aug 2004 02:30:19 +0400
From: “Ruslan U. Zakirov” cubic@acronis.ru
Subject: Re: [rt-users] Password Encryption
To: MikeHamilton@clovisusd.k12.ca.us
Cc: rt-users@lists.bestpractical.com
Message-ID: 410EC07B.8000909@acronis.ru
Content-Type: text/plain; charset=us-ascii; format=flowed

MikeHamilton@clovisusd.k12.ca.us wrote:

I am considering using RT to authenticate our techs to a little Perl
application that I have written. Since I would like to keep the number

of passwords for them down and we do not yet have an LDAP server, I
thought I would try to use RT. I am using mod_auth_mysql with Apache
with AuthMySQLMD5Passwords set to “On” and the auth isn’t working. If
I
put an MD5 sum in a test database and test that, I can use
mod_auth_mysql to authenticate. When I use the password from RT
however,
the resulting hash is different. Am I missing something?
Yes, you didn’t read FAQ.
http://wiki.bestpractical.com/?FAQ
It’s Base64 encoded MD5 hash.


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Be sure to check out the RT wiki at http://wiki.bestpractical.com

Message: 8
Date: Mon, 2 Aug 2004 16:03:30 -0700
From: MikeHamilton@clovisusd.k12.ca.us
Subject: Re: [rt-users] Password Encryption
To: rt-users@lists.bestpractical.com
Message-ID:

<OFE25150B8.3100E75E-ON88256EE4.007E931C-88256EE4.0080CC12@clovisusd.k12
.ca.us>

Content-Type: text/plain; charset=“us-ascii”

So my guess then is that I won’t be able to do it - am I right?

“Ruslan U. Zakirov” cubic@acronis.ru
Sent by: rt-users-bounces@lists.bestpractical.com
08/02/2004 03:30 PM

To
MikeHamilton@clovisusd.k12.ca.us
cc
rt-users@lists.bestpractical.com
Subject
Re: [rt-users] Password Encryption

MikeHamilton@clovisusd.k12.ca.us wrote:

I am considering using RT to authenticate our techs to a little Perl
application that I have written. Since I would like to keep the number

of passwords for them down and we do not yet have an LDAP server, I
thought I would try to use RT. I am using mod_auth_mysql with Apache
with AuthMySQLMD5Passwords set to “On” and the auth isn’t working. If
I
put an MD5 sum in a test database and test that, I can use
mod_auth_mysql to authenticate. When I use the password from RT
however,

the resulting hash is different. Am I missing something?
Yes, you didn’t read FAQ.
http://wiki.bestpractical.com/?FAQ
It’s Base64 encoded MD5 hash.


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Be sure to check out the RT wiki at http://wiki.bestpractical.com

http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Be sure to check out the RT wiki at http://wiki.bestpractical.com

-------------- next part --------------
An HTML attachment was scrubbed…
URL:
http://lists.bestpractical.com/pipermail/rt-users/attachments/20040802/c
5e33484/attachment.html

RT-Users mailing list
RT-Users@lists.bestpractical.com
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

End of RT-Users Digest, Vol 5, Issue 4

Hello.
Christopher, did you read anything about Mason?

Comments below.

christopher.l.hood@verizon.com wrote:

Ok below is the code that I tried and the error that it produced. It is
probably due to the way that I used the code you provided for the
header, however any help is greatly appreciated.

I have not included the ENTIRE script here as the other part is
irrelevant, and works when not associated with mason, also I did not get
errors when this ran without the new $r->content_type(blah) code below,
it simply didn’t work and printed out the header as text.

START CODE
<%perl>

use strict;
use DBI();
use Spreadsheet::WriteExcel;
use CGI qw(:standard);
throw it away, you have %ARGS hash. Or define <%ARGS> block.

my $dbh;
my $worksheet;
my $q=new CGI;
my $row;

#my $type = $q->param(‘type’);
my $type = “Spam”;

Set the filename and send the content type

my $filename =“cgitest.xls”;
$r->content_type(‘application/vnd.ms-excel’);
print “Content-Disposition: attachment; filename=$filename\n”;
Don’t even try to print headers. Mason throw header for you, use
$r->header_out(‘field’, ‘value’); call.
As I can see you want send XML file then may be you want to look on
RTStatistics package that generates images.

END CODE

START ERROR

error: Error during compilation of
/usr/local/rt3/local/html/cgi-bin/reporting/reports/offendersbytypeexcel
.mas:
Prototype mismatch: sub HTML::Mason::Commands::url ($;$) vs none at
/usr/lib/perl5/5.8.3/CGI.pm line 274.
Don’t use CGI under Mason. If you want CGI then you can switch back
handler to default for particular location of your host(this trick was
on ML less then two weeks ago).

Ok below is the code that I tried and the error that it produced. It is
probably due to the way that I used the code you provided for the
header, however any help is greatly appreciated.
[snip happens]
START CODE
<%perl>

use strict;
use DBI();
use Spreadsheet::WriteExcel;
use CGI qw(:standard);

I’m confused why you want to use a regular ole’ CGI program
essentially from within RT? This should really be in a different
location/vhost.

Michael
Michael S. Liebman m-liebman@northwestern.edu
http://msl521.freeshell.org/
“I have vision and the rest of the world wears bifocals.”
-Paul Newman in “Butch Cassidy & the Sundance Kid”