Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Calling a setuid script in a perl script

by chilledham (Friar)
on Nov 18, 2011 at 16:52 UTC ( [id://938882]=note: print w/replies, xml ) Need Help??


in reply to Calling a setuid script in a perl script
in thread Perl Setuid - Oracle Password Hardcoding

In testDBConn.pl:

# assuming getPwd.pl is in @INC require 'getPwd.pl'; $password = getOraPwd();
For this to work getPwd.pl will need to return a true value. That's as simple as putting 1; as the last line in the script.

You might also consider creating a module and use'ing that. This might be helpful in such a venture: José's Guide for creating Perl modules

Replies are listed 'Best First'.
Re^2: Calling a setuid script in a perl script
by mbethke (Hermit) on Nov 18, 2011 at 17:00 UTC

    I assume the OP wants it as an extra suid script because it must read a file the main script has no permissions for, and it makes complete sense to keep the suid portions of a script as small as possible. Making the whole thing a module would defeat this purpose.

    If I understood this correctly, the solution is very easy:

    $password = `getPwd.pl`; chomp $password;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://938882]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-26 00:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found