Guys,Does anyone know how to convert perl code to cgi. I don't mean perl with cgi. If you look at show_env.cgi file it has some different characters than when you have a regular perl/cgi file. Interwoven engineers said my custom_import.cgi needs to be in the same format so that impersonation can work with iw_cgi_wrapper.cgi. Modified by says "SYSTEM" and I need it to be actual user who uploaded file. Any ideas/suggestions. Thanks.
Previous attachment file had a bug, file contents not uploaded 0 bytes. Here is corrected file which now includes read and buffer to get all file contents, correct size.
Boris vpath actually has the valid path below://testserver/default/main/TestOnline/WORKAREA/design/sitesI get all necessary values which makes upload working correctly. The only issue is the SYSTEM user id when run as /iw-bin/custom_import.cgi via ui_custom.xml.I want to replace SYSTEM user id with the actual user id who performed the upload. To my understanding the only way to achieve this is through the /iw-bin/iw_cgi_wrapper.cgi/custom_import.ipl command via ui_custom.xml which doesn't work for me, I get internal server error.If I try /iw-bin/iw_cgi_wrapper.cgi/custom_import.cgi command via ui_custom.xml I get the below popup error:Teamsite : WrapperError trying to open a pipe to: I:\Interwoven\TeamSite\httpd\iw-bin\custom_import.cgi(1)
/iw-bin/custom_import.cgi
/iw-bin/iw_cgi_wrapper.cgi/custom_import.ipl
/iw-bin/iw_cgi_wrapper.cgi/custom_import.cgi
iwperl -w -c iwhome\httpd\iw-bin\custom_import.ipl
Ghoti the script is actually custom_import.cgi. I just made a copy custom.ipl to try resolution. Syntax check shows output below. 1st check shows when Im using the taint switch "#!I:\Interwoven\TeamSite\iw-perl\bin\iwperl -Tw" and 2nd check when I remove it "#!I:\Interwoven\TeamSite\iw-perl\bin\iwperl -w". But I think I should leave taint switch in to make script more secure.I:\Interwoven\TeamSite\iw-perl\bin>iwperl.exe -wc \Interwoven\TeamSite\httpd\iw-bin\custom_import.cgiToo late for "-T" option at \Interwoven\TeamSite\httpd\iw-bin\custom_import.cgiline 1.I:\Interwoven\TeamSite\iw-perl\bin>iwperl.exe -wc \Interwoven\TeamSite\httpd\iw-bin\custom_import.cgi\Interwoven\TeamSite\httpd\iw-bin\custom_import.cgi syntax OKI:\Interwoven\TeamSite\iw-perl\bin>I'm capable of logging into server through remote desktop so I do have logon local privileges.
Ok Ghoti, I remove -Tw from shebang line. use strict and warnings were already in the code. Output didnt change when I ran syntax check with iwperl -wc again, syntax ok.Now I get error below when I run /iw-bin/iw_cgi_wrapper.cgi/custom_import.ipl command via ui_custom.xml: Permission denied trying to execute the command iw.group.importwhen run /iw-bin/iw_cgi_wrapper.cgi/custom_import.cgi via ui_custom.xml I still get:Teamsite : WrapperError trying to open a pipe to: I:\Interwoven\TeamSite\httpd\iw-bin\custom_import.cgi(1)
my @ts_dir = $ENV{QUERY_STRING};
if ($upload_dir =~ /default\/main\/TestOnline/) { ...}
if ($upload_dir =~ m|default/main/TestOnline|) { ...}
sub debug { my $msg = shift; open(DBG, '>>', "$iwhome/tmp/dbg.log") || die " '$iwhome/tmp/dbg.log' ($!)"; print DBG "$msg\n"; close DBG;}# I'd prefer using Log::Log4perl, but I'll leave that as an exercise for you to do on your own...my $hostname = $ENV{HTTP_HOST};my @ts_dir = $ENV{QUERY_STRING};my $upload_dir = "";debug("HOSTNAME: '$hostname'");debug("TS_DIR: \n\t'" . join("'\n\t'", @ts_dir) . "'");# Use CGI Environment Variables to get pathforeach my $d_path (@ts_dir) { $d_path =~ s/&done.*//; $d_path =~ s/.*=\/\/testserver\d{3}//i; $upload_dir = $d_path;}debug("UPLOAD_DIR: '$upload_dir'");...
Now I'm running complete updated code through wrapper (/iw-bin/iw_cgi_wrapper.cgi/custom_import.ipl) but still getting same error in previous post when I try uploading a file. So the issue now appears to be the iw_cgi_wrapper.cgi file, which I'm on interwoven support case about it.