cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] cluster/fence/agents/ipmilan ipmilan.c
@ 2007-06-26 19:52 lhh
  0 siblings, 0 replies; 11+ messages in thread
From: lhh @ 2007-06-26 19:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	lhh at sourceware.org	2007-06-26 19:52:53

Modified files:
	fence/agents/ipmilan: ipmilan.c 

Log message:
	Make lan+ work if built as a STONITH module

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ipmilan/ipmilan.c.diff?cvsroot=cluster&r1=1.11&r2=1.12

--- cluster/fence/agents/ipmilan/ipmilan.c	2007/02/13 19:23:40	1.11
+++ cluster/fence/agents/ipmilan/ipmilan.c	2007/06/26 19:52:52	1.12
@@ -665,6 +665,7 @@
 	char *end = NULL;
 	struct ipmi *i;
 	size_t len;
+	int lanplus = 0;
 
 	if (!ISIPMI(s))
 		return S_OOPS;
@@ -679,6 +680,10 @@
 	if (user) {
 		*user = 0;
 		user++;
+		if (*user && *user == '+') {
+			lanplus = 1;
+			user++;
+		}
 	}
 
 	/* No separator or end of string reached */
@@ -710,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;



^ permalink raw reply	[flat|nested] 11+ messages in thread
* [Cluster-devel] cluster/fence/agents/ipmilan ipmilan.c
@ 2007-09-24 21:56 rmccabe
  0 siblings, 0 replies; 11+ messages in thread
From: rmccabe @ 2007-09-24 21:56 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	rmccabe at sourceware.org	2007-09-24 21:56:43

Modified files:
	fence/agents/ipmilan: ipmilan.c 

Log message:
	Backport the agent from RHEL5.1 to fix bz205638

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ipmilan/ipmilan.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.8&r2=1.1.2.9

--- cluster/fence/agents/ipmilan/ipmilan.c	2007/02/13 19:38:33	1.1.2.8
+++ cluster/fence/agents/ipmilan/ipmilan.c	2007/09/24 21:56:43	1.1.2.9
@@ -30,9 +30,9 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <signal.h>
-#include <limits.h>
 #include <string.h>
 #include <errno.h>
+#include <limits.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <libintl.h>
@@ -92,6 +92,7 @@
 	pid_t i_pid;
 	int i_config;
 	int i_verbose;
+	int i_lanplus;
 };
 
 
@@ -176,8 +177,13 @@
 	int x;
 
 	/* Store path */
-	snprintf(cmd, sizeof(cmd), "%s -I lan -H %s", ipmi->i_ipmitool,
-		 ipmi->i_host);
+	if (ipmi->i_lanplus) {
+		snprintf(cmd, sizeof(cmd), "%s -I lanplus -H %s", 
+				ipmi->i_ipmitool, ipmi->i_host);
+	} else {
+		snprintf(cmd, sizeof(cmd), "%s -I lan -H %s", ipmi->i_ipmitool,
+				ipmi->i_host);
+	}
 
 	if (ipmi->i_user) {
 		snprintf(arg, sizeof(arg), " -U %s", ipmi->i_user);
@@ -460,7 +466,7 @@
  */
 static struct ipmi *
 ipmi_init(struct ipmi *i, char *host, char *authtype,
-	  char *user, char *password, int verbose)
+	  char *user, char *password, int lanplus, int verbose)
 {
 	const char *p;
 
@@ -530,6 +536,7 @@
 	i->i_pid = -1;
 	i->i_id = IPMIID;
 	i->i_verbose = verbose;
+	i->i_lanplus = lanplus;
 
 	return i;
 }
@@ -574,7 +581,7 @@
 	}
 
 	memset((void *)i, 0, sizeof(*i));
-	ipmi_init(i, NULL, NULL, NULL, NULL, 0);
+	ipmi_init(i, NULL, NULL, NULL, NULL, 0, 0);
 	return i;
 }
 
