[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/fence/agents baytech/fence_baytech.pl ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	rmccabe sourceware org	2007-06-27 15:38:19

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/ipmilan: ipmilan.c 
	fence/agents/mcdata: fence_mcdata.pl 
	fence/agents/rackswitch: do_rack.c do_rack.h 
	fence/agents/rps10: rps10.c 
	fence/agents/rsa: fence_rsa.py 
	fence/agents/rsb: fence_rsb.py 
	fence/agents/sanbox2: fence_sanbox2.pl 
	fence/agents/vixel: fence_vixel.pl 
	fence/agents/vmware: fence_vmware.pl 
	fence/agents/wti: fence_wti.pl 
	fence/agents/xcat: fence_xcat.pl 
	fence/agents/xen: fence_xen.pl 
	fence/agents/zvm: fence_zvm.pl 

Log message:
	Fold in passwd_script support from HEAD

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/baytech/fence_baytech.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2&r2=1.2.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/bladecenter/fence_bladecenter.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2&r2=1.2.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/brocade/fence_brocade.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3&r2=1.3.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/bullpap/fence_bullpap.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.6&r2=1.6.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/cpint/fence_cpint.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1&r2=1.1.16.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/drac/fence_drac.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8.2.1&r2=1.8.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/egenera/fence_egenera.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2&r2=1.2.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ibmblade/fence_ibmblade.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2&r2=1.2.14.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ipmilan/ipmilan.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8.2.2&r2=1.8.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/mcdata/fence_mcdata.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2&r2=1.2.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/rackswitch/do_rack.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1&r2=1.1.16.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/rackswitch/do_rack.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1&r2=1.1.16.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/rps10/rps10.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2&r2=1.2.16.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/rsa/fence_rsa.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2.2.1&r2=1.2.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/rsb/fence_rsb.py.diff?cvsroot=cluster&only_with_tag=RHEL5&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=RHEL5&r1=1.3&r2=1.3.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/vixel/fence_vixel.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2&r2=1.2.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/vmware/fence_vmware.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&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=RHEL5&r1=1.5.2.1&r2=1.5.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xcat/fence_xcat.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2&r2=1.2.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xen/fence_xen.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2&r2=1.2.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/zvm/fence_zvm.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1&r2=1.1.16.1

--- cluster/fence/agents/baytech/fence_baytech.pl	2006/08/16 19:13:26	1.2
+++ cluster/fence/agents/baytech/fence_baytech.pl	2007/06/27 15:38:16	1.2.2.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
@@ -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;
--- cluster/fence/agents/bladecenter/fence_bladecenter.pl	2006/08/15 18:34:20	1.2
+++ cluster/fence/agents/bladecenter/fence_bladecenter.pl	2007/06/27 15:38:17	1.2.2.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
@@ -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;
@@ -199,7 +203,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;
@@ -212,12 +216,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;
 } 
@@ -228,9 +240,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 
--- cluster/fence/agents/brocade/fence_brocade.pl	2006/08/16 19:02:23	1.3
+++ cluster/fence/agents/brocade/fence_brocade.pl	2007/06/27 15:38:17	1.3.2.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
@@ -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;
--- cluster/fence/agents/bullpap/fence_bullpap.pl	2006/04/25 13:00:05	1.6
+++ cluster/fence/agents/bullpap/fence_bullpap.pl	2007/06/27 15:38:17	1.6.2.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
@@ -31,7 +31,7 @@
 
 #BEGIN_VERSION_GENERATION
 $FENCE_RELEASE_NAME="";
-$SISTINA_COPYRIGHT="";
+$REDHAT_COPYRIGHT="";
 $BUILD_DATE="";
 #END_VERSION_GENERATION
 
@@ -49,17 +49,19 @@
 	print "  -d <domain>      Domain 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";
 	print "\n";
 	print "When run with no arguments, $pname takes arguments from ";
 	print "standard\ninput, one line per option.  They are as follows:\n";
 	print "\n";
-	print "  ipaddr=<ip>      Same as -a command line option\n";
-	print "  login=<name>     Same as -l command line option\n";
-	print "  domain=<domain>  Same as -d command line option\n";
-	print "  option=<string>  Same as -o command line option\n";
-	print "  passwd=<string>  Same as -p command line option\n\n";
+	print "  ipaddr=<ip>          Same as -a command line option\n";
+	print "  login=<name>         Same as -l command line option\n";
+	print "  domain=<domain>      Same as -d command line option\n";
+	print "  option=<string>      Same as -o command line option\n";
+	print "  passwd=<string>      Same as -p command line option\n";
+	print "  passwd_script=<path> Same as -S command line option\n\n";
 
 	exit 0;
 }
@@ -82,7 +84,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;
 }
@@ -138,6 +140,9 @@
 		{
 			$passwd = $val;
 		} 
