Operation not permitted

S

Sam

I have what I think is a perl problem, although it could be
permissions related...I'm installing smbfax and I finally have smbfax
emailing a link back to me when I print a fax, and I'm able to enter
the fax number, etc, into the form, but as soon as I hit "Send Fax," a
responce page pops up, saying:

Fax sent

Program output follows (in case of any errors):

COMMAND FAILED Operation not permitted

My permissions are wide open on all of the queues and scrips,
etc...just to simplify troubleshooting. I've seen that some one back
in 2002 had the same problem (see below), but there wasn't a solution
to it at that point. If someone has solved this problem I'd be
thankful for the answer.

http://www.hylafax.org/archive/2002-06/msg00402.html
 
T

thumb_42

Sam said:
I have what I think is a perl problem, although it could be
permissions related...I'm installing smbfax and I finally have smbfax
emailing a link back to me when I print a fax, and I'm able to enter
the fax number, etc, into the form, but as soon as I hit "Send Fax," a
responce page pops up, saying:

Fax sent

Program output follows (in case of any errors):

COMMAND FAILED Operation not permitted

My permissions are wide open on all of the queues and scrips,
etc...just to simplify troubleshooting. I've seen that some one back
in 2002 had the same problem (see below), but there wasn't a solution
to it at that point. If someone has solved this problem I'd be
thankful for the answer.

http://www.hylafax.org/archive/2002-06/msg00402.html


I think your point of confusion is in exactly *what* isn't permitted. (I
don't know if you're running a CGI or a command line or ?)

But "operation not permitted" is generally involved in a device file not
allowing access. If the script runs at all, it's not a perl-permissions
problem.

Best bet is trying to find the file/device that is giving you the
trouble. (I'm guessing it's a serial device) If all else fails, you can try
running it under 'strace' to see what it's trying to open.

If it really is the perl file, (Ie: the perl script itself isn't running)
it'll be highly OS dependant. For Linux, with an ext filesystem you can do a
'man lsattr' to see any extended attributes. Or it could be trying to write
to a read-only filesystem. (which won't work no matter _what_ the
permissions are)

I can almost say for certain that it's not a problem directly related to
perl. (if ALL perl scripts gave you that error I'd investigate the perms on
your perl binary)

Jamie
 
S

Sam

I think your point of confusion is in exactly *what* isn't permitted. (I
don't know if you're running a CGI or a command line or ?)
-snip-

Jamie

I agree...thanks for pointing me in the right direction

I am not a programmer, so the output of strace doesn't do much for me,
and I'm thinking that the error is coming from a program called from
this perl script. Here's the section of the code that displays the
error, and it's the only place the @output is mentioned. Is it pulling
@output from CGI.pm? I can't find @output defined in CGI.pm either...I
must be barking up the wrong tree.

my $pid;
$pid = open(KID, "-|");
die "Can't fork: $!"
unless defined $pid;
my @output;
if ($pid) { # parent
while (<KID>) {
push (@output, $_);
}
print "<H1 style=\"text-align: center; vertical-align:
middle\">Fax sent</H1>\n";
print "Program output follows (in case of any errors):<p>\n";
print "<TT> @output </TT><p>\n";
print "You will recieve E-Mail if there are any problems with
your fax, ";
print "unless you checked the <tt>Do not send me any email</tt>
option.";
# print "<TT> @command </TT>\n";
print "\n</BODY></HTML>\n";
}

Any help in isolating this error would be greatly appreciated! Thanks
for the info already offered. I'm a total newbie, so thanks for the
merciful help, and let me know if I should take this problem to
another group, and if so, a pointer would be helpful.

Tad,

SMBFAX is a perl script that sends faxes via a samba printer, that is
why I posted it to a perl group.
 
W

Walter Roberson

:I am not a programmer, so the output of strace doesn't do much for me,
:and I'm thinking that the error is coming from a program called from
:this perl script. Here's the section of the code that displays the
:error, and it's the only place the @output is mentioned. Is it pulling
:mad:output from CGI.pm? I can't find @output defined in CGI.pm either...I
:must be barking up the wrong tree.


: $pid = open(KID, "-|");

That forks a new process and makes its output available on the
filehandle named KID .

: my @output;

That defines an array named 'output' and initializes it to be empty.

: if ($pid) { # parent

$pid is only true in the parent process.

: while (<KID>) {
: push (@output, $_);
: }

So in the parent process, we loop around, reading a line from the child
process and adding the line to the -end- of the array named 'output'.
This loop could have been replaced with the single line:

@output = <KID>;


So, to answer your questions: @output is defined and given a value
right there, not in CGI.pm . The value it is given is whatever is output
by the child process.
 
S

Sam

Thanks for all the input. A friend of mine took a look at the perl
script and thought it might be a permissions problem, and sure enough,
when I set the permissions higher, I no longer received the error
message. For anyone who finds this while looking for the same
solution, here's the relevant code change:

die "Unable to chmod file in spooling area\n" .
"chmod (0700, \"$TEMP/$temp2\"): $!"
unless (chmod (0700, "$TEMP/$temp2"));

Change those two 0700's to something higher...if you're a lazy slacker
like me, 777 will work. That piece of code sets the permissions on the
data file, and if it is too strict then your html interface won't be
able to submit them to hylafax.

(The default location for this file is /usr/local/smbfax/smbfax, and
it is a perl script.)

Again, thanks to those who've given me their consideration, and
forgive me if I've posted slightly off-topic for this group.

-Sam
 
J

James Willmore

Thanks for all the input. A friend of mine took a look at the perl
script and thought it might be a permissions problem, and sure enough,
when I set the permissions higher, I no longer received the error
message. For anyone who finds this while looking for the same
solution, here's the relevant code change:

die "Unable to chmod file in spooling area\n" .
"chmod (0700, \"$TEMP/$temp2\"): $!"
unless (chmod (0700, "$TEMP/$temp2"));

It's not wise to change permissions on a file when the file name is
derived from a variable. You have to make sure that the script isn't
changing permissions on a file it shouldn't. If you do want to do
something like this, you should run the script with taint mode enabled and
do some checking on the variables *before* executing a command or changing
permissions on a file. `perldoc perlsec` for more information.

Change those two 0700's to something higher...if you're a lazy slacker
like me, 777 will work. That piece of code sets the permissions on the
data file, and if it is too strict then your html interface won't be
able to submit them to hylafax.

You need to learn about permissions. Setting a file to 0777 is not wise
if the file is owned by root or runs setuid. 0755 is more than adequate
for, say, a Perl script.
(The default location for this file is /usr/local/smbfax/smbfax, and it
is a perl script.)

Again, thanks to those who've given me their consideration, and forgive
me if I've posted slightly off-topic for this group.

It's not uncommon for someone to use the builtin functions of Perl to do
things like deleting files or changing permissions. However, you need to
do so wisely and understand what you're doing. So, some understanding of
the OS and filesystem you're using is a requirement.

IMHO, this is one of those gray areas that should be addressed in part
here and in part in another newsgroup related to what you're doing. Taint
checking and specifics about the functions you're using are addressed here;
the OS and filesystem are better addressed in another newsgroup.

Good luck and HTH

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
Those of you who think you know everything are very annoying to
those of us who do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top