@@ -658,6 +665,7 @@
 	char *end = NULL;
 	struct ipmi *i;
 	size_t len;
+	int lanplus = 0;
 
 	if (!ISIPMI(s))
 		return S_OOPS;
@@ -672,6 +680,10 @@
 	if (user) {
 		*user = 0;
 		user++;
+		if (*user && *user == '+') {
+			lanplus = 1;
+			user++;
+		}
 	}
 
 	/* No separator or end of string reached */
@@ -703,7 +715,7 @@
 		user = NULL;
 
 	/* IPMI auth type not supported on RHEL3 */
-	i = ipmi_init(i, host, NULL, user, passwd, 0);
+	i = ipmi_init(i, host, NULL, user, passwd, lanplus, 0);
 	if (!i)
 		return S_OOPS;
 	i->i_config = 1;
@@ -809,7 +821,7 @@
 		  char *pwd_script, size_t pwd_script_len,
 		  char *user, size_t userlen,
 		  char *op, size_t oplen,
-		  int *verbose)
+		  int *lanplus, int *verbose)
 {
 	char in[256];
 	int line = 0;
@@ -856,20 +868,21 @@
 				strncpy(passwd, val, pwlen);
 			else
 				passwd[0] = 0;
+
 		} else if (!strcasecmp(name, "passwd_script")) {
-			if (val) {     
+			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")) {
+		} 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") ||
 			   !strcasecmp(name, "operation") ||
 			   !strcasecmp(name, "action")) {
@@ -877,11 +890,6 @@
 				strncpy(op, val, oplen);
 			else
 				op[0] = 0;
-		} else {
-			fprintf(stderr,
-				"parse error: illegal name on line %d\n",
-				line);
-			return 1;
 		}
 	}
 
@@ -908,6 +916,7 @@
 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");
@@ -921,6 +930,7 @@
 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");
@@ -940,7 +950,8 @@
 	char passwd[64];
 	char user[64];
 	char op[64];
-	char pwd_script[PATH_MAX];
+	char pwd_script[PATH_MAX] = { 0, };
+	int lanplus=0;
 	int verbose=0;
 	char *pname = basename(argv[0]);
 	struct ipmi *i;
@@ -948,7 +959,6 @@
 	memset(ip, 0, sizeof(ip));
 	memset(authtype, 0, sizeof(authtype));
 	memset(passwd, 0, sizeof(passwd));
-	memset(pwd_script, 0, sizeof(pwd_script));
 	memset(user, 0, sizeof(user));
 	memset(op, 0, sizeof(op));
 
@@ -956,7 +966,7 @@
 		/*
 		   Parse command line options if any were specified
 		 */
-		while ((opt = getopt(argc, argv, "A:a:i:l:p:S:o:vV?hH")) != EOF) {
+		while ((opt = getopt(argc, argv, "A:a:i:l:p:S:Po:vV?hH")) != EOF) {
 			switch(opt) {
 			case 'A':
 				/* Auth type */
@@ -975,8 +985,10 @@
 				/* password */
 				strncpy(passwd, optarg, sizeof(passwd));
 				break;
+			case 'P':
+				lanplus = 1;
+				break;
 			case 'S':
-				/* password script */
 				strncpy(pwd_script, optarg, sizeof(pwd_script));
 				pwd_script[sizeof(pwd_script) - 1] = '\0';
 				break;
@@ -1007,7 +1019,7 @@
 				      passwd, sizeof(passwd),
 					  pwd_script, sizeof(pwd_script),
 				      user, sizeof(user),
-				      op, sizeof(op), &verbose) != 0)
+				      op, sizeof(op), &lanplus, &verbose) != 0)
 			return 1;
 	}
 
@@ -1057,7 +1069,7 @@
 
 
 	/* Ok, set up the IPMI struct */
-	i = ipmi_init(NULL, ip, authtype, user, passwd, verbose);
+	i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose);
 	if (!i)
 		fail_exit("Failed to initialize\n");
 



