From 3d4e3c745e98462c96e6a998857c3ce03a5b3e96 Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Thu, 1 Oct 2015 01:22:00 +0200
Subject: upgraded to new context base handling for rhrd-libs


diff --git a/rh-bin/authtoken.json b/rh-bin/authtoken.json
index 2c19cb0..973a492 100755
--- a/rh-bin/authtoken.json
+++ b/rh-bin/authtoken.json
@@ -33,15 +33,14 @@ my $fullname = '';
 my $responsecode = 500;
 
 if(defined $ENV{REMOTE_USER}) {
-  my $dbh;
-  ($dbh, $status, $errorstring) = RHRD::rddb::opendb();
-  if(defined $dbh) {
+  (my $ctx, $status, $errorstring) = RHRD::rddb::init();
+  if(defined $ctx) {
     $username = $ENV{REMOTE_USER};
-    ($token, $status, $errorstring) = RHRD::rddb::get_token($dbh, $username);
+    ($token, $status, $errorstring) = RHRD::rddb::get_token($ctx, $username);
     $token = '' unless($token);
-    ($fullname, $status, $errorstring) = RHRD::rddb::get_fullname($dbh, $username);
+    ($fullname, $status, $errorstring) = RHRD::rddb::get_fullname($ctx, $username);
     $fullname = '' unless($fullname);
-    RHRD::rddb::closedb($dbh);
+    RHRD::rddb::destroy($ctx);
     if($status == "OK") {
       $responsecode = 200;
     }
diff --git a/rh-bin/listdropboxes.cgi b/rh-bin/listdropboxes.cgi
index 0a65105..f00e28e 100755
--- a/rh-bin/listdropboxes.cgi
+++ b/rh-bin/listdropboxes.cgi
@@ -36,14 +36,13 @@ my $q = CGI->new;
 my $username = $q->param('LOGIN_NAME');
 my $token = $q->param('PASSWORD');
 
-my $dbh;
-($dbh, $status, $errorstring) = RHRD::rddb::opendb();
-if(defined $dbh) {
+(my $ctx, $status, $errorstring) = RHRD::rddb::init();
+if(defined $ctx) {
   my $result;
-  ($result, $status, $errorstring) = RHRD::rddb::check_token($dbh, $username, $token);
+  ($result, $status, $errorstring) = RHRD::rddb::check_token($ctx, $username, $token);
   if($result == 1) {
     $responsecode = 200;
-    @dropboxes = RHRD::rddb::get_dropboxes($dbh, $username);
+    @dropboxes = RHRD::rddb::get_dropboxes($ctx, $username);
     if(!defined $dropboxes[0] && defined $dropboxes[1]) {
       $responsecode = 500;
       $status = $dropboxes[1];
@@ -54,7 +53,7 @@ if(defined $dbh) {
   } else {
     $responsecode = 500;
   }
-  RHRD::rddb::closedb($dbh);
+  RHRD::rddb::destroy($ctx);
 }
 
 print "Content-type: application/xml; charset=UTF-8\n";
-- 
cgit v0.10.2