Hylafax Mailing List Archives
|
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
[hylafax-users] Web-hylafax-gw question
Is there a way to tell sendfax to run as a different user?
I'm using web-hylafax-gw. All faxes from the coming in to hylafax are from
user "apache". I would like to add to the html a field asking for the
users account name, which would run sendfax as that user, then the
confirmation emails would go to each user's account.
Below is the cgi script if anyone cares to see.
Thanks
-ANdrew
#! /usr/bin/perl
# #################################################################
#
# Web HylaFAX gateway 1.0 December 1998
# Nic Tjirkalli (nic@uunet.co.za, http://duffus.iafrica.com/~nic)
#
# #################################################################
require("cgilib.pl");
require("fax-gw-config.pl");
# Set perl not to buffer ouptput
$| = 1;
# Static variables
$fileo = "/tmp/.fax.$$";
$filestat = "/tmp/.fax.stat.$$";
# Initialise variables
# Extract variables
$Name = "";
$Company = "";
$FaxNumber = "";
$Document = "";
$File = "";
$From = "";
$regarding = "";
$error = "";
&ReadParse(*input);
$Name = $input{'Name'};
$Company = $input{'Company'};
$FaxNumber = $input{'FaxNumber'};
$Document = $input{'Document'};
$File = $input{'File'};
$From = $input{'From'};
$Regarding = $input{'Regarding'};
# No fax number - ERROR
if ($FaxNumber) {
$error = "";
}
else
{
$error = "NO FAX NUMBER ENTERED - REDO";
}
# Error Exit
if ($error) {
&pagetop;
&errmess;
⊥
exit();
}
$command = $prog." -P high -m -D -f \"$From\" -r \"$Regarding\" -x
\"$Company\" -d \"$Name\"\@$FaxNumber $fileo";
# A file has been specified - make it the same as Document
if ($File)
{
$Document = $File;
}
open(OUTPUT, ">$fileo");
print OUTPUT $Document;
close(OUTPUT);
# Produce output
&pagetop;
&output;
system("$command 1>$filestat 2>$filestat");
open(RESULT, "$cat $filestat |");
while($line=<RESULT>) {
print $line
}
close(RESULT);
print "<CENTER>";
system("$rm $fileo $filestat 1>/dev/null 2>/dev/null");
⊥
###########################################
sub pagetop {
{ print <<EOF
Content-Type: text/html
<HTML>
<HEAD>$title</HEAD>
<BODY BGCOLOR=#ffffff LINK=#0000ff VLINK=#ff0000 ALINK=#FF0000 TEXT=#000000>
<HR SIZE="2" NOSHADE>
<CENTER>
<TABLE BORDER="0" WIDTH="100%">
<TR>
<TD BGCOLOR="FF0000" ALIGN="CENTER">
<H1><FONT COLOR="FFFF00"> <BR> Web HylaFAX gateway 1.0</FONT></H1>
</TD>
</TR>
</TABLE>
</CENTER>
<HR SIZE="2" NOSHADE>
EOF
}
}
############################################
sub output {
{ print <<DEFANGED_EOF
<H1>FAX Transmission Details</H1>
<BR><P>
<HR SIZE="2" NOSHADE>
<BR><P>
<PRE>
Sending To :- $Name
To Fax Number :- $FaxNumber
Company :- $Company
From :- $From
Running Command :- $command
</PRE>
<BR><P>
<DD><B><i>sendfax</B></I> command output :-
<BR>
EOF
}
}
############################################
sub errmess {
{ print <<DEFANGED_EOF
<H1>FAX Details Entry Error</H1>
<BR><P>
<HR SIZE="2" NOSHADE>
<BR><P>
<CENTER>
$error
EOF
}
}
____________________ HylaFAX(tm) Users Mailing List _______________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null
*To learn about commercial HylaFAX(tm) support, mail sales@hylafax.org.*