^ permalink raw reply	[flat|nested] 11+ messages in thread
* [Cluster-devel] cluster/fence/agents/ipmilan ipmilan.c
@ 2007-09-12 14:54 jparsons
  0 siblings, 0 replies; 11+ messages in thread
From: jparsons @ 2007-09-12 14:54 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	jparsons at sourceware.org	2007-09-12 14:54:54

Modified files:
	fence/agents/ipmilan: ipmilan.c 

Log message:
	Minor usage text fix

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ipmilan/ipmilan.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8.2.3&r2=1.8.2.4

--- cluster/fence/agents/ipmilan/ipmilan.c	2007/06/27 15:38:17	1.8.2.3
+++ cluster/fence/agents/ipmilan/ipmilan.c	2007/09/12 14:54:54	1.8.2.4
@@ -913,7 +913,7 @@
 printf("usage: %s <options>\n", pname);
 printf("   -A <authtype>  IPMI Lan Auth type (md5, password, or none)\n");
 printf("   -a <ipaddr>    IPMI Lan IP to talk to\n");
-printf("   -i <ipaddr>    IPMI Lan IP to talk to (deprecated, use -i)\n");
+printf("   -i <ipaddr>    IPMI Lan IP to talk to (deprecated, use -a)\n");
 printf("   -p <password>  Password (if required) to control power on\n"
        "                  IPMI device\n");
 printf("   -P             Use Lanplus\n");



^ permalink raw reply	[flat|nested] 11+ messages in thread
* [Cluster-devel] cluster/fence/agents/ipmilan ipmilan.c
@ 2007-01-29 20:43 rohara
  0 siblings, 0 replies; 11+ messages in thread
From: rohara @ 2007-01-29 20:43 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	STABLE
Changes by:	rohara at sourceware.org	2007-01-29 20:43:47

Modified files:
	fence/agents/ipmilan: ipmilan.c 

Log message:
	If no password is specified, pass a "-P ''" to the ipmitool to prevent
	it from prompting for a password.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ipmilan/ipmilan.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.1.2.2.6.3&r2=1.1.2.2.6.4

