Hi Steffen,

I went ahead and wrote a patch :-)

There are issues w/ it for longer term inclusion. (Need to probe channel
properly, need "get" equivalent", need additional command line options
to make it easier for a general user to understand.) But for now:

set payload <user id> <enable|disable> <payload number>

The payload_number for SOL is 1.

Also, please configure this via LAN and not inband.  This is due to a
channel probing issue.

Al

On Fri, 2006-12-08 at 09:11 -0800, Al Chu wrote:
> On Fri, 2006-12-08 at 17:10 +0100, Steffen Grunewald wrote: 
> > "sol activate" works for ADMIN only. As ROOT I get
> > 
> > > Info: SOL payload disabled
> > 
> > Any idea (what to check, what to try next) is welcome.
> 
> If I had to guess, I'd say that the SOL isn't enabled for the ROOT user.
> For SOL to be configured for use, the BMC has to have SOL enabled (I
> believe this is via ipmitool's "sol set enabled") and each user that may
> use SOL should be configured to allow it.
> 
> Skimming through the ipmitool manpage and some of the code, I'm not
> quite sure how the later is done or if it is supported.  The command
> that needs to be supported is the "Set User Payload Access" command,
> 24.6 in the IPMI spec.
> 
> A patch for this wouldn't be very hard.  I'll let someone with more
> ipmitool experience jump in though.
> 
> Al
> 
-- 
Albert Chu
[EMAIL PROTECTED]
925-422-5311
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
diff -pruN ipmitool-1.8.8/doc/ipmitool.1 ipmitool-1.8.8-patched/doc/ipmitool.1
--- ipmitool-1.8.8/doc/ipmitool.1	2006-04-27 11:05:57.000000000 -0700
+++ ipmitool-1.8.8-patched/doc/ipmitool.1	2006-12-08 09:23:29.336344000 -0800
@@ -1344,6 +1344,11 @@ Sets the username associated with the gi
 Sets the password for the given userid.  If no password is given,
 the password is cleared (set to the NULL password).  Be careful when
 removing passwords from administrator\-level accounts.
+.TP 
+\fIpayload\fP <\fBuserid\fR> <\fBenable|disable\fR> <\fBpayload number\fR>
+.br 
+
+Enable or disable payload numbers with the given userid.
 .RE
 .TP 
 \fIdisable\fP <\fBuserid\fR>
diff -pruN ipmitool-1.8.8/include/ipmitool/ipmi_constants.h ipmitool-1.8.8-patched/include/ipmitool/ipmi_constants.h
--- ipmitool-1.8.8/include/ipmitool/ipmi_constants.h	2006-03-19 09:59:38.000000000 -0800
+++ ipmitool-1.8.8-patched/include/ipmitool/ipmi_constants.h	2006-12-08 09:35:37.073436000 -0800
@@ -51,6 +51,8 @@
 #define IPMI_SUSPEND_RESUME_PAYLOAD_ENCRYPTYION 0x55
 #define IPMI_GET_SEL_TIME                       0x48
 #define IPMI_SET_SEL_TIME                       0x49
+#define IPMI_SET_USER_PAYLOAD_ACCESS            0x4c
+#define IPMI_GET_USER_PAYLOAD_ACCESS            0x4D
 
 #define IPMI_1_5_AUTH_TYPE_BIT_NONE     0x01
 #define IPMI_1_5_AUTH_TYPE_BIT_MD2      0x02
diff -pruN ipmitool-1.8.8/lib/ipmi_user.c ipmitool-1.8.8-patched/lib/ipmi_user.c
--- ipmitool-1.8.8/lib/ipmi_user.c	2006-03-28 09:01:16.000000000 -0800
+++ ipmitool-1.8.8-patched/lib/ipmi_user.c	2006-12-08 10:26:57.828129000 -0800
@@ -57,7 +57,8 @@ extern int csv_output;
 #define IPMI_PASSWORD_ENABLE_USER   0x01
 #define IPMI_PASSWORD_SET_PASSWORD  0x02
 #define IPMI_PASSWORD_TEST_PASSWORD 0x03
-
+#define IPMI_PAYLOAD_ENABLE         0x0
+#define IPMI_PAYLOAD_DISABLE        0x1
 
 /*
  * ipmi_get_user_access
@@ -447,6 +448,56 @@ ipmi_user_set_password(
 	return 0;
 }
 
+/*
+ * ipmi_user_set_payload
+ */
+static int
+ipmi_user_set_payload(
+		       struct ipmi_intf * intf,	   
+                       uint8_t    channel,
+		       uint8_t	  user_id,
+		       uint8_t	  operation,
+                       uint8_t    payload_number)
+{
+	struct ipmi_rs	     * rsp;
+	struct ipmi_rq	       req;
+	uint8_t	             * msg_data;
+
+	msg_data = (uint8_t*)malloc(6);
+
+
+	memset(&req, 0, sizeof(req));
+	req.msg.netfn    = IPMI_NETFN_APP;	    /* 0x06 */
+	req.msg.cmd	 = IPMI_SET_USER_PAYLOAD_ACCESS;  /* 0x4C */
+	req.msg.data     = msg_data;
+	req.msg.data_len = 6;
+
+
+	/* The channel number will remain constant throughout this function */
+        msg_data[0] = channel;
+        msg_data[1] = (operation << 6) | user_id;
+	msg_data[2] = 0x1 << payload_number;
+        msg_data[3] = 0;        /* reserved */
+        msg_data[4] = 0;        /* oem payloads */
+        msg_data[5] = 0;        /* reserved */
+
+	rsp = intf->sendrecv(intf, &req);
+
+	if (rsp == NULL) {
+		lprintf(LOG_ERR, "Set User Payload Access command failed (user %d)",
+			user_id);
+		return -1;
+	}
+
+	if (rsp->ccode > 0) {
+		lprintf(LOG_ERR, "Set User Payload Access command failed (user %d): %s",
+			user_id, val2str(rsp->ccode, completion_code_vals));
+		return rsp->ccode;
+	}
+
+	return 0;
+}
+
 
 
 /*
@@ -498,6 +549,7 @@ print_user_usage(void)
 	lprintf(LOG_NOTICE, "		   list	   [<channel number>]");
 	lprintf(LOG_NOTICE, "		   set name	<user id> <username>");
 	lprintf(LOG_NOTICE, "		   set password <user id> [<password>]");
+        lprintf(LOG_NOTICE, "		   set payload  <user id> <enable|disable> <payload number> [<channel number>]");
 	lprintf(LOG_NOTICE, "		   disable	<user id>");
 	lprintf(LOG_NOTICE, "		   enable	<user id>");
 	lprintf(LOG_NOTICE, "		   priv  	<user id> <privile level> [<channel number>]");
@@ -737,6 +789,61 @@ ipmi_user_main(struct ipmi_intf * intf, 
 									      0),
 							argv[3]);
 		}
+
+                /* 
+                 * Set Payload
+                 */
+		else if ((argc >= 2) &&
+			 (strncmp("payload", argv[1], 7) == 0))
+		{
+                        uint8_t operation;
+                        uint8_t channel;
+                        uint8_t payload_number;
+
+			if (argc != 5 && argc != 6)
+			{
+				print_user_usage();
+				return -1;
+			}
+
+                        if (strncmp("enable", argv[3], 6) == 0)
+                                operation = IPMI_PAYLOAD_ENABLE;
+                        else if (strncmp("disable", argv[3], 7) == 0)
+                                operation = IPMI_PAYLOAD_DISABLE;
+                        else
+                        {
+				print_user_usage();
+				return -1;
+                        }
+
+                        if (argc == 5)
+                                channel = 0x0E; /* Ask about the current channel */
+                        else if (argc == 6)
+                                channel = (uint8_t)strtol(argv[5], NULL, 0);
+                        else
+                        {
+                                print_user_usage();	
+                                return -1;
+                        }
+
+                        payload_number = (uint8_t)strtol(argv[4],
+                                                         NULL,
+                                                         0);
+                        if (payload_number == 0)
+                        {
+                                print_user_usage();	
+                                return -1;
+                        }
+
+			retval = ipmi_user_set_payload(intf,
+                                                       channel,
+                                                       (uint8_t)strtol(argv[2],
+                                                                       NULL,
+                                                                       0),
+                                                       operation,
+                                                       payload_number);
+		}
+                
 		else
 		{
 			print_user_usage();
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to