summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rwxr-xr-xserver/scireserver.pl27
1 files changed, 22 insertions, 5 deletions
diff --git a/server/scireserver.pl b/server/scireserver.pl
index 6ea7543..88f17a3 100755
--- a/server/scireserver.pl
+++ b/server/scireserver.pl
@@ -97,11 +97,14 @@ sub register_client {
$mac =~ /^[a-zA-Z0-9\:]+$/ or print "ERROR invalid mac $mac!\n";
$ip =~ /^[a-zA-Z0-9\.\:]+$/ or print "ERROR invalid ip $ip!\n";
- my ($query, $status_id, $id);
+ my ($query, $status_id, $id, $sth);
eval {
$query = 'SELECT statusid FROM client_status WHERE statusname = "Pending"';
debug("DEBUG: Query is $query");
$status_id = "4"; #db.conn.GetRow($query)
+ #$sth = $dbh->prepare($query);
+ #my @result = $sth->fetchrow_array();
+ #$status_id = $result[0];
};
($@) and print "ERROR Could not get status id: $DBI::errstr";
@@ -109,26 +112,38 @@ sub register_client {
$query = 'LOCK TABLES `gacl_axo_seq` WRITE';
debug("DEBUG: Query is $query");
#execute it
+ #$dbh->do($query);
$query = 'SELECT id FROM `gacl_axo_seq`';
debug("DEBUG: Query is $query");
$id = "56"; #execute $query
- $query = 'UPDATE `gacl_axo_seq` SET id=%s';
+ #$sth = $dbh->prepare($query);
+ #my @result = $sth->fetchrow_array();
+ #$id = $result[0];
+
+ $query = 'UPDATE `gacl_axo_seq` SET id=?';
debug("DEBUG: Query is $query");
#execute with $id
+ #$sth = $dbh->prepare($query);
+ #$sth->execute($id);
$query = 'UNLOCK TABLES';
debug("DEBUG: Query is $query");
+ #$dbh->do($query);
};
($@) and print "ERROR during fetching of id sequence: $DBI::errstr";
eval {
- $query = 'INSERT INFO `gacl_axo` (id,section_value,value,order_value,name,hidden VALUES (%s,"clients",%s,1,%s,0)';
+ $query = 'INSERT INFO `gacl_axo` (id,section_value,value,order_value,name,hidden VALUES (?,"clients",?,1,?,0)';
debug("DEBUG: Query is $query");
+ #$sth = $dbh->prepare($query);
+ #$sth->execute($id, $hostname, $hostname);
#execute with $id, $hostname, $hostname
#NOTE: not sure if this query is still valid. may be using id instead of hostname for one of those two now.
- $query = 'INSERT INTO clients (clientid,digest,cert,hostname,mac,ip,status) VALUES (%s,%s,%s,%s,%s,%s,%s)';
+ $query = 'INSERT INTO clients (clientid,digest,cert,hostname,mac,ip,status) VALUES (?,?,?,?,?,?,?)';
debug("DEBUG: Query is $query");
#execute with $id, client_cert.digest("sha1"),crypto.dump_certificate(crypto.FILETYPE_PEM,client_cert),$hostname,$mac,$ip,$status_id))
+ #$sth = $dbh->prepare($query);
+ #$sth->execute($id,$digest,$hostname,$mac,$ip,$status_id);
};
($@) and print "ERROR Could not insert client with $query: $DBI::errstr";
@@ -142,8 +157,10 @@ sub identify_client {
$fingerprint =~ s/"//g; #Clear the quotes.
$fingerprint =~ /^[A-Za-z0-9]+$/ or print "ERROR invalid fingerprint!\n";
#Validate your inputs!
- my $query = 'SELECT client_status.statusname FROM clients JOIN client_status on (clients.status = client_status.statusid) WHERE clients.digest=%s';
+ my $query = 'SELECT client_status.statusname FROM clients JOIN client_status on (clients.status = client_status.statusid) WHERE clients.digest=?';
debug("DEBUG: Query is $query");
+ #$sth = $dbh->prepare($query);
+ #$sth->execute($fingerprint);
$identified = 1;
print "OK\n";
}