--- cluster/fence/agents/ipmilan/ipmilan.c	2006/02/02 22:11:23	1.1.2.2.6.3
+++ cluster/fence/agents/ipmilan/ipmilan.c	2007/01/29 20:43:47	1.1.2.2.6.4
@@ -191,6 +191,9 @@
 	if (ipmi->i_password) {
 		snprintf(arg, sizeof(arg), " -P %s", ipmi->i_password);
 		strncat(cmd, arg, sizeof(cmd) - strlen(arg));
+	} else {
+		snprintf(arg, sizeof(arg), " -P ''");
+		strncat(cmd, arg, sizeof(cmd) - strlen(arg));
 	}
 
 	/* Tack on the -v flags for ipmitool; in most cases, i_verbose



^ permalink raw reply	[flat|nested] 11+ messages in thread
* [Cluster-devel] cluster/fence/agents/ipmilan ipmilan.c
@ 2007-01-29 20:34 rohara
  0 siblings, 0 replies; 11+ messages in thread
From: rohara @ 2007-01-29 20:34 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	rohara at sourceware.org	2007-01-29 20:34:38

Modified files:
	fence/agents/ipmilan: ipmilan.c 

Log message:
	If no password is specified, pass a "-P ''" to the ipmitool to prevent
	it from prompting for a password.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ipmilan/ipmilan.c.diff?cvsroot=cluster&r1=1.9&r2=1.10

--- cluster/fence/agents/ipmilan/ipmilan.c	2007/01/10 23:45:20	1.9
+++ cluster/fence/agents/ipmilan/ipmilan.c	2007/01/29 20:34:38	1.10
@@ -197,6 +197,9 @@
 	if (ipmi->i_password) {
 		snprintf(arg, sizeof(arg), " -P %s", ipmi->i_password);
 		strncat(cmd, arg, sizeof(cmd) - strlen(arg));
+	} else {
+		snprintf(arg, sizeof(arg), " -P ''");
+		strncat(cmd, arg, sizeof(cmd) - strlen(arg));
 	}
 
 	/* Tack on the -v flags for ipmitool; in most cases, i_verbose



^ permalink raw reply	[flat|nested] 11+ messages in thread
* [Cluster-devel] cluster/fence/agents/ipmilan ipmilan.c
@ 2007-01-29 20:33 rohara
  0 siblings, 0 replies; 11+ messages in thread
From: rohara @ 2007-01-29 20:33 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	rohara at sourceware.org	2007-01-29 20:33:03

Modified files:
	fence/agents/ipmilan: ipmilan.c 

Log message:
	If no password is specified, pass a "-P ''" to the ipmitool to prevent
	it from prompting for a password.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ipmilan/ipmilan.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8.2.1&r2=1.8.2.2

--- cluster/fence/agents/ipmilan/ipmilan.c	2007/01/10 23:46:37	1.8.2.1
+++ cluster/fence/agents/ipmilan/ipmilan.c	2007/01/29 20:33:03	1.8.2.2
@@ -197,6 +197,9 @@
 	if (ipmi->i_password) {
 		snprintf(arg, sizeof(arg), " -P %s", ipmi->i_password);
 		strncat(cmd, arg, sizeof(cmd) - strlen(arg));
+	} else {
+		snprintf(arg, sizeof(arg), " -P ''");
+		strncat(cmd, arg, sizeof(cmd) - strlen(arg));
 	}
 
 	/* Tack on the -v flags for ipmitool; in most cases, i_verbose



^ permalink raw reply	[flat|nested] 11+ messages in thread
* [Cluster-devel] cluster/fence/agents/ipmilan ipmilan.c
@ 2007-01-29 20:31 rohara
  0 siblings, 0 replies; 11+ messages in thread
From: rohara @ 2007-01-29 20:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	rohara at sourceware.org	2007-01-29 20:31:13

Modified files:
	fence/agents/ipmilan: ipmilan.c 

Log message:
	If no password is specified, pass a "-P ''" to the ipmitool to prevent
	it from prompting for a password.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ipmilan/ipmilan.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.6&r2=1.1.2.7

--- cluster/fence/agents/ipmilan/ipmilan.c	2006/02/02 22:09:03	1.1.2.6
+++ cluster/fence/agents/ipmilan/ipmilan.c	2007/01/29 20:31:13	1.1.2.7
@@ -191,6 +191,9 @@
 	if (ipmi->i_password) {
 		snprintf(arg, sizeof(arg), " -P %s", ipmi->i_password);
 		strncat(cmd, arg, sizeof(cmd) - strlen(arg));
+	} else {
+		snprintf(arg, sizeof(arg), " -P ''");
+		strncat(cmd, arg, sizeof(cmd) - strlen(arg));
 	}
 
 	/* Tack on the -v flags for ipmitool; in most cases, i_verbose



^ permalink raw reply	[flat|nested] 11+ messages in thread
* [Cluster-devel] cluster/fence/agents/ipmilan ipmilan.c
@ 2007-01-10 23:47 jparsons
  0 siblings, 0 replies; 11+ messages in thread
From: jparsons @ 2007-01-10 23:47 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL50
Changes by:	jparsons at sourceware.org	2007-01-10 23:47:31

Modified files:
	fence/agents/ipmilan: ipmilan.c 

Log message:
	bz222234

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ipmilan/ipmilan.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.8&r2=1.8.4.1

--- cluster/fence/agents/ipmilan/ipmilan.c	2006/08/15 18:37:04	1.8
+++ cluster/fence/agents/ipmilan/ipmilan.c	2007/01/10 23:47:30	1.8.4.1
@@ -91,6 +91,7 @@
 	pid_t i_pid;
 	int i_config;
 	int i_verbose;
+	int i_lanplus;
 };
 
 
@@ -175,8 +176,13 @@
 	int x;
 
 	/* Store path */
