10 my $ua = LWP
::UserAgent
->new(cookie_jar
=> {},
11 ssl_opts
=> {verify_hostname
=> 0,
12 SSL_verify_mode
=> IO
::Socket
::SSL
::SSL_VERIFY_NONE
});
13 $ua->default_header('Referer' => 'http://localhost');
14 push @
{ $ua->requests_redirectable }, 'POST';
21 my $login = { 'name' => $user, 'pwd' => $pass };
22 my $response = $ua->post("${url}/cgi/login.cgi", $login);
23 die $response->status_line if (!($response->is_success));
29 open(INIFILE
,"<${filename}") || die("can't open config: ${filename}: $!");
37 if (m/^\s*\[(.*)\]\s*$/) {
43 if (m/^\s*([^=]+)\s*=\s*(.*)\s*$/) {
44 ${$Ini{$sections[$#sections]}}{$1} = $2;
53 sub add_url_to_java_exceptions
{
54 my $url = shift || die;
55 my $file = "$ENV{HOME}/.java/deployment/security/exception.sites";
56 return unless -f
${file
};
57 open my $fh, '+<', $file || die;
58 unless (grep{m
#${url}#} <$fh>){
60 if (open my $fh, '>>', $file) {
69 my %Config = read_inifile
("$ENV{HOME}/.rsbs2rc");
71 my $hostalias = $ARGV[0];
73 if (!defined($hostalias) || !defined($Config{$hostalias})) {
74 print STDERR
"Usage: $0 card-alias\n\n";
75 print STDERR
"card-alias\tone of:\n";
76 foreach my $alias (sort keys(%Config)) {
77 print STDERR
"\"${alias}\"\n";
79 print STDERR
"(see ~/.rsbs2rc)\n";
83 my $url = "http://" . ${$Config{$hostalias}}{"host"};
84 login
($url, ${$Config{$hostalias}}{"user"}, ${$Config{$hostalias}}{"pass"});
85 add_url_to_java_exceptions
($url);
87 my $response = $ua->get("${url}/cgi/url_redirect.cgi?url_name=ikvm&url_type=jwsk");
88 die $response->status_line if (!($response->is_success));
90 my $jnlp = $response->decoded_content;
92 $jnlp =~ s/(<resources os=\"Linux\" arch=\"amd64\">)/$1<property name=\"jnlp.packEnabled\" value=\"true\"\/><property name
=\"jnlp
.versionEnabled
\" value
=\"true
\"\
/>/;
94 my $fh = File
::Temp
->new(SUFFIX
=> '.jnlp');
95 $fh->unlink_on_destroy(1);
99 $ENV{'AWT_TOOLKIT'} = 'MToolkit';
100 system("javaws", $fh->filename);