+		elsif ($name eq "passwd_script" ) {
+			$passwd_script = $val;
+		}
 		elsif ($name eq "domain" ) 
 		{
 			$domain = $val;
@@ -221,7 +226,7 @@
 
 if (@ARGV > 0) 
 {
-	getopts("a:hl:d:o:p:qv:V") || fail_usage ;
+	getopts("a:hl:d:o:p:S:qv:V") || fail_usage ;
 
 	usage if defined $opt_h;
 	version if defined $opt_V;
@@ -234,12 +239,20 @@
 	$verbose  = $opt_v if defined $opt_v;
 	$quiet    = $opt_q if defined $opt_q;
 
+	if (defined $opt_S) {
+		$pwd_script_out = `$opt_S`;
+		chomp($pwd_script_out);
+		if ($pwd_script_out) {
+			$passwd = $pwd_script_out;
+		}
+	}
+
 	fail_usage "Unknown parameter." if (@ARGV > 0);
 
 	fail_usage "No '-a' flag specified." unless defined $host;
 	fail_usage "No '-d' flag specified." unless defined $domain;
 	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;
 } 
@@ -250,9 +263,17 @@
 	fail "failed: no IP address" unless defined $host;
 	fail "failed: no domain" unless defined $domain;
 	fail "failed: no login name" unless defined $login;
-	fail "failed: no password" unless defined $passwd;
 	fail "failed: unrecognized action: $action"
 		unless $action =~ /^(on|off|reboot|status)$/i;
+
+	if (defined $passwd_script) {
+		$pwd_script_out = `$passwd_script`;
+		chomp($pwd_script_out);
+		if ($pwd_script_out) {
+			$passwd = $pwd_script_out;
+		}
+	}
+	fail "failed: no password" unless defined $passwd;
 }
 
 # convert $action to lower case 
--- cluster/fence/agents/cpint/fence_cpint.pl	2004/06/24 08:53:13	1.1
+++ cluster/fence/agents/cpint/fence_cpint.pl	2007/06/27 15:38:17	1.1.16.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
--- cluster/fence/agents/drac/fence_drac.pl	2007/05/10 19:42:24	1.8.2.1
+++ cluster/fence/agents/drac/fence_drac.pl	2007/06/27 15:38:17	1.8.2.2
@@ -3,7 +3,7 @@
 ###############################################################################
 ###############################################################################
 ##
-##  Copyright (C) 2006 Red Hat, Inc.  All rights reserved.
+##  Copyright (C) 2006-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
@@ -79,15 +79,17 @@
 	print "  -m <modulename>  DRAC/MC module name\n";
 	print "  -o <string>      Action: reboot (default), off or on\n";
 	print "  -p <string>      Login password\n";
+	print "  -S <path>        Script to run to retrieve password\n";
 	print "  -q               quiet mode\n";
 	print "  -V               version\n";
 	print "\n";
 	print "CCS Options:\n";
-        print "  action = \"string\"      Action: reboot (default), off or on\n";
-        print "  debug  = \"debugfile\"   debugging output file\n";
+	print "  action = \"string\"      Action: reboot (default), off or on\n";
+	print "  debug  = \"debugfile\"   debugging output file\n";
 	print "  ipaddr = \"ip\"          IP address or hostname of DRAC\n";
 	print "  login  = \"name\"        Login name\n";
-        print "  passwd = \"string\"      Login password\n";
+	print "  passwd = \"string\"      Login password\n";
+	print "  passwd_script = \"path\" Script to run to retrieve password\n";
 
 	exit 0;
 }
@@ -125,7 +127,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;
 }
 