-	snprintf(cmd, sizeof(cmd), "%s -I lan -H %s", ipmi->i_ipmitool,
-		 ipmi->i_host);
+	if (ipmi->i_lanplus) {
+		snprintf(cmd, sizeof(cmd), "%s -I lanplus -H %s", 
+				ipmi->i_ipmitool, ipmi->i_host);
+	} else {
+		snprintf(cmd, sizeof(cmd), "%s -I lan -H %s", ipmi->i_ipmitool,
+				ipmi->i_host);
+	}
 
 	if (ipmi->i_user) {
 		snprintf(arg, sizeof(arg), " -U %s", ipmi->i_user);
@@ -456,7 +462,7 @@
  */
 static struct ipmi *
 ipmi_init(struct ipmi *i, char *host, char *authtype,
-	  char *user, char *password, int verbose)
+	  char *user, char *password, int lanplus, int verbose)
 {
 	const char *p;
 
@@ -526,6 +532,7 @@
 	i->i_pid = -1;
 	i->i_id = IPMIID;
 	i->i_verbose = verbose;
+	i->i_lanplus = lanplus;
 
 	return i;
 }
@@ -570,7 +577,7 @@
 	}
 
 	memset((void *)i, 0, sizeof(*i));
-	ipmi_init(i, NULL, NULL, NULL, NULL, 0);
+	ipmi_init(i, NULL, NULL, NULL, NULL, 0, 0);
 	return i;
 }
 
@@ -699,7 +706,7 @@
 		user = NULL;
 
 	/* IPMI auth type not supported on RHEL3 */
-	i = ipmi_init(i, host, NULL, user, passwd, 0);
+	i = ipmi_init(i, host, NULL, user, passwd, 0, 0);
 	if (!i)
 		return S_OOPS;
 	i->i_config = 1;
@@ -804,7 +811,7 @@
 		  char *passwd, size_t pwlen,
 		  char *user, size_t userlen,
 		  char *op, size_t oplen,
-		  int *verbose)
+		  int *lanplus, int *verbose)
 {
 	char in[256];
 	int line = 0;
@@ -860,6 +867,8 @@
 			else
 				user[0] = 0;
 
+		} else if (!strcasecmp(name, "lanplus")) {
+			(*lanplus) = 1;
 		} else if (!strcasecmp(name, "option") ||
 			   !strcasecmp(name, "operation") ||
 			   !strcasecmp(name, "action")) {
@@ -923,6 +932,7 @@
 	char passwd[64];
 	char user[64];
 	char op[64];
+	int lanplus=0;
 	int verbose=0;
 	char *pname = basename(argv[0]);
 	struct ipmi *i;
@@ -937,7 +947,7 @@
 		/*
 		   Parse command line options if any were specified
 		 */
-		while ((opt = getopt(argc, argv, "A:a:i:l:p:o:vV?hH")) != EOF) {
+		while ((opt = getopt(argc, argv, "A:a:i:l:p:Po:vV?hH")) != EOF) {
 			switch(opt) {
 			case 'A':
 				/* Auth type */
@@ -956,6 +966,9 @@
 				/* password */
 				strncpy(passwd, optarg, sizeof(passwd));
 				break;
+			case 'P':
+				lanplus = 1;
+				break;
 			case 'o':
 				/* Operation */
 				strncpy(op, optarg, sizeof(op));
@@ -982,7 +995,7 @@
 				      authtype, sizeof(authtype),
 				      passwd, sizeof(passwd),
 				      user, sizeof(user),
-				      op, sizeof(op), &verbose) != 0)
+				      op, sizeof(op), &lanplus, &verbose) != 0)
 			return 1;
 	}
 
@@ -1011,7 +1024,7 @@
 
 
 	/* Ok, set up the IPMI struct */
