Skip to contentSkip to conversation

cluster/fence/agents baytech/fence_baytech.pl ...

Cluster-devel [email protected] 1 participant 1 message Jun 27, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: rmccabe at 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

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;
@@ -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 
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/ipmilan/ipmilan.c +57 -15

166 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;
@@ -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;
fence/agents/rackswitch/do_rack.c +36 -2
@@ -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)
fence/agents/rackswitch/do_rack.h +1 -0
@@ -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>
fence/agents/rps10/rps10.c +1 -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
fence/agents/rsa/fence_rsa.py +95 -24

180 lines not on this page · raw message

fence/agents/rsb/fence_rsb.py +93 -21

177 lines not on this page · raw message

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 +72 -53

169 lines not on this page · raw message

fence/agents/vmware/fence_vmware.pl +33 -10

92 lines not on this page · raw message

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/xen/fence_xen.pl +5 -5
@@ -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;
 }
 
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;
 }