@@ -540,7 +542,11 @@
 		elsif ($name eq "passwd" ) 
 		{
 			$passwd = $val;
-		} 
+		}
+		elsif ($name eq "passwd_script" )
+		{
+			$passwd_script = $val;
+		}
 		elsif ($name eq "debug" ) 
 		{
 			$debug = $val;
@@ -572,7 +578,7 @@
 # Check parameters
 #
 if (@ARGV > 0) {
-	getopts("a:c:d:D:hl:m:o:p:qVv") || fail_usage ;
+	getopts("a:c:d:D:hl:m:o:p:S:qVv") || fail_usage ;
 	
 	usage if defined $opt_h;
 	version if defined $opt_V;
@@ -590,7 +596,15 @@
 
 	$modulename = $opt_m if defined $opt_m;
 
-	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;
 	$passwd = $opt_p;
 
 	$verbose = $opt_v if defined $opt_v;
@@ -610,9 +624,18 @@
 
 	fail "failed: no IP address" unless defined $address;
 	fail "failed: no login name" unless defined $login;
+
+	if (defined $passwd_script) {
+		$pwd_script_out = `$passwd_script`;
+		chomp($pwd_script_out);
+		if ($pwd_script_out) {
+			$passwd = $pwd_script_out;
+		}
+	}
+
 	fail "failed: no password" unless defined $passwd;
 	fail "failed: unrecognised action: $action"
-	unless $action =~ /^(Off|On|Reboot|status)$/i;
+		unless $action =~ /^(Off|On|Reboot|status)$/i;
 } 
 
 
--- cluster/fence/agents/egenera/fence_egenera.pl	2006/08/16 19:14:50	1.2
+++ cluster/fence/agents/egenera/fence_egenera.pl	2007/06/27 15:38:17	1.2.2.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
--- cluster/fence/agents/ibmblade/fence_ibmblade.pl	2004/09/10 15:44:32	1.2
+++ cluster/fence/agents/ibmblade/fence_ibmblade.pl	2007/06/27 15:38:17	1.2.14.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
--- cluster/fence/agents/ipmilan/ipmilan.c	2007/01/29 20:33:03	1.8.2.2
+++ cluster/fence/agents/ipmilan/ipmilan.c	2007/06/27 15:38:17	1.8.2.3
@@ -8,7 +8,7 @@
  *
  *  http://ipmitool.sourceforge.net
  *
- * Copyright 2005 Red Hat, Inc.
+ * Copyright 2005-2007 Red Hat, Inc.
  *  author: Lon Hohberger <lhh at redhat.com>
  *
  * This library is free software; you can redistribute it and/or
@@ -32,6 +32,7 @@
 #include <signal.h>
 #include <string.h>
 #include <errno.h>
+#include <limits.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <libintl.h>
@@ -664,6 +665,7 @@
 	char *end = NULL;
 	struct ipmi *i;
 	size_t len;
+	int lanplus = 0;
 
 	if (!ISIPMI(s))
 		return S_OOPS;
@@ -678,6 +680,10 @@
 	if (user) {
 		*user = 0;
 		user++;
+		if (*user && *user == '+') {
+			lanplus = 1;
+			user++;
+		}
 	}
 
 	/* No separator or end of string reached */
@@ -709,7 +715,7 @@
 		user = NULL;
 
 	/* IPMI auth type not supported on RHEL3 */
-	i = ipmi_init(i, host, NULL, user, passwd, 0, 0);
+	i = ipmi_init(i, host, NULL, user, passwd, lanplus, 0);
 	if (!i)
 		return S_OOPS;
 	i->i_config = 1;
@@ -765,7 +771,7 @@
 cleanup(char *line, size_t linelen)
 {
 	char *p;
-	int x;
+	size_t x;
 
 	/* Remove leading whitespace. */
 	p = line;
@@ -812,6 +818,7 @@
 get_options_stdin(char *ip, size_t iplen,
 		  char *authtype, size_t atlen,
 		  char *passwd, size_t pwlen,
+		  char *pwd_script, size_t pwd_script_len,
 		  char *user, size_t userlen,
 		  char *op, size_t oplen,
 		  int *lanplus, int *verbose)
@@ -862,14 +869,18 @@
 			else
 				passwd[0] = 0;
 
-		} else if (!strcasecmp(name, "user") ||
-			   !strcasecmp(name, "login")) {
+		} else if (!strcasecmp(name, "passwd_script")) {
+			if (val) {
+				strncpy(pwd_script, val, pwd_script_len);
+				pwd_script[pwd_script_len - 1] = '\0';
+			} else
+				pwd_script[0] = '\0';
+		} else if (!strcasecmp(name, "user") || !strcasecmp(name, "login")) {
 			/* username */
 			if (val)
 				strncpy(user, val, userlen);
 			else
 				user[0] = 0;
-
 		} else if (!strcasecmp(name, "lanplus")) {
 			(*lanplus) = 1;
 		} else if (!strcasecmp(name, "option") ||
@@ -905,6 +916,8 @@
 printf("   -i <ipaddr>    IPMI Lan IP to talk to (deprecated, use -i)\n");
 printf("   -p <password>  Password (if required) to control power on\n"
        "                  IPMI device\n");
+printf("   -P             Use Lanplus\n");
+printf("   -S <path>      Script to retrieve password (if required)\n");
 printf("   -l <login>     Username/Login (if required) to control power\n"
        "                  on IPMI device\n");
 printf("   -o <op>        Operation to perform.\n");
@@ -913,14 +926,16 @@
 printf("   -v             Verbose mode\n\n");
 printf("If no options are specified, the following options will be read\n");
 printf("from standard input (one per line):\n\n");
-printf("   auth=<auth>    Same as -A\n");
-printf("   ipaddr=<#>     Same as -a\n");
-printf("   passwd=<pass>  Same as -p\n");
-printf("   login=<login>  Same as -u\n");
-printf("   option=<op>    Same as -o\n");
-printf("   operation=<op> Same as -o\n");
-printf("   action=<op>    Same as -o\n");
-printf("   verbose        Same as -v\n\n");
+printf("   auth=<auth>           Same as -A\n");
+printf("   ipaddr=<#>            Same as -a\n");
+printf("   passwd=<pass>         Same as -p\n");
+printf("   passwd_script=<path>  Same as -S\n");
+printf("   lanplus               Same as -P\n");
+printf("   login=<login>         Same as -u\n");
+printf("   option=<op>           Same as -o\n");
+printf("   operation=<op>        Same as -o\n");
+printf("   action=<op>           Same as -o\n");
+printf("   verbose               Same as -v\n\n");
 	exit(1);
 }
 
@@ -935,6 +950,7 @@
 	char passwd[64];
 	char user[64];
 	char op[64];
+	char pwd_script[PATH_MAX] = { 0, };
 	int lanplus=0;
 	int verbose=0;
 	char *pname = basename(argv[0]);
@@ -950,7 +966,7 @@
 		/*
 		   Parse command line options if any were specified
 		 */
-		while ((opt = getopt(argc, argv, "A:a:i:l:p:Po:vV?hH")) != EOF) {
+		while ((opt = getopt(argc, argv, "A:a:i:l:p:S:Po:vV?hH")) != EOF) {
 			switch(opt) {
 			case 'A':
 				/* Auth type */
@@ -972,6 +988,10 @@
 			case 'P':
 				lanplus = 1;
 				break;
+			case 'S':
+				strncpy(pwd_script, optarg, sizeof(pwd_script));
+				pwd_script[sizeof(pwd_script) - 1] = '\0';
+				break;
 			case 'o':
 				/* Operation */
 				strncpy(op, optarg, sizeof(op));
@@ -997,11 +1017,33 @@
 		if (get_options_stdin(ip, sizeof(ip),
 				      authtype, sizeof(authtype),
 				      passwd, sizeof(passwd),
+					  pwd_script, sizeof(pwd_script),
 				      user, sizeof(user),
 				      op, sizeof(op), &lanplus, &verbose) != 0)
 			return 1;
 	}
 
+	if (pwd_script[0] != '\0') {
+		char pwd_buf[1024];
+		FILE *fp;
+		fp = popen(pwd_script, "r");
+		if (fp != NULL) {
+			ssize_t len = fread(pwd_buf, 1, sizeof(pwd_buf), fp);
+			if (len > 0) {
+				char *p;
+				p = strchr(pwd_buf, '\n');
+				if (p != NULL)
+					*p = '\0';
+				p = strchr(pwd_buf, '\r');
+				if (p != NULL)
+					*p = '\0';
+				strncpy(passwd, pwd_buf, sizeof(passwd));
+				passwd[sizeof(passwd) - 1] = '\0';
+			}
+			pclose(fp);
+		}
+	}
+
 	/*
 	   Validate the operating parameters
 	 */
--- cluster/fence/agents/mcdata/fence_mcdata.pl	2006/08/16 19:05:25	1.2
+++ cluster/fence/agents/mcdata/fence_mcdata.pl	2007/06/27 15:38:18	1.2.2.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
@@ -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;
@@ -146,7 +151,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;
@@ -156,7 +161,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;
 
@@ -166,6 +180,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;
--- cluster/fence/agents/rackswitch/do_rack.c	2004/06/24 08:53:14	1.1
+++ cluster/fence/agents/rackswitch/do_rack.c	2007/06/27 15:38:18	1.1.16.1
@@ -2,7 +2,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
@@ -24,6 +24,7 @@
 char password[256];
 char arg[256];
 char name[256];
+char pwd_script[PATH_MAX] = { 0, };
 
 char readbuf[MAXBUF];
 char writebuf[MAXBUF];
@@ -159,6 +160,7 @@
 	 "  -n <dec num>     Physical plug number on RackSwitch\n"
 	 "  -l <string>      Username\n"
 	 "  -p <string>      Password\n"
+	 "  -S <path>        Script to retrieve password\n"
 	 "  -v               Verbose\n"
 	 "  -q               Quiet\n"
          "  -V               Version information\n", pname);
@@ -175,7 +177,7 @@
     /*
      * Command line input
      */
-    while ((c = getopt(argc, argv, "ha:n:l:p:vqVd")) != -1)
+    while ((c = getopt(argc, argv, "ha:n:l:p:S:vqVd")) != -1)
       {
 	switch(c)
 	  {
@@ -199,6 +201,11 @@
 	    strncpy(password,optarg,254);
 	    break;
 
+	  case 'S':
+		strncpy(pwd_script, optarg, sizeof(pwd_script));
+		pwd_script[sizeof(pwd_script) - 1] = '\0';
+		break;
+
 	  case 'v':
 	    verbose_flag = 1;
 	    break;
@@ -265,10 +272,37 @@
       
       if (!strcmp(arg, "password"))
         strcpy(password, value);
+
+	  if (!strcasecmp(arg, "passwd_script")) {
+		strncpy(pwd_script, optarg, sizeof(pwd_script));
+		pwd_script[sizeof(pwd_script) - 1] = '\0';
+	  }
     }
     errno = 0;
     
   }
+
+  if (pwd_script[0] != '\0') {
+	FILE *fp;
+	char pwd_buf[1024];
+
+	fp = popen(pwd_script, "r");
+	if (fp != NULL) {
+		ssize_t len = fread(pwd_buf, 1, sizeof(pwd_buf), fp);
+		if (len > 0) {
+			char *p;
+			p = strchr(pwd_buf, '\n');
+			if (p != NULL)
+				*p = '\0';
+			p = strchr(pwd_buf, '\r');
+			if (p != NULL)
+				*p = '\0';
+			strncpy(password, pwd_buf, sizeof(password));
+			password[sizeof(password) - 1] = '\0';
+		}
+		pclose(fp);
+	}
+  }
 }
 
 static void sig_alarm(int sig)
--- cluster/fence/agents/rackswitch/do_rack.h	2004/06/24 08:53:14	1.1
+++ cluster/fence/agents/rackswitch/do_rack.h	2007/06/27 15:38:18	1.1.16.1
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <limits.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <ctype.h>
--- cluster/fence/agents/rps10/rps10.c	2004/11/16 19:39:35	1.2
+++ cluster/fence/agents/rps10/rps10.c	2007/06/27 15:38:18	1.2.16.1
@@ -1,5 +1,5 @@
 /*
-  Copyright Red Hat, Inc. 2002-2004
+  Copyright Red Hat, Inc. 2002-2007
 
   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
--- cluster/fence/agents/rsa/fence_rsa.py	2007/01/31 20:16:49	1.2.2.1
+++ cluster/fence/agents/rsa/fence_rsa.py	2007/06/27 15:38:18	1.2.2.2
@@ -32,17 +32,18 @@
 #END_VERSION_GENERATION
 
 def usage():
-  print "Usage:\n"
-  print "fence_rsa [options]\n"
-  print "Options:\n"
-  print "   -a <ipaddress>           ip or hostname of rsa II port\n"
-  print "   -h                       print out help\n"
-  print "   -l [login]               login name\n"
-  print "   -p [password]            password\n"
-  print "   -o [action]              Reboot (default), Off, On, or Status\n"
-  print "   -v Verbose               Verbose mode\n"
-  print "   -V                       Print Version, then exit\n"
-
+  print "Usage:"
+  print "fence_rsa [options]"
+  print "Options:"
+  print "   -a <ipaddress>           ip or hostname of rsa II port"
+  print "   -h                       print out help"
+  print "   -l [login]               login name"
+  print "   -p [password]            password"
+  print "   -S [path]                script to run to retrieve password"
+  print "   -o [action]              Reboot (default), Off, On, or Status"
+  print "   -v Verbose               Verbose mode"
+  print "   -V                       Print Version, then exit"
+  
   sys.exit (0)
 
 def version():
@@ -60,6 +61,7 @@
   address = ""
   login = ""
   passwd = ""
+  passwd_script = ""
   action = POWER_REBOOT   #default action
   verbose = False
 
@@ -80,7 +82,7 @@
 
   if len(sys.argv) > 1:
     try:
-      opts, args = getopt.getopt(sys.argv[1:], "a:hl:o:p:vV", ["help", "output="])
+      opts, args = getopt.getopt(sys.argv[1:], "a:hl:o:p:S:vV", ["help", "output="])
     except getopt.GetoptError:
       #print help info and quit
       usage()
@@ -94,11 +96,13 @@
         version()
       if o in ("-h", "--help"):
         usage()
-        sys.exit()
+        sys.exit(0)
       if o == "-l":
         login = a
       if o == "-p":
         passwd = a
+      if o == "-S":
+        passwd_script = a
       if o  == "-o":
         if a == "Off" or a == "OFF" or a == "off":
           action = POWER_OFF
@@ -110,35 +114,44 @@
           action = POWER_REBOOT
         else:
           usage()
-          sys.exit()
+          sys.exit(1)
       if o == "-a":
         address = a
-    if address == "" or login == "" or passwd == "":
+    if address == "" or login == "" or (passwd == "" and passwd_script == ""):
       usage()
-      sys.exit()
+      sys.exit(1)
 
   else: #Take args from stdin...
     params = {}
     #place params in dict
     for line in sys.stdin:
       val = line.split("=")
-      params[val[0]] = val[1]
-
+      if len(val) == 2:
+        params[val[0].strip()] = val[1].strip()
+    
     try:
       address = params["ipaddr"]
     except KeyError, e:
       os.write(standard_err, "FENCE: Missing ipaddr param for fence_rsa...exiting")
+      sys.exit(1)
+    
     try:
       login = params["login"]
     except KeyError, e:
       os.write(standard_err, "FENCE: Missing login param for fence_rsa...exiting")
-
+      sys.exit(1)
+    
     try:
-      passwd = params["passwd"]
+      if 'passwd' in params:
+        passwd = params["passwd"]
+      if 'passwd_script' in params:
+        passwd_script = params['passwd_script']
+      if passwd == "" and passwd_script == "":
+        raise "missing password"
     except KeyError, e:
       os.write(standard_err, "FENCE: Missing passwd param for fence_rsa...exiting")
-
-
+      sys.exit(1)
+    
     try:
       a = params["option"]
       if a == "Off" or a == "OFF" or a == "off":
@@ -149,9 +162,67 @@
         action = POWER_REBOOT
     except KeyError, e:
       action = POWER_REBOOT
-
+    
     ####End of stdin section
-
+  
+  
+  # retrieve passwd from passwd_script (if specified)
+  passwd_scr = ''
+  if len(passwd_script):
+    try:
+      if not os.access(passwd_script, os.X_OK):
+        raise 'script not executable'
+      p = os.popen(passwd_script, 'r', 1024)
+      passwd_scr = p.readline().strip()
+      if p.close() != None:
+        raise 'script failed'
+    except:
+      sys.stderr.write('password-script "%s" failed\n' % passwd_script)
+      passwd_scr = ''
+  
+  if passwd == "" and passwd_scr == "":
+    sys.stderr.write('password not available, exiting...')
+    sys.exit(1)
+  elif passwd == passwd_scr:
+    pass
+  elif passwd and passwd_scr:
+    # execute self, with password_scr as passwd,
+    # if that fails, continue with "passwd" argument as password
+    if len(sys.argv) > 1:
+      comm = sys.argv[0]
+      skip_next = False
+      for w in sys.argv[1:]:
+        if skip_next:
+          skip_next = False
+        elif w in ['-p', '-S']:
+          skip_next = True
+        else:
+          comm += ' ' + w
+      comm += ' -p ' + passwd_scr
+      ret = os.system(comm)
+      if ret != -1 and os.WIFEXITED(ret) and os.WEXITSTATUS(ret) == 0:
+        # success
+        sys.exit(0)
+      else:
+        sys.stderr.write('Use of password from "passwd_script" failed, trying "passwd" argument\n')
+    else: # use stdin
+      p = os.popen(sys.argv[0], 'w', 1024)
+      for par in params:
+        if par not in ['passwd', 'passwd_script']:
+          p.write(par + '=' + params[par] + '\n')
+      p.write('passwd=' + passwd_scr + '\n')
+      p.flush()
+      if p.close() == None:
+        # success
+        sys.exit(0)
+      else:
+        sys.stderr.write('Use of password from "passwd_script" failed, trying "passwd" argument\n')
+  elif passwd_scr:
+    passwd = passwd_scr
+  # passwd all set
+  
+  
+  
   ##Time to open telnet session and log in. 
   try:
     sock = Telnet(address.strip())
--- cluster/fence/agents/rsb/fence_rsb.py	2006/04/19 19:39:01	1.1
+++ cluster/fence/agents/rsb/fence_rsb.py	2007/06/27 15:38:18	1.1.2.1
@@ -33,17 +33,18 @@
 #END_VERSION_GENERATION
 
 def usage():
-  print "Usage:\n"
-  print "fence_rsb [options]\n"
-  print "Options:\n"
-  print "   -a <ipaddress>           ip or hostname of rsb\n"
-  print "   -h                       print out help\n"
-  print "   -l [login]               login name\n"
-  print "   -n [telnet port]         telnet port\n"
-  print "   -p [password]            password\n"
-  print "   -o [action]              Reboot (default), Off, On, or Status\n"
-  print "   -v Verbose               Verbose mode\n"
-  print "   -V                       Print Version, then exit\n"
+  print "Usage:"
+  print "fence_rsb [options]"
+  print "Options:"
+  print "   -a <ipaddress>           ip or hostname of rsb"
+  print "   -h                       print out help"
+  print "   -l [login]               login name"
+  print "   -n [telnet port]         telnet port"
+  print "   -p [password]            password"
+  print "   -S [path]                script to run to retrieve password"
+  print "   -o [action]              Reboot (default), Off, On, or Status"
+  print "   -v Verbose               Verbose mode"
+  print "   -V                       Print Version, then exit"
 
   sys.exit (0)
 
@@ -64,6 +65,7 @@
   address = ""
   login = ""
   passwd = ""
+  passwd_script = ""
   action = POWER_REBOOT   #default action
   telnet_port = 3172
   verbose = False
@@ -93,7 +95,7 @@
 
   if len(sys.argv) > 1:
     try:
-      opts, args = getopt.getopt(sys.argv[1:], "a:hl:n:o:p:vV", ["help", "output="])
+      opts, args = getopt.getopt(sys.argv[1:], "a:hl:n:o:p:S:vV", ["help", "output="])
     except getopt.GetoptError:
       #print help info and quit
       usage()
@@ -106,13 +108,15 @@
         version()
       if o in ("-h", "--help"):
         usage()
-        sys.exit()
+        sys.exit(0)
       if o == "-l":
         login = a
       if o == "-n":
         telnet_port = a
       if o == "-p":
         passwd = a
+      if o == "-S":
+        passwd_script = a
       if o  == "-o":
         if a == "Off" or a == "OFF" or a == "off":
           action = POWER_OFF
@@ -124,34 +128,44 @@
           action = POWER_REBOOT
         else:
           usage()
-          sys.exit()
+          sys.exit(1)
       if o == "-a":
         address = a
-    if address == "" or login == "" or passwd == "":
+    if address == "" or login == "" or (passwd == "" and passwd_script == ""):
       usage()
-      sys.exit()
+      sys.exit(1)
 
   else: #Take args from stdin...
     params = {}
     #place params in dict
     for line in sys.stdin:
       val = line.split("=")
-      params[val[0]] = val[1]
+      if len(val) == 2:
+        params[val[0].strip()] = val[1].strip()
 
     try:
       address = params["ipaddr"]
     except KeyError, e:
       os.write(standard_err, "FENCE: Missing ipaddr param for fence_rsb...exiting")
+      sys.exit(1)
+    
     try:
       login = params["login"]
     except KeyError, e:
       os.write(standard_err, "FENCE: Missing login param for fence_rsb...exiting")
-
+      sys.exit(1)
+    
     try:
-      passwd = params["passwd"]
+      if 'passwd' in params:
+        passwd = params["passwd"]
+      if 'passwd_script' in params:
+        passwd_script = params['passwd_script']
+      if passwd == "" and passwd_script == "":
+        raise "missing password"
     except KeyError, e:
       os.write(standard_err, "FENCE: Missing passwd param for fence_rsb...exiting")
-
+      sys.exit(1)
+    
     try:
       telnet_port = params["telnet_port"]
     except KeyError, e:
@@ -169,7 +183,65 @@
       action = POWER_REBOOT
 
     ####End of stdin section
-
+  
+  
+  # retrieve passwd from passwd_script (if specified)
+  passwd_scr = ''
+  if len(passwd_script):
+    try:
+      if not os.access(passwd_script, os.X_OK):
+        raise 'script not executable'
+      p = os.popen(passwd_script, 'r', 1024)
+      passwd_scr = p.readline().strip()
+      if p.close() != None:
+        raise 'script failed'
+    except:
+      sys.stderr.write('password-script "%s" failed\n' % passwd_script)
+      passwd_scr = ''
+  
+  if passwd == "" and passwd_scr == "":
+    sys.stderr.write('password not available, exiting...')
+    sys.exit(1)
+  elif passwd == passwd_scr:
+    pass
+  elif passwd and passwd_scr:
+    # execute self, with password_scr as passwd,
+    # if that fails, continue with "passwd" argument as password
+    if len(sys.argv) > 1:
+      comm = sys.argv[0]
+      skip_next = False
+      for w in sys.argv[1:]:
+        if skip_next:
+          skip_next = False
+        elif w in ['-p', '-S']:
+          skip_next = True
+        else:
+          comm += ' ' + w
+      comm += ' -p ' + passwd_scr
+      ret = os.system(comm)
+      if ret != -1 and os.WIFEXITED(ret) and os.WEXITSTATUS(ret) == 0:
+        # success
+        sys.exit(0)
+      else:
+        sys.stderr.write('Use of password from "passwd_script" failed, trying "passwd" argument\n')
+    else: # use stdin
+      p = os.popen(sys.argv[0], 'w', 1024)
+      for par in params:
+        if par not in ['passwd', 'passwd_script']:
+          p.write(par + '=' + params[par] + '\n')
+      p.write('passwd=' + passwd_scr + '\n')
+      p.flush()
+      if p.close() == None:
+        # success
+        sys.exit(0)
+      else:
+        sys.stderr.write('Use of password from "passwd_script" failed, trying "passwd" argument\n')
+  elif passwd_scr:
+    passwd = passwd_scr
+  # passwd all set
+  
+  
+  
   try:
     telnet_port = int(telnet_port)
   except:
--- cluster/fence/agents/sanbox2/fence_sanbox2.pl	2006/08/16 19:06:05	1.3
+++ cluster/fence/agents/sanbox2/fence_sanbox2.pl	2007/06/27 15:38:18	1.3.2.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
@@ -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;
--- cluster/fence/agents/vixel/fence_vixel.pl	2006/08/16 19:06:43	1.2
+++ cluster/fence/agents/vixel/fence_vixel.pl	2007/06/27 15:38:18	1.2.2.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
@@ -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");
@@ -141,57 +160,57 @@
 
 sub get_options_stdin
 {
-    my $opt;
-    my $line = 0;
-
-    while( defined($in = <>) )
-    {   
-        $_ = $in;
-	chomp;
-        
-        # strip leading and trailing whitespace
-        s/^\s*//;
-        s/\s*$//;
-
-        # skip comments
-        next if /^#/;
-
-        $line+=1;
-        $opt=$_;
-        next unless $opt;
-
-        ($name,$val)=split /\s*=\s*/, $opt;
-
-        if ( $name eq "" ) {
-           print("parse error: illegal name in option $line\n");
-           exit 2;
-        } 
-
-        # DO NOTHING -- this field is used by fenced
-	elsif ($name eq "agent" ) { }
-
-	# FIXME -- depricated.  use "port" instead.
-	elsif ($name eq "fm" ) {
-            (my $dummy,$opt_n) = split /\s+/,$val;
-	    print STDERR "Depricated \"fm\" entry detected.  refer to man page.\n";
-        } 
+	my $opt;
+	my $line = 0;
 
-	elsif ($name eq "ipaddr" ) 
+	while( defined($in = <>) )
 	{
-            $opt_a = $val;
-        } 
+		$_ = $in;
+		chomp;
 
-	elsif ($name eq "name" ) { }
-
-        elsif ($name eq "passwd" ) 
-	{
-            $opt_p = $val;
-        } 
-
-        elsif ($name eq "port" ) 
-	{
-            $opt_n = $val;
-        } 
-    }
+		# strip leading and trailing whitespace
+		s/^\s*//;
+		s/\s*$//;
+
+		# skip comments
+		next if /^#/;
+
+		$line+=1;
+		$opt=$_;
+		next unless $opt;
+
+		($name,$val)=split /\s*=\s*/, $opt;
+
+		if ( $name eq "" ) {
+			print("parse error: illegal name in option $line\n");
+			exit 2;
+		} 
+
+		# DO NOTHING -- this field is used by fenced
+		elsif ($name eq "agent" ) { }
+
+		# FIXME -- depricated.  use "port" instead.
+		elsif ($name eq "fm" ) {
+			(my $dummy,$opt_n) = split /\s+/,$val;
+			print STDERR "Depricated \"fm\" entry detected. Refer to man page.\n";
+		} 
+		elsif ($name eq "ipaddr" ) 
+		{
+			$opt_a = $val;
+		} 
+		elsif ($name eq "name" ) { }
+		elsif ($name eq "passwd" ) 
+		{
+			$opt_p = $val;
+		}
+		elsif ($name eq "passwd_script" )
+		{
+			$opt_S = $val;
+		} 
+		elsif ($name eq "port" ) 
+		{
+			$opt_n = $val;
+		} 
+	}
 }
 