-	i = ipmi_init(NULL, ip, authtype, user, passwd, verbose);
+	i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose);
 	if (!i)
 		fail_exit("Failed to initialize\n");
 



^ permalink raw reply	[flat|nested] 11+ messages in thread
* [Cluster-devel] cluster/fence/agents/ipmilan ipmilan.c
@ 2007-01-10 23:46 jparsons
  0 siblings, 0 replies; 11+ messages in thread
From: jparsons @ 2007-01-10 23:46 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	jparsons at sourceware.org	2007-01-10 23:46:37

Modified files:
	fence/agents/ipmilan: ipmilan.c 

Log message:
	bz222234

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ipmilan/ipmilan.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8&r2=1.8.2.1

--- cluster/fence/agents/ipmilan/ipmilan.c	2006/08/15 18:37:04	1.8
+++ cluster/fence/agents/ipmilan/ipmilan.c	2007/01/10 23:46:37	1.8.2.1
@@ -91,6 +91,7 @@
 	pid_t i_pid;
 	int i_config;
 	int i_verbose;
+	int i_lanplus;
 };
 
 
@@ -175,8 +176,13 @@
 	int x;
 
 	/* Store path */
-	snprintf(cmd, sizeof(cmd), "%s -I lan -H %s", ipmi->i_ipmitool,
-		 ipmi->i_host);
+	if (ipmi->i_lanplus) {
+		snprintf(cmd, sizeof(cmd), "%s -I lanplus -H %s", 
+				ipmi->i_ipmitool, ipmi->i_host);
+	} else {
+		snprintf(cmd, sizeof(cmd), "%s -I lan -H %s", ipmi->i_ipmitool,
+				ipmi->i_host);
+	}
 
 	if (ipmi->i_user) {
 		snprintf(arg, sizeof(arg), " -U %s", ipmi->i_user);
@@ -456,7 +462,7 @@
  */
 static struct ipmi *
 ipmi_init(struct ipmi *i, char *host, char *authtype,
-	  char *user, char *password, int verbose)
+	  char *user, char *password, int lanplus, int verbose)
 {
 	const char *p;
 
@@ -526,6 +532,7 @@
 	i->i_pid = -1;
 	i->i_id = IPMIID;
 	i->i_verbose = verbose;
+	i->i_lanplus = lanplus;
 
 	return i;
 }
@@ -570,7 +577,7 @@
 	}
 
 	memset((void *)i, 0, sizeof(*i));
-	ipmi_init(i, NULL, NULL, NULL, NULL, 0);
+	ipmi_init(i, NULL, NULL, NULL, NULL, 0, 0);
 	return i;
 }
 
@@ -699,7 +706,7 @@
 		user = NULL;
 
 	/* IPMI auth type not supported on RHEL3 */
-	i = ipmi_init(i, host, NULL, user, passwd, 0);
+	i = ipmi_init(i, host, NULL, user, passwd, 0, 0);
 	if (!i)
 		return S_OOPS;
 	i->i_config = 1;
@@ -804,7 +811,7 @@
 		  char *passwd, size_t pwlen,
 		  char *user, size_t userlen,
 		  char *op, size_t oplen,
