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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |