9 my $ua = LWP
::UserAgent
->new(cookie_jar
=> {});
10 $ua->default_header('Referer' => 'http://localhost');
17 my $login = { 'name' => $user, 'pwd' => $pass };
18 my $response = $ua->post("${url}/cgi/login.cgi", $login);
19 die $response->status_line if (!($response->is_success));
25 open(INIFILE
,"<${filename}") || die("can't open config: ${filename}: $!");
33 if (m/^\s*\[(.*)\]\s*$/) {
39 if (m/^\s*([^=]+)\s*=\s*(.*)\s*$/) {
40 ${$Ini{$sections[$#sections]}}{$1} = $2;
49 sub add_url_to_java_exceptions
{
50 my $url = shift || die;
51 my $file = "$ENV{HOME}/.java/deployment/security/exception.sites";
52 return unless -f
${file
};
53 open my $fh, '+<', $file || die;
54 unless (grep{m
#${url}#} <$fh>){
56 if (open my $fh, '>>', $file) {
65 my %Config = read_inifile
("$ENV{HOME}/.rsbs2rc");
67 my $hostalias = $ARGV[0];
69 if (!defined($hostalias) || !defined($Config{$hostalias})) {
70 print STDERR
"Usage: $0 card-alias\n\n";
71 print STDERR
"card-alias\tone of:\n";
72 foreach my $alias (sort keys(%Config)) {
73 print STDERR
"\"${alias}\"\n";
75 print STDERR
"(see ~/.rsbs2rc)\n";
79 my $url = "http://" . ${$Config{$hostalias}}{"host"};
80 login
($url, ${$Config{$hostalias}}{"user"}, ${$Config{$hostalias}}{"pass"});
81 add_url_to_java_exceptions
($url);
83 my $response = $ua->get("${url}/cgi/url_redirect.cgi?url_name=ikvm&url_type=jwsk");
84 die $response->status_line if (!($response->is_success));
86 my $jnlp = $response->decoded_content;
88 $jnlp =~ s/(<resources os=\"Linux\" arch=\"amd64\">)/$1<property name=\"jnlp.packEnabled\" value=\"true\"\/><property name
=\"jnlp
.versionEnabled
\" value
=\"true
\"\
/>/;
90 my $fh = File
::Temp
->new(SUFFIX
=> '.jnlp');
91 $fh->unlink_on_destroy(1);
95 $ENV{'AWT_TOOLKIT'} = 'MToolkit';
96 system("javaws", $fh->filename);