File: auth.pl

package info (click to toggle)
libsys-virt-perl 11.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,088 kB
  • sloc: perl: 2,187; sh: 12; makefile: 3
file content (30 lines) | stat: -rw-r--r-- 645 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -*- perl -*-
use strict;
use warnings;
use Sys::Virt;

my $addr = @ARGV ? shift @ARGV : "";
print "Addr $addr\n";
my $con = Sys::Virt->new(address => $addr, readonly => 0, auth => 1,
			 credlist => [
			   Sys::Virt::CRED_AUTHNAME,
			   Sys::Virt::CRED_PASSPHRASE,
			 ],
			 callback => sub {
			     my $creds = shift;


			     foreach my $cred (@{$creds}) {
				 if ($cred->{type} == Sys::Virt::CRED_AUTHNAME) {
				     $cred->{result} = "test";
				 }
				 if ($cred->{type} == Sys::Virt::CRED_PASSPHRASE) {
				     $cred->{result} = "123456";
				 }

			     }
			     return 0;
			 });

print "VMM type: ", $con->get_type(), "\n";