--- cluster/fence/agents/vmware/fence_vmware.pl	2005/09/01 18:25:42	1.1
+++ cluster/fence/agents/vmware/fence_vmware.pl	2007/06/27 15:38:18	1.1.2.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
@@ -21,7 +21,7 @@
 use VMware::VmPerl::VM;
 use VMware::VmPerl::Server;
 use VMware::VmPerl::ConnectParams;
-use vars qw( $opt_L $opt_v $opt_V $opt_h $opt_T $opt_n $opt_o $opt_p $opt_P $opt_l $opt_a $opt_q $vm_product $vm_platform $vm_build $vm_version_major $vm_version_minor $vm_version_revision );
+use vars qw( $opt_L $opt_v $opt_V $opt_h $opt_T $opt_n $opt_o $opt_p $opt_P $opt_S $opt_l $opt_a $opt_q $vm_product $vm_platform $vm_build $vm_version_major $vm_version_minor $vm_version_revision );
 
 # Get the program name from $0 and strip directory names
 $_=$0;
@@ -62,6 +62,7 @@
 	print "  -h               usage\n";
 	print "  -l <name>        Login name\n";
 	print "  -p <string>      Login password\n";
+	print "  -S <path>        Script to run to retrieve login password\n";
 	print "  -n <name>        Name of VM to change \n";
 	print "  -o <string>      Action: Reboot (default), Off or On\n";
 	print "  -q               quiet mode\n";
