/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <libipmi.h>
#include <string.h>
#include "ipmi_impl.h"
typedef struct ipmi_user_impl {
/*
* Get User Access. See section 22.27.
*
* See libipmi.h for a complete description of IPMI reference material.
*/
typedef struct ipmi_get_user_access_req {
igua_channel :4,
__reserved1 :4);
igua_uid :2,
__reserved2 :6);
typedef struct ipmi_get_user_access {
igua_max_uid :4,
__reserved1 :4);
igua_enabled_uid :4);
__reserved2 :4,
igua_fixed_uid :4);
__reserved3 :1,
igua_privilege_level :4);
/*
* Get User Name. See section 22.29
*/
/*
* Set User Password. See section 22.30
*/
typedef struct ipmi_set_user_password {
isup_uid :6,
__reserved1 :1,
isup_len20 :1);
isup_op :2,
__reserved2 :6);
static ipmi_get_user_access_t *
{
/*
* If sessions aren't supported on the current channel, some
* service processors (notably Sun's ILOM) will return an
* invalid request completion code (0xCC). For these SPs, we
* translate this to the more appropriate EIPMI_INVALID_COMMAND.
*/
NULL);
return (NULL);
}
return (NULL);
}
}
static const char *
{
return (NULL);
return (NULL);
}
}
void
{
}
}
/*
* Returns user information in a well-defined structure.
*/
int
void *data)
{
const char *name;
/*
* Get the number of active users on the system by requesting the first
* user ID (1).
*/
/*
* Some versions of the Sun ILOM have a bug which prevent the
* GET USER ACCESS command from succeeding over the default
* channel. Also, some versions of ILOM will return a response,
* but the 4-byte reponse will be all zeroes, which we will also
* interpret as a failure. If this fails and we are on ILOM,
* then attempt to use the standard channel (1) instead.
*/
return (-1);
if (!ipmi_is_sun_ilom(devid))
return (-1);
channel = 1;
return (-1);
}
for (i = 1; i <= uid_max; i++) {
return (-1);
return (-1);
/*
* If we are requesting a username that doesn't have a
* supported username, we may get an INVALID REQUEST response.
* If this is the case, then continue as if there is no known
* username.
*/
continue;
else
return (-1);
}
if (*name == '\0')
continue;
return (-1);
}
return (-1);
}
return (0);
}
typedef struct ipmi_user_cb {
const char *uic_name;
static int
{
return (0);
}
return (0);
}
{
return (NULL);
"no such user");
return (cb.uic_result);
}
{
return (NULL);
"no such user");
return (cb.uic_result);
}
int
{
"password length must be less than 20 characters"));
if (req.isup_len20)
else
return (-1);
return (0);
}