-		  int *verbose)
+		  int *lanplus, int *verbose)
 {
 	char in[256];
 	int line = 0;
@@ -860,6 +867,8 @@
 			else
 				user[0] = 0;
 
+		} else if (!strcasecmp(name, "lanplus")) {
+			(*lanplus) = 1;
 		} else if (!strcasecmp(name, "option") ||
 			   !strcasecmp(name, "operation") ||
 			   !strcasecmp(name, "action")) {
@@ -923,6 +932,7 @@
 	char passwd[64];
 	char user[64];
 	char op[64];
+	int lanplus=0;
 	int verbose=0;
 	char *pname = basename(argv[0]);
 	struct ipmi *i;
@@ -937,7 +947,7 @@
 		/*
 		   Parse command line options if any were specified
 		 */
-		while ((opt = getopt(argc, argv, "A:a:i:l:p:o:vV?hH")) != EOF) {
+		while ((opt = getopt(argc, argv, "A:a:i:l:p:Po:vV?hH")) != EOF) {
 			switch(opt) {
 			case 'A':
 				/* Auth type */
@@ -956,6 +966,9 @@
 				/* password */
 				strncpy(passwd, optarg, sizeof(passwd));
 				break;
+			case 'P':
+				lanplus = 1;
+				break;
 			case 'o':
 				/* Operation */
 				strncpy(op, optarg, sizeof(op));
@@ -982,7 +995,7 @@
 				      authtype, sizeof(authtype),
 				      passwd, sizeof(passwd),
 				      user, sizeof(user),
-				      op, sizeof(op), &verbose) != 0)
+				      op, sizeof(op), &lanplus, &verbose) != 0)
 			return 1;
 	}
 
@@ -1011,7 +1024,7 @@
 
 
 	/* Ok, set up the IPMI struct */
-	i = ipmi_init(NULL, ip, authtype, user, passwd, verbose);
+	i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose);
 	if (!i)
 		fail_exit("Failed to initialize\n");
 



^ permalink raw reply	[flat|nested] 11+ messages in thread
* [Cluster-devel] cluster/fence/agents/ipmilan ipmilan.c
@ 2007-01-10 23:45 jparsons
  0 siblings, 0 replies; 11+ messages in thread
From: jparsons @ 2007-01-10 23:45 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	jparsons at sourceware.org	2007-01-10 23:45:20

Modified files:
	fence/agents/ipmilan: ipmilan.c 

Log message:
	bz222234

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ipmilan/ipmilan.c.diff?cvsroot=cluster&r1=1.8&r2=1.9

--- cluster/fence/agents/ipmilan/ipmilan.c	2006/08/15 18:37:04	1.8
+++ cluster/fence/agents/ipmilan/ipmilan.c	2007/01/10 23:45:20	1.9
@@ -91,6 +91,7 @@
 	pid_t i_pid;
 	int i_config;
 	int i_verbose;
+	int i_lanplus;
 };
 
 
@@ -175,8 +176,13 @@
 	int x;
 
 	/* Store path */
-	snprintf(cmd, sizeof(cmd), "%s -I lan -H %s", ipmi->i_ipmitool,
-		 ipmi->i_host);
+	if (ipmi->i_lanplus) {
+		snprintf(cmd, sizeof(cmd), "%s -I lanplus -H %s", 
+				ipmi->i_ipmitool, ipmi->i_host);
+	} else {
+		snprintf(cmd, sizeof(cmd), "%s -I lan -H %s", ipmi->i_ipmitool,
+				ipmi->i_host);
+	}
 
 	if (ipmi->i_user) {
 		snprintf(arg, sizeof(arg), " -U %s", ipmi->i_user);
@@ -456,7 +462,7 @@
  */
 static struct ipmi *
 ipmi_init(struct ipmi *i, char *host, char *authtype,
-	  char *user, char *password, int verbose)
+	  char *user, char *password, int lanplus, int verbose)
 {
 	const char *p;
 
@@ -526,6 +532,7 @@
 	i->i_pid = -1;
 	i->i_id = IPMIID;
 	i->i_verbose = verbose;
+	i->i_lanplus = lanplus;
 
 	return i;
 }
@@ -570,7 +577,7 @@
 	}
 
 	memset((void *)i, 0, sizeof(*i));
-	ipmi_init(i, NULL, NULL, NULL, NULL, 0);
+	ipmi_init(i, NULL, NULL, NULL, NULL, 0, 0);
 	return i;
 }
 
@@ -699,7 +706,7 @@
 		user = NULL;
 
 	/* IPMI auth type not supported on RHEL3 */