@@ -99,7 +100,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;
 }
 
@@ -240,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;
@@ -275,7 +280,7 @@
 ### MAIN #######################################################
 
 if (@ARGV > 0) {
-	getopts("a:hl:n:o:p:qTvVL") || fail_usage ;
+	getopts("a:hl:n:o:p:S:qTvVL") || fail_usage ;
 	
 	usage if defined $opt_h;
 	version if defined $opt_V;
@@ -285,9 +290,18 @@
 	fail_usage "No '-a' flag specified." unless defined $opt_a;
 	fail_usage "No '-n' flag specified." unless defined $opt_n or defined $opt_L;
 	fail_usage "No '-l' flag specified." unless defined $opt_l;
-	fail_usage "No '-p' flag specified." unless defined $opt_p;
-	fail_usage "Unrecognised action '$opt_o' for '-o' flag"
-	unless $opt_o =~ /^(Off|On|Reboot)$/i;
+
+	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 "Unrecognized action '$opt_o' for '-o' flag"
+		unless $opt_o =~ /^(Off|On|Reboot)$/i;
 
 	($opt_a, $opt_P) = split(/:/, $opt_a);
 	fail_usage "No port number specified." unless defined $opt_P;
@@ -298,9 +312,18 @@
 	fail "failed: no IP address" unless defined $opt_a;
 	fail "failed: no vm name" 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 =~ /^(Off|On|Reboot)$/i;
+	fail "failed: unrecognized action: $opt_o"
+		unless $opt_o =~ /^(Off|On|Reboot)$/i;
 } 
 
 &login;
