Hi everyone, ok after spending 3 whole days trying to figure it out.
I'm recurring to all of you, cause i'm almost convince there is not possible solution.


*** Let me explain my Working Context and the Problem:

This is my Context (dont ask why, just asumme it) :

1) i must used perl and only perl for this scripting developing.
2) At some point i use the DBI for Oracle connection (also SQLSERVER)
3) While this "custom scripting" is in a somewhat "closed environment", I have to let the script for public access (so anyone could see the code) BUT I cannot have the db user and password hanging around in the code.


The Problem, is then that:
Currently, i "masked" the db credentials with a crypting perl library, but cause there is all in source code, there is no way of really deny access in the credentials:
A snip of my scripts so all of you can understand:

my $dbInstance = "XE";
my $db_user = `perl -S decrypter.pl \"$dbusercryptedfile\"`;
my $db_pass = `perl -S decrypter.pl \"$dbpasswordcryptedfile\"`;
my $q_string = "dbi:Oracle:$dbInstance";
my( $dbh,$sth);
$dbh = DBI->connect ( $q_string, $db_user, $db_pass,{PrintError => 0, RaiseError => 1} );
...
...
...

As you can see, anyone can see the password doing a simple print "$db_pass"


*** The solution i "thought" was possible:

The only thing a maybe think was feasible, was making a dbconnection.pl and then perl2exed.
The code snippet of this dbconnection.pl is

my $db_user = decrypter($dbusercryptedfile);
my $db_pass = decrypter($dbpasswordcryptedfile);
my $q_string = "dbi:Oracle:$dbInstance";
my( $dbh,$sth);
$dbh = DBI->connect ( $q_string, $db_user, $db_pass,{PrintError => 0, RaiseError => 1} );
print \$dbh;
exit 0;


So then in my main scripts i could do something like:

$dbconn = `dbconnection.exe`;
print "|$dbconn|\n";
$stmt = $dbconn->prepare($strSql);
$stmt->bind_columns( undef, \$qFieldContent);
$stmt->execute();


The thing is the $dbconn never get the correct reference.
I try and play with the references methods, but didn't find a solution.
The two times i get "closed" with $dbconn were:
dbconn|REF(0x1aa3760)|
dbconn|DBI::db=HASH(0x1b09c1c)|

the problem is that both values are string values, and not actually a class or a ref value.
Maybe is there a way to actually reference an address that a string represent ???


***********


There it is. My problem and flimsy (/not working) solution.

If anyone have an alternative for what I need, or the solution for this reference workaround, you'll really help me

Thanks anyway guys


In reply to From string with variable Address to actual referencing that address? (core crypting problem) by Julgon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.