-	i = ipmi_init(i, host, NULL, user, passwd, 0);
+	i = ipmi_init(i, host, NULL, user, passwd, 0, 0);
 	if (!i)
 		return S_OOPS;
 	i->i_config = 1;
@@ -804,7 +811,7 @@
 		  char *passwd, size_t pwlen,
 		  char *user, size_t userlen,
 		  char *op, size_t oplen,
-		  int *verbose)
+		  int *lanplus, int *verbose)
 {
 	char in[256];
 	int line = 0;
@@ -860,6 +867,8 @@
 			else
 				user[0] = 0;
 
+		} else if (!strcasecmp(name, "lanplus")) {
+			(*lanplus) = 1;
 		} else if (!strcasecmp(name, "option") ||
 			   !strcasecmp(name, "operation") ||
 			   !strcasecmp(name, "action")) {
@@ -923,6 +932,7 @@
 	char passwd[64];
 	char user[64];
 	char op[64];
+	int lanplus=0;
 	int verbose=0;
 	char *pname = basename(argv[0]);
 	struct ipmi *i;
@@ -937,7 +947,7 @@
 		/*
 		   Parse command line options if any were specified
 		 */
-		while ((opt = getopt(argc, argv, "A:a:i:l:p:o:vV?hH")) != EOF) {
+		while ((opt = getopt(argc, argv, "A:a:i:l:p:Po:vV?hH")) != EOF) {
 			switch(opt) {
 			case 'A':
 				/* Auth type */
@@ -956,6 +966,9 @@
 				/* password */
 				strncpy(passwd, optarg, sizeof(passwd));
 				break;
+			case 'P':
+				lanplus = 1;
+				break;
 			case 'o':
 				/* Operation */
 				strncpy(op, optarg, sizeof(op));
@@ -982,7 +995,7 @@
 				      authtype, sizeof(authtype),
 				      passwd, sizeof(passwd),
 				      user, sizeof(user),
-				      op, sizeof(op), &verbose) != 0)
+				      op, sizeof(op), &lanplus, &verbose) != 0)
 			return 1;
 	}
 
@@ -1011,7 +1024,7 @@
 
 
 	/* Ok, set up the IPMI struct */
-	i = ipmi_init(NULL, ip, authtype, user, passwd, verbose);
+	i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose);
 	if (!i)
 		fail_exit("Failed to initialize\n");
 



^ permalink raw reply	[flat|nested] 11+ messages in thread
* [Cluster-devel] cluster/fence/agents/ipmilan ipmilan.c
@ 2006-08-15 18:37 teigland
  0 siblings, 0 replies; 11+ messages in thread
From: teigland @ 2006-08-15 18:37 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	teigland at sourceware.org	2006-08-15 18:37:05

Modified files:
	fence/agents/ipmilan: ipmilan.c 

Log message:
	don't barf on extra args

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ipmilan/ipmilan.c.diff?cvsroot=cluster&r1=1.7&r2=1.8

--- cluster/fence/agents/ipmilan/ipmilan.c	2006/02/02 22:11:27	1.7
+++ cluster/fence/agents/ipmilan/ipmilan.c	2006/08/15 18:37:04	1.8
@@ -867,11 +867,6 @@
 				strncpy(op, val, oplen);
 			else
 				op[0] = 0;
-		} else {
-			fprintf(stderr,
-				"parse error: illegal name on line %d\n",
-				line);
-			return 1;
 		}
 	}
 



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-09-24 21:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-26 19:52 [Cluster-devel] cluster/fence/agents/ipmilan ipmilan.c lhh
  -- strict thread matches above, loose matches on Subject: below --
2007-09-24 21:56 rmccabe
2007-09-12 14:54 jparsons
2007-01-29 20:43 rohara
2007-01-29 20:34 rohara
2007-01-29 20:33 rohara
2007-01-29 20:31 rohara
2007-01-10 23:47 jparsons
2007-01-10 23:46 jparsons
2007-01-10 23:45 jparsons
2006-08-15 18:37 teigland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).