cluster/fence/agents baytech/fence_baytech.pl ...
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL4
Changes by: rmccabe at sourceware.org 2007-02-12 20:33:59
Modified files:
fence/agents/baytech: fence_baytech.pl fence/agents/bladecenter: fence_bladecenter.pl fence/agents/brocade: fence_brocade.pl fence/agents/bullpap: fence_bullpap.pl fence/agents/cpint: fence_cpint.pl fence/agents/drac: fence_drac.pl fence/agents/egenera: fence_egenera.pl fence/agents/ibmblade: fence_ibmblade.pl fence/agents/ilo: fence_ilo.pl fence/agents/mcdata: fence_mcdata.pl fence/agents/sanbox2: fence_sanbox2.pl fence/agents/vixel: fence_vixel.pl fence/agents/wti: fence_wti.pl fence/agents/xcat: fence_xcat.pl fence/agents/zvm: fence_zvm.pl
Log message:
Update the perl fence agents to take the additional command line option -S <path> or stdin param passwd_script=<path>
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/baytech/fence_baytech.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/bladecenter/fence_bladecenter.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/brocade/fence_brocade.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.1&r2=1.1.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/bullpap/fence_bullpap.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.6&r2=1.1.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/cpint/fence_cpint.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/drac/fence_drac.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.2.7&r2=1.3.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/egenera/fence_egenera.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.1&r2=1.1.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ibmblade/fence_ibmblade.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.2.1&r2=1.2.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ilo/fence_ilo.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.2.1&r2=1.3.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/mcdata/fence_mcdata.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/sanbox2/fence_sanbox2.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.1&r2=1.1.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/vixel/fence_vixel.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/wti/fence_wti.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.2.3&r2=1.2.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xcat/fence_xcat.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/zvm/fence_zvm.pl.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1&r2=1.1.2.1
fence/agents/baytech/fence_baytech.pl +16 -4
@@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions
@@ -32,7 +32,7 @@ #BEGIN_VERSION_GENERATION $FENCE_RELEASE_NAME=""; -$SISTINA_COPYRIGHT=""; +$REDHAT_COPYRIGHT=""; $BUILD_DATE=""; #END_VERSION_GENERATION
@@ -70,6 +70,7 @@ print " -o string action: On,Off,Status or Reboot (default)\n"; print " -n string outlet name\n"; print " -p string password\n"; + print " -S path script to run to retrieve password\n"; print " -V version\n"; exit 0;
@@ -94,7 +95,7 @@ sub version { print "$pname $FENCE_RELEASE_NAME $BUILD_DATE\n"; - print "$SISTINA_COPYRIGHT\n" if ( $SISTINA_COPYRIGHT ); + print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT ); exit 0; }
@@ -104,7 +105,7 @@ { $action = "Reboot"; if (@ARGV > 0) { - getopts("n:l:p:o:a:VhD") || fail_usage ; + getopts("n:l:p:S:o:a:VhD") || fail_usage ; usage if defined $opt_h; version if defined $opt_V;
@@ -130,6 +131,13 @@ $quiet=$opt_q if defined $opt_q; $user=$opt_l if defined $opt_l; $passwd=$opt_p if defined $opt_p; + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $passwd=$pwd_script_out; + } + } if(defined $passwd && !defined $user) {
@@ -184,6 +192,10 @@ $opt_p = $val; } + elsif ($name eq "passwd_script") { + $opt_S = $val; + } + elsif ($name eq "action" ) { $opt_o = $val;
fence/agents/bladecenter/fence_bladecenter.pl +27 -7
@@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions
@@ -35,7 +35,7 @@ #BEGIN_VERSION_GENERATION $FENCE_RELEASE_NAME=""; -$SISTINA_COPYRIGHT=""; +$REDHAT_COPYRIGHT=""; $BUILD_DATE=""; #END_VERSION_GENERATION
@@ -53,6 +53,7 @@ print " -n <num> blade number to operate on\n"; print " -o <string> Action: on, off, reboot (default) or status\n"; print " -p <string> Password for login\n"; + print " -S <path> Script to run to retrieve password\n"; print " -q quiet mode\n"; print " -V version\n";
@@ -78,7 +79,7 @@ sub version { print "$pname $FENCE_RELEASE_NAME $BUILD_DATE\n"; - print "$SISTINA_COPYRIGHT\n" if ( $SISTINA_COPYRIGHT ); + print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT ); exit 0; }
@@ -129,7 +130,10 @@ elsif ($name eq "passwd" ) { $passwd = $val; - } + } + elsif ($name eq "passwd_script" ) { + $passwd_script = $val; + } elsif ($name eq "blade" ) { $bladenum = $val;
@@ -203,7 +207,7 @@ if (@ARGV > 0) { - getopts("a:hl:n:o:p:qv:V") || fail_usage ; + getopts("a:hl:n:o:p:S:qv:V") || fail_usage ; usage if defined $opt_h; version if defined $opt_V;
@@ -216,12 +220,20 @@ $verbose = $opt_v if defined $opt_v; $quiet = $opt_q if defined $opt_q; + if (defined $opt_S) { + $pwd_script_output = `$opt_S`; + chomp($pwd_script_output); + if ($pwd_script_output) { + $passwd = $pwd_script_output; + } + } + fail_usage "Unknown parameter." if (@ARGV > 0); fail_usage "No '-a' flag specified." unless defined $host; fail_usage "No '-n' flag specified." unless defined $bladenum; fail_usage "No '-l' flag specified." unless defined $login; - fail_usage "No '-p' flag specified." unless defined $passwd; + fail_usage "No '-p' or '-S' flag specified." unless defined $passwd; fail_usage "Unrecognised action '$action' for '-o' flag" unless $action =~ /^(on|off|reboot|status)$/i; }
@@ -232,9 +244,17 @@ fail "failed: no IP address" unless defined $host; fail "failed: no blade number" unless defined $bladenum; fail "failed: no login name" unless defined $login; - fail "failed: no password" unless defined $passwd; fail "failed: unrecognised action: $action" unless $action =~ /^(on|off|reboot|status)$/i; + + if (defined $passwd_script) { + $pwd_script_output = `$passwd_script`; + chomp($pwd_script_output); + if ($pwd_script_output) { + $passwd = $pwd_script_output; + } + } + fail "failed: no password" unless defined $passwd; } # convert $action to lower case
fence/agents/brocade/fence_brocade.pl +24 -3
@@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions
@@ -46,6 +46,7 @@ print " -n <num> Port number to operate on\n"; print " -o <string> Action: disable (default) or enable\n"; print " -p <string> Password for login\n"; + print " -S <path> Script to run to retrieve password\n"; print " -q quiet mode\n"; print " -V version\n";
@@ -78,17 +79,25 @@ if (@ARGV > 0) { - getopts("a:hl:n:o:p:qV") || fail_usage ; + getopts("a:hl:n:o:p:S:qV") || fail_usage ; usage if defined $opt_h; version if defined $opt_V; fail_usage "Unknown parameter." if (@ARGV > 0); + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + fail_usage "No '-a' flag specified." unless defined $opt_a; fail_usage "No '-n' flag specified." unless defined $opt_n; fail_usage "No '-l' flag specified." unless defined $opt_l; - fail_usage "No '-p' flag specified." unless defined $opt_p; + fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p; fail_usage "Unrecognised action '$opt_o' for '-o' flag" unless $opt_o =~ /^(disable|enable)$/i;
@@ -98,6 +107,15 @@ fail "failed: no IP address" unless defined $opt_a; fail "failed: no plug number" unless defined $opt_n; fail "failed: no login name" unless defined $opt_l; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + fail "failed: no password" unless defined $opt_p; fail "failed: unrecognised action: $opt_o" unless $opt_o =~ /^(disable|enable)$/i;
@@ -226,6 +244,9 @@ { $opt_p = $val; } + elsif ($name eq "passwd_script") { + $opt_S = $val; + } elsif ($name eq "port" ) { $opt_n = $val;
fence/agents/bullpap/fence_bullpap.pl +32 -11
104 lines not on this page · raw message
fence/agents/cpint/fence_cpint.pl +1 -1
@@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions
fence/agents/drac/fence_drac.pl +32 -9
91 lines not on this page · raw message
fence/agents/egenera/fence_egenera.pl +1 -1
@@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions
fence/agents/ibmblade/fence_ibmblade.pl +1 -1
@@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions
fence/agents/ilo/fence_ilo.pl +41 -3
90 lines not on this page · raw message
fence/agents/mcdata/fence_mcdata.pl +27 -4
@@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions
@@ -53,6 +53,7 @@ print " -n <num> Port number to disable\n"; print " -o <string> Action: disable (default) or enable\n"; print " -p <string> Password for login\n"; + print " -S <path> Script to run to retrieve login password\n"; print " -q quiet mode\n"; print " -V version\n";
@@ -129,7 +130,11 @@ elsif ($name eq "passwd" ) { $opt_p = $val; - } + } + elsif ($name eq "passwd_script" ) + { + $opt_S = $val; + } elsif ($name eq "port" ) { $opt_n = $val;
@@ -153,7 +158,7 @@ # MAIN if (@ARGV > 0) { - getopts("a:hl:n:o:p:qV") || fail_usage ; + getopts("a:hl:n:o:p:S:qV") || fail_usage ; usage if defined $opt_h; version if defined $opt_V;
@@ -163,7 +168,16 @@ fail_usage "No '-a' flag specified." unless defined $opt_a; fail_usage "No '-n' flag specified." unless defined $opt_n; fail_usage "No '-l' flag specified." unless defined $opt_l; - fail_usage "No '-p' flag specified." unless defined $opt_p; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + + fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p; fail_usage "Unrecognised action '$opt_o' for '-o' flag" unless $opt_o =~ /^(disable|enable)$/i;
@@ -173,6 +187,15 @@ fail "failed: no IP address" unless defined $opt_a; fail "failed: no plug number" unless defined $opt_n; fail "failed: no login name" unless defined $opt_l; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + fail "failed: no password" unless defined $opt_p; fail "failed: unrecognised action: $opt_o" unless $opt_o =~ /^(disable|enable)$/i;
fence/agents/sanbox2/fence_sanbox2.pl +27 -4
@@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions
@@ -46,6 +46,7 @@ print " -n <num> Port number to disable\n"; print " -o <string> Action: disable (default) or enable\n"; print " -p <string> Password for login\n"; + print " -S <path> Script to run to retrieve login password\n"; print " -q quiet mode\n"; print " -V version\n";
@@ -78,7 +79,7 @@ if (@ARGV > 0) { - getopts("a:hl:n:o:p:qV") || fail_usage ; + getopts("a:hl:n:o:p:S:qV") || fail_usage ; usage if defined $opt_h; version if defined $opt_V;
@@ -88,7 +89,16 @@ fail_usage "No '-a' flag specified." unless defined $opt_a; fail_usage "No '-n' flag specified." unless defined $opt_n; fail_usage "No '-l' flag specified." unless defined $opt_l; - fail_usage "No '-p' flag specified." unless defined $opt_p; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + + fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p; fail_usage "Unrecognised action '$opt_o' for '-o' flag" unless $opt_o =~ /^(disable|enable)$/i;
@@ -98,6 +108,15 @@ fail "failed: no IP address" unless defined $opt_a; fail "failed: no plug number" unless defined $opt_n; fail "failed: no login name" unless defined $opt_l; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + fail "failed: no password" unless defined $opt_p; fail "failed: unrecognised action: $opt_o" unless $opt_o =~ /^(disable|enable)$/i;
@@ -222,7 +241,11 @@ elsif ($name eq "passwd" ) { $opt_p = $val; - } + } + elsif ($name eq "passwd_script" ) + { + $opt_S = $val; + } elsif ($name eq "port" ) { $opt_n = $val;
fence/agents/vixel/fence_vixel.pl +27 -4
@@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions
@@ -40,6 +40,7 @@ print " -h Usage\n"; print " -n <num> Port number to disable\n"; print " -p <string> Password for login\n"; + print " -S <path> Script to run to retrieve login password\n"; print " -V version\n\n"; exit 0;
@@ -70,7 +71,7 @@ } if (@ARGV > 0) { - getopts("a:hn:p:V") || fail_usage ; + getopts("a:hn:p:S:V") || fail_usage ; usage if defined $opt_h; version if defined $opt_V;
@@ -78,13 +79,31 @@ fail_usage "Unknown parameter." if (@ARGV > 0); fail_usage "No '-a' flag specified." unless defined $opt_a; - fail_usage "No '-p' flag specified." unless defined $opt_p; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + + fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p; fail_usage "No '-n' flag specified." unless defined $opt_n; } else { get_options_stdin(); fail "failed: no IP address for the Vixel." unless defined $opt_a; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + fail "failed: no password provided." unless defined $opt_p; fail "failed: no port number specified." unless defined $opt_n; }
@@ -130,7 +149,7 @@ ($text, $match) = $t->waitfor('/\>/'); if ($text !~ /[Oo][Kk]/) { - fail "failed: error from switch\n"; + fail "failed: error from switch\n"; } $t->print("exit");
@@ -187,6 +206,10 @@ { $opt_p = $val; } + elsif ($name eq "passwd_script" ) + { + $opt_S = $val; + } elsif ($name eq "port" ) {
fence/agents/wti/fence_wti.pl +25 -2
@@ -43,6 +43,7 @@ print " -h usage\n"; print " -n <num> Physical plug number on NPS\n"; print " -p <string> Password if NPS requires one\n"; + print " -S <path> Script to run to retrieve login password\n"; print " -o <operation> Operation to perform (on, off, reboot)\n"; print " -q quiet mode\n"; print " -T test reports state of plug (no power cycle)\n";
@@ -77,7 +78,7 @@ $opt_o = "reboot"; if (@ARGV > 0) { - getopts("a:hn:p:qTVo:") || fail_usage ; + getopts("a:hn:p:S:qTVo:") || fail_usage ; usage if defined $opt_h; version if defined $opt_V;
@@ -86,13 +87,31 @@ fail_usage "No '-a' flag specified." unless defined $opt_a; fail_usage "No '-n' flag specified." unless defined $opt_n; - fail_usage "No '-p' flag specified." unless defined $opt_p; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + + fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p; } else { get_options_stdin(); fail "failed: no IP address" unless defined $opt_a; fail "failed: no plug number" unless defined $opt_n; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + fail "failed: no password" unless defined $opt_p; }
@@ -338,6 +357,10 @@ { $opt_p = $val; } + elsif ($name eq "passwd_script" ) + { + $opt_S = $val; + } elsif ($name eq "port" ) { $opt_n = $val;
fence/agents/xcat/fence_xcat.pl +1 -0
@@ -4,6 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ############################################################################### ###############################################################################
fence/agents/zvm/fence_zvm.pl +27 -4
@@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions
@@ -45,7 +45,8 @@ print " -a <ip> IP address or hostname of the physical s390\n"; print " -h usage\n"; print " -u <string> userid of the virtual machine to fence\n"; - print " -p <string> Password\n"; + print " -p <string> Password\n"; + print " -S <path> Script to run to retrieve login password\n"; print " -q quiet mode\n"; print " -r <devnum> ipl device <devnum>\n"; print " -V Version\n";
@@ -267,6 +268,10 @@ { $opt_p = $val; } + elsif ($name eq "passwd_script" ) + { + $opt_S = $val; + } elsif ($name eq "userid" ) { $opt_u = $val;
@@ -281,14 +286,23 @@ } if (@ARGV > 0){ - getopts("a:hp:qr:u:V") || fail_usage; + getopts("a:hp:S:qr:u:V") || fail_usage; usage if defined $opt_h; version if defined $opt_V; fail_usage "Unkown parameter." if (@ARGV > 0); fail_usage "No '-a' flag specified." unless defined $opt_a; - fail_usage "No '-p' flag specified." unless defined $opt_p; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + + fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p; fail_usage "No '-u' flag specified." unless defined $opt_u; } else {
@@ -296,6 +310,15 @@ fail "no IP address" unless defined $opt_a; fail "no userid" unless defined $opt_u; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + fail "no password" unless defined $opt_p; }