Need help with setuid scripts which use usersub.o 
Author Message
 Need help with setuid scripts which use usersub.o

I've got a perl script that I need to run setuid.  The script uses pgperl
(perl usersub with Postgres database functions compiled in).  I used
Larry's suidscript to generate the setuid wrapper for the script.  The
program is setuid to *my* uid, not root.

When I run the program as myself, it runs fine.  If I run it as another
user, I get this error:

Undefined subroutine "main'PQsetdb" called at /users/cheeks/tmp/.get-usage line 41.

PQsetdb is one of the functions defined in the Postgres code.  My script
starts with "#!/usr/local/bin/pgperl", so it should be executing the verion
of perl with the Postgres code compiled in, but it's acting as though it
got a different perl executable instead.

I've looked through perl.1, but haven't found any explanation of when
taintperl is used.  Is it exec'd by perl (or pgperl) when it sees that
"$< != $>" ?  Or is it something else entirely?

What can I do to get to the point where I can have a set-id script that
uses a usersub perl?

I'd appreciate it if you would CC: any replies to this post to my email

newsfeed has been very erratic lately and I can't be sure it won't drop
messages.

Thanks for any light you can shed on my problem ...

Quote:
>>Chx

--
Mark Costlow
Southwest {*filter*}port

--
Mark Costlow
Southwest {*filter*}port



Mon, 02 Dec 1996 13:47:22 GMT  
 Need help with setuid scripts which use usersub.o

Quote:

>I've got a perl script that I need to run setuid.  The script uses pgperl
>(perl usersub with Postgres database functions compiled in).  I used
>Larry's suidscript to generate the setuid wrapper for the script.
...
>I get this error:

>Undefined subroutine "main'PQsetdb" ...
...
>PQsetdb is one of the functions defined in the Postgres code.

Ok, I eventually solved this one myself.  The fix is to build a tainted
uperl.o:

        ld   -r tarray.o tcmd.o tcons.o tconsarg.o tdoarg.o tdoio.o \
        tdolist.o tdump.o teval.o tform.o malloc.o tperl.o tregcomp.o \
        tregexec.o tstab.o tstr.o ttoke.o tutil.o thash.o tperly.o -o tuperl.o

Then I linked my pgperl with tuperl.o instead of uperl.o to produce
tpgperl.  My script does #!/usr/local/bin/tpgperl.  All this keeps perl
from exec'ing "%s/tperl%s", which was causing my undefined subroutine
error.

Quote:
>>Chx

--
Mark Costlow
Southwest {*filter*}port



Wed, 04 Dec 1996 02:27:58 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Setuid script using Net::FTP

2. Setuid script using Net::FTP

3. Newbie needs help with a script using mail

4. Need help piping data to script using CGI::Minimal

5. Need help using MakeMaker for scripts

6. Newbie need help to run Makefile by using script

7. Newbie need help to run Makefile by using script

8. Need help with Win32 shell scripting using perl

9. Newbie need help to run Makefile by using script

10. SunOS 4.1.3 and setuid perl help needed

11. Help with setuid scripts on SysV UNIX

12. HELP: perl script fails on setuid binary

 

 
Powered by phpBB® Forum Software