Differences between revisions 10 and 11
| Deletions are marked like this. | Additions are marked like this. |
| Line 5: | Line 5: |
| * | * Patch sybase_classes.patch, sybase_tpl.patch, sybase_responsehandler.patch dans http://vulture.open-source.fr/download/patches/1.99/ |
Authentification SQL server
Pré-requis
Sur Redhat/CentOS, INTRINsec-common > v10 : http://vulture.open-source.fr/download/RPMS/redhat/5/
Patch sybase_classes.patch, sybase_tpl.patch, sybase_responsehandler.patch dans http://vulture.open-source.fr/download/patches/1.99/
Installation de INTRINsec-common
Configuration freetds
/opt/INTRINsec/freetds/etc/freetds.conf :
[test]
host = 192.168.22.134
port = 1046
tds version = 7.0
Tests ligne de commande
# /opt/INTRINsec/freetds/bin/tsql -S test -D testdb -U sa -P toto -I /opt/INTRINsec/freetds/etc/freetds.conf
test.pl :
#!/usr/bin/perl -w -I/opt/INTRINsec/lib
my (@available_drivers, $dbh, $sql_statement, $sth, @array) = ();
#CONFIG
my ($data_source) = "dbi:Sybase:dbname=testdb;server=test";
my ($username) = "sa";
my ($password) = 'toto';
#END CONFIG
use DBI;
#Prints a list of the available DBD drivers.
@available_drivers = DBI->available_drivers;
print ("The available DBD drivers are: @available_drivers.\n");
#Connect to the Sybase db server.
$dbh = DBI->connect($data_source, $username, $password)
|| die "Can't connect: $DBI::errstr";
#Run a basic SQL statement.
$sql_statement = "select * from test";
$sth = $dbh->prepare($sql_statement)
|| die "Can't prepare the SQL statement: $DBI::errstr";
$sth->execute || die "Can't execute the SQL statement: $DBI::errstr";
#Get the data back.
while (my($name, $phone) = $sth->fetchrow_array) {
print ("$name is available at $phone.\n");
}
#Destroy objects and close things down.
$sth->finish;
$dbh->disconnect;
# FREETDSCONF=/opt/INTRINsec/freetds/etc/freetds.conf ./test.pl
Installation de Vulture et application du patch
Ajouter la ligne suivante dans /etc/init.d/vulture :
export FREETDSCONF=/opt/INTRINsec/freetds/etc/freetds.conf