quick auth hack for zebra 2.0.18 could probably be cleaner...
authorRyan Higgins <rch@balrog.liblime.com>
Sun, 11 Nov 2007 22:39:26 +0000 (16:39 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Mon, 12 Nov 2007 00:39:02 +0000 (18:39 -0600)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Context.pm

index d6e269d..dea785d 100644 (file)
@@ -487,7 +487,6 @@ sub Zconn {
     my $syntax=shift;
     if ( defined($context->{"Zconn"}->{$server}) ) {
         return $context->{"Zconn"}->{$server};
-
     # No connection object or it died. Create one.
     }else {
         $context->{"Zconn"}->{$server} = &_new_Zconn($server,$async,$auth,$piggyback,$syntax);
@@ -518,21 +517,22 @@ sub _new_Zconn {
     $syntax = "usmarc" unless $syntax;
 
     my $host = $context->{'listen'}->{$server}->{'content'};
-    my $user = $context->{"serverinfo"}->{$server}->{"user"};
     my $servername = $context->{"config"}->{$server};
+    my $user = $context->{"serverinfo"}->{$server}->{"user"};
     my $password = $context->{"serverinfo"}->{$server}->{"password"};
+ $auth = 1 if($user && $password);   
     retry:
     eval {
         # set options
         my $o = new ZOOM::Options();
+        $o->option(user=>$user) if $auth;
+        $o->option(password=>$password) if $auth;
         $o->option(async => 1) if $async;
         $o->option(count => $piggyback) if $piggyback;
         $o->option(cqlfile=> $context->{"server"}->{$server}->{"cql2rpn"});
         $o->option(cclfile=> $context->{"serverinfo"}->{$server}->{"ccl2rpn"});
         $o->option(preferredRecordSyntax => $syntax);
         $o->option(elementSetName => "F"); # F for 'full' as opposed to B for 'brief'
-        $o->option(user=>$user) if $auth;
-        $o->option(password=>$password) if $auth;
         $o->option(databaseName => ($servername?$servername:"biblios"));
 
         # create a new connection object