Skip to main content
Sign in
Snippets Groups Projects
Select Git revision
  • 032d856057cd3acf696e7ecb56a0b1ae5adf51d9
  • master default protected
  • paulos-#7636-expose-read-default-false
  • devel
  • paulos-bugfix-ra-opensslregistry-mode-fix
  • paulos-bugfix-ra-openssl-tempfile-write
  • valachp-ansible-fixes-server
  • hruska-feature-clients-api
  • malostik-#5066-deduplicate-idea-ids
  • warden-postgresql-port
  • hruska-feature-#6799-filter-keys
  • hruska-feature-5066-duplicateIdeaID
  • warden-client-3.0-beta3
  • warden-server-3.0-beta3
  • warden-client-2.2-final
  • warden-server-2.2-final
  • warden-client-3.0-beta2
  • warden-server-3.0-beta2
  • warden-client-2.2
  • warden-server-2.2-patch3
  • warden-client-3.0-beta1
  • warden-server-3.0-beta1
  • warden-server-2.2-patch1
  • warden-client-3.0-beta0
  • warden-server-3.0-beta0
  • warden-server-2.2
  • warden-server-2.1-patch1
  • warden-client-2.1
  • warden-server-2.1
  • warden-server-2.1-beta6
  • warden-server-2.1-beta5
  • warden-server-2.1-beta4
32 results

WardenClientSend.pm

Blame
  • Forked from 713 / Warden / Warden
    857 commits behind the upstream repository.
    user avatar
    Jan Soukal authored
    57c407e3
    History
    WardenClientSend.pm 5.20 KiB
    #!/usr/bin/perl -w
    #
    # WardenClientSend.pm
    #
    # Copyright (C) 2011-2012 Cesnet z.s.p.o
    #
    # Use of this source is governed by a BSD-style license, see LICENSE file.  
    
    package WardenClientSend;
    
    use strict;
    use SOAP::Lite;
    use IO::Socket::SSL qw(debug1);
    use SOAP::Transport::HTTP;
    use Carp;
    use Sys::Syslog;
    
    our $VERSION = "2.0"; #first iteration after 'port to Apache'
    
    #----- global configuration variables - default initialization -----------------
    our $LOG_STDERR = 1;
    
    our $LOG_SYSLOG = 0;
    our $LOG_SYSLOG_FACILITY;
    
    our $LOG_VERBOSE = 0;
    #----- end of configuration variables ------------------------------------------
    
    #-------------------------------------------------------------------------------
    # errMsg - print error message and die
    #-------------------------------------------------------------------------------
    sub errMsg
    {
      my $msg = "Error message: " . shift;
    
      if ($LOG_VERBOSE) { # user wants to log debug information
        $msg .= "\nStack info: " . Carp::longmess();
      }
    
      die($msg . "\n");
    } # End of errMsg
    
    
    #-------------------------------------------------------------------------------
    # c2s - connect to server, send request and receive response
    #-------------------------------------------------------------------------------
    sub c2s 
    {
      my $uri		        = shift;
      my $ssl_key_file	= shift;
      my $ssl_cert_file	= shift;
      my $ssl_ca_file	  = shift;
      my $method		    = shift;
      my $data		      = shift;
    
      my ($server, $port, $service) = $uri =~ /https:\/\/(.+)\:(\d+)\/(.+)/;
    
      my $client;
      if (!($client = SOAP::Transport::HTTP::Client->new())) {
        errMsg("Sorry, unable to create socket: " . &SOAP::Transport::HTTP::Client::errstr)
      }
      $client->timeout(60);
      $client->ssl_opts(verify_hostname     => 1,
    		    SSL_use_cert        => 1,
    		    SSL_verify_mode     => 0x02,
    		    SSL_key_file        => $ssl_key_file,
    		    SSL_cert_file       => $ssl_cert_file,
    		    SSL_ca_file         => $ssl_ca_file);