--- cluster/fence/agents/wti/fence_wti.pl	2007/01/31 20:20:48	1.5.2.1
+++ cluster/fence/agents/wti/fence_wti.pl	2007/06/27 15:38:19	1.5.2.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;
--- cluster/fence/agents/xcat/fence_xcat.pl	2006/08/16 19:18:44	1.2
+++ cluster/fence/agents/xcat/fence_xcat.pl	2007/06/27 15:38:19	1.2.2.1
@@ -4,6 +4,7 @@
 ###############################################################################
 ##
 ##  Copyright (C) Sistina Software, Inc.  1997-2003  All rights reserved.
+##  Copyright (C) 2004-2007 Red Hat, Inc.  All rights reserved.
 ##
 ###############################################################################
 ###############################################################################
--- cluster/fence/agents/xen/fence_xen.pl	2005/06/16 15:05:42	1.2
+++ cluster/fence/agents/xen/fence_xen.pl	2007/06/27 15:38:19	1.2.2.1
@@ -3,7 +3,7 @@
 ###############################################################################
 ###############################################################################
 ##
-##  Copyright (C) 2005 Red Hat, Inc.  All rights reserved.
+##  Copyright (C) 2005-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,9 +35,9 @@
 # "#END_VERSION_GENERATION"  It is generated by the Makefile
 
 #BEGIN_VERSION_GENERATION
-$FENCE_RELEASE_NAME="DEVEL.1105353156";
-$REDHAT_COPYRIGHT=("Copyright (C) Red Hat, Inc.  2005  All rights reserved.");
-$BUILD_DATE="(built Mon Jan 10 10:35:41 GMT 2005)";
+$FENCE_RELEASE_NAME="";
+$REDHAT_COPYRIGHT="";
+$BUILD_DATE="";
 #END_VERSION_GENERATION
 
 sub usage
@@ -83,7 +83,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;
 }
 
--- cluster/fence/agents/zvm/fence_zvm.pl	2004/06/24 08:53:17	1.1
+++ cluster/fence/agents/zvm/fence_zvm.pl	2007/06/27 15:38:19	1.1.16.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
@@ -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;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]