mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
fix gcc4 compile warnings
This commit is contained in:
parent
a3d206523d
commit
c65b206144
@ -1,75 +1,75 @@
|
||||
|
||||
/*
|
||||
(C) Kontron
|
||||
*/
|
||||
|
||||
#ifndef _IPMI_PICMG_H_
|
||||
#define _IPMI_PICMG_H_
|
||||
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
/* PICMG commands */
|
||||
#define PICMG_GET_PICMG_PROPERTIES_CMD 0x00
|
||||
#define PICMG_GET_ADDRESS_INFO_CMD 0x01
|
||||
#define PICMG_GET_SHELF_ADDRESS_INFO_CMD 0x02
|
||||
#define PICMG_SET_SHELF_ADDRESS_INFO_CMD 0x03
|
||||
#define PICMG_FRU_CONTROL_CMD 0x04
|
||||
#define PICMG_GET_FRU_LED_PROPERTIES_CMD 0x05
|
||||
#define PICMG_GET_LED_COLOR_CAPABILITIES_CMD 0x06
|
||||
#define PICMG_SET_FRU_LED_STATE_CMD 0x07
|
||||
#define PICMG_GET_FRU_LED_STATE_CMD 0x08
|
||||
#define PICMG_SET_IPMB_CMD 0x09
|
||||
#define PICMG_SET_FRU_POLICY_CMD 0x0A
|
||||
#define PICMG_GET_FRU_POLICY_CMD 0x0B
|
||||
#define PICMG_FRU_ACTIVATION_CMD 0x0C
|
||||
#define PICMG_GET_DEVICE_LOCATOR_RECORD_CMD 0x0D
|
||||
#define PICMG_SET_PORT_STATE_CMD 0x0E
|
||||
#define PICMG_GET_PORT_STATE_CMD 0x0F
|
||||
#define PICMG_COMPUTE_POWER_PROPERTIES_CMD 0x10
|
||||
#define PICMG_SET_POWER_LEVEL_CMD 0x11
|
||||
#define PICMG_GET_POWER_LEVEL_CMD 0x12
|
||||
#define PICMG_RENEGOTIATE_POWER_CMD 0x13
|
||||
#define PICMG_GET_FAN_SPEED_PROPERTIES_CMD 0x14
|
||||
#define PICMG_SET_FAN_LEVEL_CMD 0x15
|
||||
#define PICMG_GET_FAN_LEVEL_CMD 0x16
|
||||
#define PICMG_BUSED_RESOURCE_CMD 0x17
|
||||
|
||||
/* Site Types */
|
||||
#define PICMG_ATCA_BOARD 0x00
|
||||
#define PICMG_POWER_ENTRY 0x01
|
||||
#define PICMG_SHELF_FRU 0x02
|
||||
#define PICMG_DEDICATED_SHMC 0x03
|
||||
#define PICMG_FAN_TRAY 0x04
|
||||
#define PICMG_FAN_FILTER_TRAY 0x05
|
||||
#define PICMG_ALARM 0x06
|
||||
#define PICMG_AMC 0x07
|
||||
#define PICMG_PMC 0x08
|
||||
#define PICMG_RTM 0x09
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
(C) Kontron
|
||||
*/
|
||||
|
||||
#ifndef _IPMI_PICMG_H_
|
||||
#define _IPMI_PICMG_H_
|
||||
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
/* PICMG commands */
|
||||
#define PICMG_GET_PICMG_PROPERTIES_CMD 0x00
|
||||
#define PICMG_GET_ADDRESS_INFO_CMD 0x01
|
||||
#define PICMG_GET_SHELF_ADDRESS_INFO_CMD 0x02
|
||||
#define PICMG_SET_SHELF_ADDRESS_INFO_CMD 0x03
|
||||
#define PICMG_FRU_CONTROL_CMD 0x04
|
||||
#define PICMG_GET_FRU_LED_PROPERTIES_CMD 0x05
|
||||
#define PICMG_GET_LED_COLOR_CAPABILITIES_CMD 0x06
|
||||
#define PICMG_SET_FRU_LED_STATE_CMD 0x07
|
||||
#define PICMG_GET_FRU_LED_STATE_CMD 0x08
|
||||
#define PICMG_SET_IPMB_CMD 0x09
|
||||
#define PICMG_SET_FRU_POLICY_CMD 0x0A
|
||||
#define PICMG_GET_FRU_POLICY_CMD 0x0B
|
||||
#define PICMG_FRU_ACTIVATION_CMD 0x0C
|
||||
#define PICMG_GET_DEVICE_LOCATOR_RECORD_CMD 0x0D
|
||||
#define PICMG_SET_PORT_STATE_CMD 0x0E
|
||||
#define PICMG_GET_PORT_STATE_CMD 0x0F
|
||||
#define PICMG_COMPUTE_POWER_PROPERTIES_CMD 0x10
|
||||
#define PICMG_SET_POWER_LEVEL_CMD 0x11
|
||||
#define PICMG_GET_POWER_LEVEL_CMD 0x12
|
||||
#define PICMG_RENEGOTIATE_POWER_CMD 0x13
|
||||
#define PICMG_GET_FAN_SPEED_PROPERTIES_CMD 0x14
|
||||
#define PICMG_SET_FAN_LEVEL_CMD 0x15
|
||||
#define PICMG_GET_FAN_LEVEL_CMD 0x16
|
||||
#define PICMG_BUSED_RESOURCE_CMD 0x17
|
||||
|
||||
/* Site Types */
|
||||
#define PICMG_ATCA_BOARD 0x00
|
||||
#define PICMG_POWER_ENTRY 0x01
|
||||
#define PICMG_SHELF_FRU 0x02
|
||||
#define PICMG_DEDICATED_SHMC 0x03
|
||||
#define PICMG_FAN_TRAY 0x04
|
||||
#define PICMG_FAN_FILTER_TRAY 0x05
|
||||
#define PICMG_ALARM 0x06
|
||||
#define PICMG_AMC 0x07
|
||||
#define PICMG_PMC 0x08
|
||||
#define PICMG_RTM 0x09
|
||||
|
||||
|
||||
|
||||
struct picmg_set_fru_activation_cmd {
|
||||
unsigned char picmg_id; /* always 0*/
|
||||
unsigned char fru_id; /* threshold setting mask */
|
||||
unsigned char fru_id; /* threshold setting mask */
|
||||
unsigned char fru_state; /* fru activation/deactivation */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* the LED color capabilities */
|
||||
static unsigned char* led_color_str[] = {
|
||||
"reserved",
|
||||
static const char* led_color_str[] = {
|
||||
"reserved",
|
||||
"BLUE",
|
||||
"RED",
|
||||
"GREEN",
|
||||
"AMBER",
|
||||
"ORANGE",
|
||||
"WHITE",
|
||||
"AMBER",
|
||||
"ORANGE",
|
||||
"WHITE",
|
||||
"reserved"
|
||||
};
|
||||
|
||||
|
||||
|
||||
int ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv);
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
int ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv);
|
||||
|
||||
#endif
|
||||
|
@ -545,6 +545,6 @@ uint16_t ipmi_sel_get_std_entry(struct ipmi_intf * intf, uint16_t id, struct sel
|
||||
char * get_newisys_evt_desc(struct ipmi_intf * intf, struct sel_event_record * rec);
|
||||
IPMI_OEM ipmi_get_oem(struct ipmi_intf * intf);
|
||||
char * ipmi_get_oem_desc(struct ipmi_intf * intf, struct sel_event_record * rec);
|
||||
int ipmi_sel_oem_init(char * filename);
|
||||
int ipmi_sel_oem_init(const char * filename);
|
||||
|
||||
#endif /* IPMI_SEL_H */
|
||||
|
@ -222,16 +222,16 @@ ipmi_get_channel_info(struct ipmi_intf * intf, uint8_t channel)
|
||||
|
||||
printf(" Session Support : ");
|
||||
switch (channel_info.session_support) {
|
||||
case 0x00:
|
||||
case 0x0:
|
||||
printf("session-less\n");
|
||||
break;
|
||||
case 0x40:
|
||||
case 0x1:
|
||||
printf("single-session\n");
|
||||
break;
|
||||
case 0x80:
|
||||
case 0x2:
|
||||
printf("multi-session\n");
|
||||
break;
|
||||
case 0xc0:
|
||||
case 0x3:
|
||||
default:
|
||||
printf("session-based\n");
|
||||
break;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -109,18 +109,18 @@ typedef struct sKFWUM_InFirmwareInfo {
|
||||
#define KFWUM_PAGE_SIZE 256
|
||||
|
||||
extern int verbose;
|
||||
static unsigned char fileName[512];
|
||||
static char fileName[512];
|
||||
static unsigned char firmBuf[1024 * 512];
|
||||
static unsigned char firmMaj;
|
||||
static unsigned char firmMinSub;
|
||||
|
||||
static void KfwumOutputHelp(void);
|
||||
static void KfwumMain(struct ipmi_intf *intf, tKFWUM_Task task);
|
||||
static tKFWUM_Status KfwumGetFileSize(unsigned char *pFileName,
|
||||
static tKFWUM_Status KfwumGetFileSize(char *pFileName,
|
||||
unsigned long *pFileSize);
|
||||
static tKFWUM_Status KfwumSetupBuffersFromFile(unsigned char *pFileName,
|
||||
static tKFWUM_Status KfwumSetupBuffersFromFile(char *pFileName,
|
||||
unsigned long fileSize);
|
||||
static void KfwumShowProgress(const unsigned char *task,
|
||||
static void KfwumShowProgress(const char *task,
|
||||
unsigned long current, unsigned long total);
|
||||
static unsigned short KfwumCalculateChecksumPadding(unsigned char *pBuffer,
|
||||
unsigned long totalSize);
|
||||
@ -353,7 +353,7 @@ KfwumMain(struct ipmi_intf *intf, tKFWUM_Task task)
|
||||
}
|
||||
|
||||
static tKFWUM_Status
|
||||
KfwumGetFileSize(unsigned char *pFileName, unsigned long *pFileSize)
|
||||
KfwumGetFileSize(char *pFileName, unsigned long *pFileSize)
|
||||
{
|
||||
tKFWUM_Status status = KFWUM_STATUS_ERROR;
|
||||
FILE *pFileHandle;
|
||||
@ -376,7 +376,7 @@ KfwumGetFileSize(unsigned char *pFileName, unsigned long *pFileSize)
|
||||
|
||||
#define MAX_BUFFER_SIZE 1024*16
|
||||
static tKFWUM_Status
|
||||
KfwumSetupBuffersFromFile(unsigned char *pFileName, unsigned long fileSize)
|
||||
KfwumSetupBuffersFromFile(char *pFileName, unsigned long fileSize)
|
||||
{
|
||||
tKFWUM_Status status = KFWUM_STATUS_OK;
|
||||
FILE *pFileHandle;
|
||||
@ -391,8 +391,9 @@ KfwumSetupBuffersFromFile(unsigned char *pFileName, unsigned long fileSize)
|
||||
rewind(pFileHandle);
|
||||
|
||||
for (qty = 0; qty < count; qty++) {
|
||||
KfwumShowProgress("Reading Firmware from File", qty,
|
||||
count);
|
||||
KfwumShowProgress("Reading Firmware from File",
|
||||
(unsigned long)qty,
|
||||
(unsigned long)count);
|
||||
if (fread
|
||||
(&firmBuf[qty * MAX_BUFFER_SIZE], 1,
|
||||
MAX_BUFFER_SIZE, pFileHandle)
|
||||
@ -417,7 +418,7 @@ KfwumSetupBuffersFromFile(unsigned char *pFileName, unsigned long fileSize)
|
||||
|
||||
#define PROG_LENGTH 42
|
||||
void
|
||||
KfwumShowProgress(const unsigned char *task, unsigned long current,
|
||||
KfwumShowProgress(const char *task, unsigned long current,
|
||||
unsigned long total)
|
||||
{
|
||||
static unsigned long staticProgress = 0xffffffff;
|
||||
|
@ -456,7 +456,7 @@ lan_set_arp_interval(struct ipmi_intf * intf,
|
||||
return -1;
|
||||
|
||||
if (ival != 0) {
|
||||
interval = ((uint8_t)atoi(ival) * 2) - 1;
|
||||
interval = ((uint8_t)atoi((const char *)ival) * 2) - 1;
|
||||
rc = set_lan_param(intf, chan, IPMI_LANP_GRAT_ARP, &interval, 1);
|
||||
} else {
|
||||
interval = lp->data[0];
|
||||
@ -897,7 +897,7 @@ ipmi_lan_set_password(struct ipmi_intf * intf,
|
||||
data[1] = 0x02; /* set password */
|
||||
|
||||
if (password != NULL)
|
||||
memcpy(data+2, password, __min(strlen(password), 16));
|
||||
memcpy(data+2, password, __min(strlen((const char *)password), 16));
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
@ -919,7 +919,7 @@ ipmi_lan_set_password(struct ipmi_intf * intf,
|
||||
/* adjust our session password
|
||||
* or we will no longer be able to communicate with BMC
|
||||
*/
|
||||
ipmi_intf_session_set_password(intf, password);
|
||||
ipmi_intf_session_set_password(intf, (char *)password);
|
||||
printf("Password %s for user %d\n",
|
||||
(password == NULL) ? "cleared" : "set", userid);
|
||||
|
||||
@ -1349,7 +1349,7 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
"example: lan set 7 arp gratuitous off\n");
|
||||
}
|
||||
else if (strncmp(argv[2], "interval", 8) == 0) {
|
||||
rc = lan_set_arp_interval(intf, chan, argv[3]);
|
||||
rc = lan_set_arp_interval(intf, chan, (uint8_t *)argv[3]);
|
||||
}
|
||||
else if (strncmp(argv[2], "generate", 8) == 0) {
|
||||
if (argc < 4)
|
||||
@ -1423,7 +1423,7 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
/* session password
|
||||
* not strictly a lan setting, but its used for lan connections */
|
||||
else if (strncmp(argv[1], "password", 8) == 0) {
|
||||
rc = ipmi_lan_set_password(intf, 1, argv[2]);
|
||||
rc = ipmi_lan_set_password(intf, 1, (uint8_t *)argv[2]);
|
||||
}
|
||||
/* snmp community string */
|
||||
else if (strncmp(argv[1], "snmp", 4) == 0) {
|
||||
|
@ -412,7 +412,7 @@ ipmi_mc_get_guid(struct ipmi_intf * intf)
|
||||
}
|
||||
|
||||
if (rsp->data_len == sizeof(struct ipmi_guid)) {
|
||||
uint8_t tbuf[40];
|
||||
char tbuf[40];
|
||||
time_t s;
|
||||
memset(tbuf, 0, 40);
|
||||
memset(&guid, 0, sizeof(struct ipmi_guid));
|
||||
|
@ -307,7 +307,7 @@ ipmi_pef_print_lan_dest(struct ipmi_intf * intf, uint8_t ch, uint8_t dest)
|
||||
"PET community");
|
||||
else {
|
||||
rsp->data[19] = '\0';
|
||||
ipmi_pef_print_str("PET Community", &rsp->data[1]);
|
||||
ipmi_pef_print_str("PET Community", (const char *)&rsp->data[1]);
|
||||
}
|
||||
}
|
||||
ipmi_pef_print_dec("ACK timeout/retry (secs)", timeout);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3191,39 +3191,39 @@ ipmi_sdr_find_sdr_byid(struct ipmi_intf *intf, char *id)
|
||||
for (e = sdr_list_head; e != NULL; e = e->next) {
|
||||
switch (e->type) {
|
||||
case SDR_RECORD_TYPE_FULL_SENSOR:
|
||||
if (!strncmp(e->record.full->id_string, id,
|
||||
__max(e->record.full->id_code & 0x1f,
|
||||
idlen)))
|
||||
if (!strncmp((const char *)e->record.full->id_string,
|
||||
(const char *)id,
|
||||
__max(e->record.full->id_code & 0x1f, idlen)))
|
||||
return e;
|
||||
break;
|
||||
case SDR_RECORD_TYPE_COMPACT_SENSOR:
|
||||
if (!strncmp(e->record.compact->id_string, id,
|
||||
__max(e->record.compact->id_code & 0x1f,
|
||||
idlen)))
|
||||
if (!strncmp((const char *)e->record.compact->id_string,
|
||||
(const char *)id,
|
||||
__max(e->record.compact->id_code & 0x1f, idlen)))
|
||||
return e;
|
||||
break;
|
||||
case SDR_RECORD_TYPE_EVENTONLY_SENSOR:
|
||||
if (!strncmp(e->record.eventonly->id_string, id,
|
||||
__max(e->record.eventonly->id_code & 0x1f,
|
||||
idlen)))
|
||||
if (!strncmp((const char *)e->record.eventonly->id_string,
|
||||
(const char *)id,
|
||||
__max(e->record.eventonly->id_code & 0x1f, idlen)))
|
||||
return e;
|
||||
break;
|
||||
case SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR:
|
||||
if (!strncmp(e->record.genloc->id_string, id,
|
||||
__max(e->record.genloc->id_code & 0x1f,
|
||||
idlen)))
|
||||
if (!strncmp((const char *)e->record.genloc->id_string,
|
||||
(const char *)id,
|
||||
__max(e->record.genloc->id_code & 0x1f, idlen)))
|
||||
return e;
|
||||
break;
|
||||
case SDR_RECORD_TYPE_FRU_DEVICE_LOCATOR:
|
||||
if (!strncmp(e->record.fruloc->id_string, id,
|
||||
__max(e->record.fruloc->id_code & 0x1f,
|
||||
idlen)))
|
||||
if (!strncmp((const char *)e->record.fruloc->id_string,
|
||||
(const char *)id,
|
||||
__max(e->record.fruloc->id_code & 0x1f, idlen)))
|
||||
return e;
|
||||
break;
|
||||
case SDR_RECORD_TYPE_MC_DEVICE_LOCATOR:
|
||||
if (!strncmp(e->record.mcloc->id_string, id,
|
||||
__max(e->record.mcloc->id_code & 0x1f,
|
||||
idlen)))
|
||||
if (!strncmp((const char *)e->record.mcloc->id_string,
|
||||
(const char *)id,
|
||||
__max(e->record.mcloc->id_code & 0x1f, idlen)))
|
||||
return e;
|
||||
break;
|
||||
}
|
||||
@ -3251,51 +3251,57 @@ ipmi_sdr_find_sdr_byid(struct ipmi_intf *intf, char *id)
|
||||
case SDR_RECORD_TYPE_FULL_SENSOR:
|
||||
sdrr->record.full =
|
||||
(struct sdr_record_full_sensor *) rec;
|
||||
if (!strncmp
|
||||
(sdrr->record.full->id_string, id,
|
||||
__max(sdrr->record.full->id_code & 0x1f, idlen)))
|
||||
if (!strncmp(
|
||||
(const char *)sdrr->record.full->id_string,
|
||||
(const char *)id,
|
||||
__max(sdrr->record.full->id_code & 0x1f, idlen)))
|
||||
found = 1;
|
||||
break;
|
||||
case SDR_RECORD_TYPE_COMPACT_SENSOR:
|
||||
sdrr->record.compact =
|
||||
(struct sdr_record_compact_sensor *) rec;
|
||||
if (!strncmp
|
||||
(sdrr->record.compact->id_string, id,
|
||||
__max(sdrr->record.compact->id_code & 0x1f,
|
||||
if (!strncmp(
|
||||
(const char *)sdrr->record.compact->id_string,
|
||||
(const char *)id,
|
||||
__max(sdrr->record.compact->id_code & 0x1f,
|
||||
idlen)))
|
||||
found = 1;
|
||||
break;
|
||||
case SDR_RECORD_TYPE_EVENTONLY_SENSOR:
|
||||
sdrr->record.eventonly =
|
||||
(struct sdr_record_eventonly_sensor *) rec;
|
||||
if (!strncmp
|
||||
(sdrr->record.eventonly->id_string, id,
|
||||
__max(sdrr->record.eventonly->id_code & 0x1f,
|
||||
if (!strncmp(
|
||||
(const char *)sdrr->record.eventonly->id_string,
|
||||
(const char *)id,
|
||||
__max(sdrr->record.eventonly->id_code & 0x1f,
|
||||
idlen)))
|
||||
found = 1;
|
||||
break;
|
||||
case SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR:
|
||||
sdrr->record.genloc =
|
||||
(struct sdr_record_generic_locator *) rec;
|
||||
if (!strncmp
|
||||
(sdrr->record.genloc->id_string, id,
|
||||
__max(sdrr->record.genloc->id_code & 0x1f, idlen)))
|
||||
if (!strncmp(
|
||||
(const char *)sdrr->record.genloc->id_string,
|
||||
(const char *)id,
|
||||
__max(sdrr->record.genloc->id_code & 0x1f, idlen)))
|
||||
found = 1;
|
||||
break;
|
||||
case SDR_RECORD_TYPE_FRU_DEVICE_LOCATOR:
|
||||
sdrr->record.fruloc =
|
||||
(struct sdr_record_fru_locator *) rec;
|
||||
if (!strncmp
|
||||
(sdrr->record.fruloc->id_string, id,
|
||||
__max(sdrr->record.fruloc->id_code & 0x1f, idlen)))
|
||||
if (!strncmp(
|
||||
(const char *)sdrr->record.fruloc->id_string,
|
||||
(const char *)id,
|
||||
__max(sdrr->record.fruloc->id_code & 0x1f, idlen)))
|
||||
found = 1;
|
||||
break;
|
||||
case SDR_RECORD_TYPE_MC_DEVICE_LOCATOR:
|
||||
sdrr->record.mcloc =
|
||||
(struct sdr_record_mc_locator *) rec;
|
||||
if (!strncmp
|
||||
(sdrr->record.mcloc->id_string, id,
|
||||
__max(sdrr->record.mcloc->id_code & 0x1f, idlen)))
|
||||
if (!strncmp(
|
||||
(const char *)sdrr->record.mcloc->id_string,
|
||||
(const char *)id,
|
||||
__max(sdrr->record.mcloc->id_code & 0x1f, idlen)))
|
||||
found = 1;
|
||||
break;
|
||||
case SDR_RECORD_TYPE_ENTITY_ASSOC:
|
||||
|
@ -98,7 +98,7 @@ static int ipmi_sel_oem_match(uint8_t *evt, struct ipmi_sel_oem_msg_rec rec)
|
||||
}
|
||||
}
|
||||
|
||||
void ipmi_sel_oem_init(const char * filename)
|
||||
int ipmi_sel_oem_init(const char * filename)
|
||||
{
|
||||
FILE * fp;
|
||||
int i, j, k, n, byte;
|
||||
@ -215,7 +215,7 @@ ipmi_get_event_type(uint8_t code)
|
||||
static char *
|
||||
ipmi_sel_timestamp(uint32_t stamp)
|
||||
{
|
||||
static uint8_t tbuf[40];
|
||||
static char tbuf[40];
|
||||
time_t s = (time_t)stamp;
|
||||
memset(tbuf, 0, 40);
|
||||
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", localtime(&s));
|
||||
@ -225,7 +225,7 @@ ipmi_sel_timestamp(uint32_t stamp)
|
||||
static char *
|
||||
ipmi_sel_timestamp_date(uint32_t stamp)
|
||||
{
|
||||
static uint8_t tbuf[11];
|
||||
static char tbuf[11];
|
||||
time_t s = (time_t)stamp;
|
||||
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y", localtime(&s));
|
||||
return tbuf;
|
||||
@ -234,7 +234,7 @@ ipmi_sel_timestamp_date(uint32_t stamp)
|
||||
static char *
|
||||
ipmi_sel_timestamp_time(uint32_t stamp)
|
||||
{
|
||||
static uint8_t tbuf[9];
|
||||
static char tbuf[9];
|
||||
time_t s = (time_t)stamp;
|
||||
strftime(tbuf, sizeof(tbuf), "%H:%M:%S", localtime(&s));
|
||||
return tbuf;
|
||||
@ -244,7 +244,7 @@ static char *
|
||||
hex2ascii (uint8_t * hexChars, uint8_t numBytes)
|
||||
{
|
||||
int count;
|
||||
static uint8_t hexString[SEL_OEM_NOTS_DATA_LEN+1]; /*Max Size*/
|
||||
static char hexString[SEL_OEM_NOTS_DATA_LEN+1]; /*Max Size*/
|
||||
|
||||
if(numBytes > SEL_OEM_NOTS_DATA_LEN)
|
||||
numBytes = SEL_OEM_NOTS_DATA_LEN;
|
||||
@ -1470,7 +1470,7 @@ ipmi_sel_get_time(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
static uint8_t tbuf[40];
|
||||
static char tbuf[40];
|
||||
uint32_t timei;
|
||||
time_t time;
|
||||
|
||||
|
@ -1366,7 +1366,7 @@ ipmi_sol_red_pill(struct ipmi_intf * intf)
|
||||
|
||||
if (numRead > 0)
|
||||
{
|
||||
int rc = processSolUserInput(intf, buffer, numRead);
|
||||
int rc = processSolUserInput(intf, (uint8_t *)buffer, numRead);
|
||||
|
||||
if (rc)
|
||||
{
|
||||
|
@ -326,7 +326,7 @@ ipmi_user_set_username(
|
||||
/* The channel number will remain constant throughout this function */
|
||||
msg_data[0] = user_id;
|
||||
memset(msg_data + 1, 0, 16);
|
||||
strcpy(msg_data + 1, name);
|
||||
strcpy((char *)(msg_data + 1), name);
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
|
||||
@ -404,11 +404,11 @@ ipmi_user_set_password(
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
char * msg_data;
|
||||
uint8_t * msg_data;
|
||||
|
||||
int password_length = (is_twenty_byte_password? 20 : 16);
|
||||
|
||||
msg_data = (char*)malloc(password_length + 2);
|
||||
msg_data = (uint8_t*)malloc(password_length + 2);
|
||||
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
@ -429,7 +429,7 @@ ipmi_user_set_password(
|
||||
memset(msg_data + 2, 0, password_length);
|
||||
|
||||
if (password != NULL)
|
||||
strncpy(msg_data + 2, password, password_length);
|
||||
strncpy((char *)(msg_data + 2), password, password_length);
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
|
||||
|
@ -176,7 +176,7 @@ uint8_t * ipmi_auth_special(struct ipmi_session * s)
|
||||
memset(&ctx, 0, sizeof(MD5_CTX));
|
||||
|
||||
MD5_Init(&ctx);
|
||||
MD5_Update(&ctx, (const uint8_t *)s->authcode, strlen(s->authcode));
|
||||
MD5_Update(&ctx, (const uint8_t *)s->authcode, strlen((const char *)s->authcode));
|
||||
MD5_Final(md, &ctx);
|
||||
|
||||
for (i=0; i<16; i++)
|
||||
|
@ -1378,7 +1378,7 @@ int ipmi_lan_open(struct ipmi_intf * intf)
|
||||
if (s->retry == 0)
|
||||
s->retry = IPMI_LAN_RETRY;
|
||||
|
||||
if (s->hostname == NULL || strlen(s->hostname) == 0) {
|
||||
if (s->hostname == NULL || strlen((const char *)s->hostname) == 0) {
|
||||
lprintf(LOG_ERR, "No hostname specified!");
|
||||
return -1;
|
||||
}
|
||||
@ -1390,9 +1390,9 @@ int ipmi_lan_open(struct ipmi_intf * intf)
|
||||
s->addr.sin_family = AF_INET;
|
||||
s->addr.sin_port = htons(s->port);
|
||||
|
||||
rc = inet_pton(AF_INET, s->hostname, &s->addr.sin_addr);
|
||||
rc = inet_pton(AF_INET, (const char *)s->hostname, &s->addr.sin_addr);
|
||||
if (rc <= 0) {
|
||||
struct hostent *host = gethostbyname(s->hostname);
|
||||
struct hostent *host = gethostbyname((const char *)s->hostname);
|
||||
if (host == NULL) {
|
||||
lprintf(LOG_ERR, "Address lookup for %s failed",
|
||||
s->hostname);
|
||||
|
@ -2876,7 +2876,7 @@ ipmi_lanplus_rakp1(struct ipmi_intf * intf)
|
||||
|
||||
|
||||
/* Username specification */
|
||||
msg[27] = strlen(session->username);
|
||||
msg[27] = strlen((const char *)session->username);
|
||||
if (msg[27] > IPMI_MAX_USER_NAME_LENGTH)
|
||||
{
|
||||
lprintf(LOG_ERR, "ERROR: user name too long. "
|
||||
@ -3204,7 +3204,7 @@ ipmi_lanplus_open(struct ipmi_intf * intf)
|
||||
if (!session->retry)
|
||||
session->retry = IPMI_LAN_RETRY;
|
||||
|
||||
if (session->hostname == NULL || strlen(session->hostname) == 0) {
|
||||
if (session->hostname == NULL || strlen((const char *)session->hostname) == 0) {
|
||||
lprintf(LOG_ERR, "No hostname specified!");
|
||||
return -1;
|
||||
}
|
||||
@ -3232,9 +3232,9 @@ ipmi_lanplus_open(struct ipmi_intf * intf)
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(session->port);
|
||||
|
||||
rc = inet_pton(AF_INET, session->hostname, &addr.sin_addr);
|
||||
rc = inet_pton(AF_INET, (const char *)session->hostname, &addr.sin_addr);
|
||||
if (rc <= 0) {
|
||||
struct hostent *host = gethostbyname(session->hostname);
|
||||
struct hostent *host = gethostbyname((const char *)session->hostname);
|
||||
if (host == NULL) {
|
||||
lprintf(LOG_ERR, "Address lookup for %s failed",
|
||||
session->hostname);
|
||||
@ -3400,22 +3400,22 @@ void test_crypt2(void)
|
||||
uint8_t iv[] =
|
||||
{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
|
||||
0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14};
|
||||
uint8_t * data = "12345678";
|
||||
uint8_t data[8] = "12345678";
|
||||
|
||||
char encrypt_buffer[1000];
|
||||
char decrypt_buffer[1000];
|
||||
uint8_t encrypt_buffer[1000];
|
||||
uint8_t decrypt_buffer[1000];
|
||||
uint32_t bytes_encrypted;
|
||||
uint32_t bytes_decrypted;
|
||||
|
||||
printbuf(data, strlen(data), "input data");
|
||||
printbuf((const uint8_t *)data, strlen((const char *)data), "input data");
|
||||
|
||||
lanplus_encrypt_aes_cbc_128(iv,
|
||||
key,
|
||||
data,
|
||||
strlen(data),
|
||||
strlen((const char *)data),
|
||||
encrypt_buffer,
|
||||
&bytes_encrypted);
|
||||
printbuf(encrypt_buffer, bytes_encrypted, "encrypt_buffer");
|
||||
printbuf((const uint8_t *)encrypt_buffer, bytes_encrypted, "encrypt_buffer");
|
||||
|
||||
lanplus_decrypt_aes_cbc_128(iv,
|
||||
key,
|
||||
@ -3423,7 +3423,7 @@ void test_crypt2(void)
|
||||
bytes_encrypted,
|
||||
decrypt_buffer,
|
||||
&bytes_decrypted);
|
||||
printbuf(decrypt_buffer, bytes_decrypted, "decrypt_buffer");
|
||||
printbuf((const uint8_t *)decrypt_buffer, bytes_decrypted, "decrypt_buffer");
|
||||
|
||||
lprintf(LOG_INFO, "\nDone testing the encrypt/decyrpt methods!\n");
|
||||
exit(0);
|
||||
|
@ -70,7 +70,7 @@ int lanplus_rakp2_hmac_matches(const struct ipmi_session * session,
|
||||
const uint8_t * bmc_mac,
|
||||
struct ipmi_intf * intf)
|
||||
{
|
||||
char * buffer;
|
||||
uint8_t * buffer;
|
||||
int bufferLength, i;
|
||||
uint8_t mac[20];
|
||||
uint32_t macLength;
|
||||
@ -93,7 +93,7 @@ int lanplus_rakp2_hmac_matches(const struct ipmi_session * session,
|
||||
16 + /* GUIDc */
|
||||
1 + /* ROLEm */
|
||||
1 + /* ULENGTHm */
|
||||
strlen(session->username); /* optional */
|
||||
strlen((const char *)session->username); /* optional */
|
||||
|
||||
buffer = malloc(bufferLength);
|
||||
if (buffer == NULL) {
|
||||
@ -152,7 +152,7 @@ int lanplus_rakp2_hmac_matches(const struct ipmi_session * session,
|
||||
buffer[56] = session->v2_data.requested_role;
|
||||
|
||||
/* ULENGTHm */
|
||||
buffer[57] = strlen(session->username);
|
||||
buffer[57] = strlen((const char *)session->username);
|
||||
|
||||
/* UserName [optional] */
|
||||
for (i = 0; i < buffer[57]; ++i)
|
||||
@ -160,8 +160,8 @@ int lanplus_rakp2_hmac_matches(const struct ipmi_session * session,
|
||||
|
||||
if (verbose > 2)
|
||||
{
|
||||
printbuf(buffer, bufferLength, ">> rakp2 mac input buffer");
|
||||
printbuf((char*)(session->authcode), IPMI_AUTHCODE_BUFFER_SIZE, ">> rakp2 mac key");
|
||||
printbuf((const uint8_t *)buffer, bufferLength, ">> rakp2 mac input buffer");
|
||||
printbuf((const uint8_t *)session->authcode, IPMI_AUTHCODE_BUFFER_SIZE, ">> rakp2 mac key");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -214,12 +214,11 @@ int lanplus_rakp4_hmac_matches(const struct ipmi_session * session,
|
||||
const uint8_t * bmc_mac,
|
||||
struct ipmi_intf * intf)
|
||||
{
|
||||
char * buffer;
|
||||
uint8_t * buffer;
|
||||
int bufferLength, i;
|
||||
uint8_t mac[20];
|
||||
uint32_t macLength;
|
||||
|
||||
uint32_t SIDc_lsbf;
|
||||
uint32_t SIDc_lsbf;
|
||||
|
||||
if (ipmi_oem_active(intf, "intelplus")){
|
||||
/* Intel BMC responds with the integrity Algorithm in RAKP4 */
|
||||
@ -242,7 +241,7 @@ int lanplus_rakp4_hmac_matches(const struct ipmi_session * session,
|
||||
4 + /* SIDc */
|
||||
16; /* GUIDc */
|
||||
|
||||
buffer = (char*)malloc(bufferLength);
|
||||
buffer = (uint8_t *)malloc(bufferLength);
|
||||
if (buffer == NULL) {
|
||||
lprintf(LOG_ERR, "ipmitool: malloc failure");
|
||||
return 1;
|
||||
@ -281,11 +280,11 @@ int lanplus_rakp4_hmac_matches(const struct ipmi_session * session,
|
||||
#endif
|
||||
|
||||
|
||||
if (verbose > 2)
|
||||
{
|
||||
printbuf(buffer, bufferLength, ">> rakp4 mac input buffer");
|
||||
printbuf(session->v2_data.sik, 20l, ">> rakp4 mac key (sik)");
|
||||
}
|
||||
if (verbose > 2)
|
||||
{
|
||||
printbuf((const uint8_t *)buffer, bufferLength, ">> rakp4 mac input buffer");
|
||||
printbuf(session->v2_data.sik, 20l, ">> rakp4 mac key (sik)");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -301,7 +300,7 @@ int lanplus_rakp4_hmac_matches(const struct ipmi_session * session,
|
||||
mac,
|
||||
&macLength);
|
||||
|
||||
if (verbose > 2)
|
||||
if (verbose > 2)
|
||||
{
|
||||
printbuf(bmc_mac, macLength, ">> rakp4 mac as computed by the BMC");
|
||||
printbuf(mac, macLength, ">> rakp4 mac as computed by the remote console");
|
||||
@ -339,14 +338,14 @@ int lanplus_rakp4_hmac_matches(const struct ipmi_session * session,
|
||||
* returns 0 on success
|
||||
* 1 on failure
|
||||
*/
|
||||
int lanplus_generate_rakp3_authcode(char * output_buffer,
|
||||
int lanplus_generate_rakp3_authcode(uint8_t * output_buffer,
|
||||
const struct ipmi_session * session,
|
||||
uint32_t * mac_length,
|
||||
struct ipmi_intf * intf)
|
||||
{
|
||||
int ret = 0;
|
||||
int input_buffer_length, i;
|
||||
char * input_buffer;
|
||||
uint8_t * input_buffer;
|
||||
uint32_t SIDm_lsbf;
|
||||
|
||||
|
||||
@ -364,7 +363,7 @@ int lanplus_generate_rakp3_authcode(char * output_buffer,
|
||||
4 + /* SIDm */
|
||||
1 + /* ROLEm */
|
||||
1 + /* ULENGTHm */
|
||||
strlen(session->username);
|
||||
strlen((const char *)session->username);
|
||||
|
||||
input_buffer = malloc(input_buffer_length);
|
||||
if (input_buffer == NULL) {
|
||||
@ -400,17 +399,17 @@ int lanplus_generate_rakp3_authcode(char * output_buffer,
|
||||
input_buffer[20] = session->v2_data.requested_role;
|
||||
|
||||
/* ULENGTHm */
|
||||
input_buffer[21] = strlen(session->username);
|
||||
input_buffer[21] = strlen((const char *)session->username);
|
||||
|
||||
/* USERNAME */
|
||||
for (i = 0; i < input_buffer[21]; ++i)
|
||||
input_buffer[22 + i] = session->username[i];
|
||||
|
||||
if (verbose > 2)
|
||||
{
|
||||
printbuf(input_buffer, input_buffer_length, ">> rakp3 mac input buffer");
|
||||
printbuf((char*)(session->authcode), IPMI_AUTHCODE_BUFFER_SIZE, ">> rakp3 mac key");
|
||||
}
|
||||
if (verbose > 2)
|
||||
{
|
||||
printbuf((const uint8_t *)input_buffer, input_buffer_length, ">> rakp3 mac input buffer");
|
||||
printbuf((const uint8_t *)session->authcode, IPMI_AUTHCODE_BUFFER_SIZE, ">> rakp3 mac key");
|
||||
}
|
||||
|
||||
lanplus_HMAC(session->v2_data.auth_alg,
|
||||
session->authcode,
|
||||
@ -420,8 +419,8 @@ int lanplus_generate_rakp3_authcode(char * output_buffer,
|
||||
output_buffer,
|
||||
mac_length);
|
||||
|
||||
if (verbose > 2)
|
||||
printbuf(output_buffer, *mac_length, "generated rakp3 mac");
|
||||
if (verbose > 2)
|
||||
printbuf((const uint8_t *)output_buffer, *mac_length, "generated rakp3 mac");
|
||||
|
||||
|
||||
free(input_buffer);
|
||||
@ -459,9 +458,9 @@ int lanplus_generate_rakp3_authcode(char * output_buffer,
|
||||
*/
|
||||
int lanplus_generate_sik(struct ipmi_session * session)
|
||||
{
|
||||
char * input_buffer;
|
||||
uint8_t * input_buffer;
|
||||
int input_buffer_length, i;
|
||||
char * input_key;
|
||||
uint8_t * input_key;
|
||||
uint32_t mac_length;
|
||||
|
||||
|
||||
@ -478,7 +477,7 @@ int lanplus_generate_sik(struct ipmi_session * session)
|
||||
16 + /* Rc */
|
||||
1 + /* ROLEm */
|
||||
1 + /* ULENGTHm */
|
||||
strlen(session->username);
|
||||
strlen((const char *)session->username);
|
||||
|
||||
input_buffer = malloc(input_buffer_length);
|
||||
if (input_buffer == NULL) {
|
||||
@ -514,7 +513,7 @@ int lanplus_generate_sik(struct ipmi_session * session)
|
||||
input_buffer[32] = session->v2_data.requested_role;
|
||||
|
||||
/* ULENGTHm */
|
||||
input_buffer[33] = strlen(session->username);
|
||||
input_buffer[33] = strlen((const char *)session->username);
|
||||
|
||||
/* USERNAME */
|
||||
for (i = 0; i < input_buffer[33]; ++i)
|
||||
@ -538,7 +537,7 @@ int lanplus_generate_sik(struct ipmi_session * session)
|
||||
|
||||
|
||||
if (verbose >= 2)
|
||||
printbuf(input_buffer, input_buffer_length, "session integrity key input");
|
||||
printbuf((const uint8_t *)input_buffer, input_buffer_length, "session integrity key input");
|
||||
|
||||
lanplus_HMAC(session->v2_data.auth_alg,
|
||||
input_key,
|
||||
|
@ -47,7 +47,7 @@ int lanplus_rakp2_hmac_matches(const struct ipmi_session * session,
|
||||
int lanplus_rakp4_hmac_matches(const struct ipmi_session * session,
|
||||
const uint8_t * hmac,
|
||||
struct ipmi_intf * intf);
|
||||
int lanplus_generate_rakp3_authcode(char * buffer,
|
||||
int lanplus_generate_rakp3_authcode(uint8_t * buffer,
|
||||
const struct ipmi_session * session,
|
||||
uint32_t * auth_length,
|
||||
struct ipmi_intf * intf);
|
||||
|
@ -183,7 +183,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
|
||||
assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0);
|
||||
|
||||
|
||||
if(!EVP_EncryptUpdate(&ctx, output, (unsigned int *)bytes_written, input, input_length))
|
||||
if(!EVP_EncryptUpdate(&ctx, output, (int *)bytes_written, input, input_length))
|
||||
{
|
||||
/* Error */
|
||||
*bytes_written = 0;
|
||||
@ -193,7 +193,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
|
||||
{
|
||||
uint32_t tmplen;
|
||||
|
||||
if(!EVP_EncryptFinal_ex(&ctx, output + *bytes_written, (unsigned int *)&tmplen))
|
||||
if(!EVP_EncryptFinal_ex(&ctx, output + *bytes_written, (int *)&tmplen))
|
||||
{
|
||||
*bytes_written = 0;
|
||||
return; /* Error */
|
||||
@ -259,7 +259,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
|
||||
assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0);
|
||||
|
||||
|
||||
if (!EVP_DecryptUpdate(&ctx, output, (unsigned int *)bytes_written, input, input_length))
|
||||
if (!EVP_DecryptUpdate(&ctx, output, (int *)bytes_written, input, input_length))
|
||||
{
|
||||
/* Error */
|
||||
fprintf(stderr, "ERROR: decrypt update failed");
|
||||
@ -270,7 +270,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
|
||||
{
|
||||
uint32_t tmplen;
|
||||
|
||||
if (!EVP_DecryptFinal_ex(&ctx, output + *bytes_written, (unsigned int *)&tmplen))
|
||||
if (!EVP_DecryptFinal_ex(&ctx, output + *bytes_written, (int *)&tmplen))
|
||||
{
|
||||
char buffer[1000];
|
||||
ERR_error_string(ERR_get_error(), buffer);
|
||||
|
@ -105,28 +105,25 @@ ipmi_openipmi_open(struct ipmi_intf * intf)
|
||||
|
||||
#ifdef INCLUDE_PICMG_GET_DEVICE_LOCATOR
|
||||
/* PICMG hack to set right IPMB address,
|
||||
we might want to do GetPICMGProperties first.
|
||||
|
||||
In any case, on a server board or a non-picmg IpmC blade , this code
|
||||
will not have any adverse side effect
|
||||
*/
|
||||
if ( (intf->my_addr == IPMI_BMC_SLAVE_ADDR) ) {
|
||||
* we might want to do GetPICMGProperties first.
|
||||
* In any case, on a server board or a non-picmg IpmC blade , this code
|
||||
* will not have any adverse side effect
|
||||
*/
|
||||
if (intf->my_addr == IPMI_BMC_SLAVE_ADDR) {
|
||||
lprintf(LOG_DEBUG, "Running PICMG GetDeviceLocator" );
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_PICMG;
|
||||
req.msg.cmd = 0x01;
|
||||
msg_data = 0x00;
|
||||
msg_data = 0x00;
|
||||
req.msg.data = &msg_data;
|
||||
req.msg.data_len = 1;
|
||||
msg_data = 0;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (rsp) {
|
||||
if ( !rsp->ccode ) {
|
||||
intf->my_addr = rsp->data[2];
|
||||
intf->target_addr = intf->my_addr;
|
||||
lprintf(LOG_DEBUG, "Discovered IPMB address = 0x%x", intf->my_addr);
|
||||
}
|
||||
if (rsp && !rsp->ccode) {
|
||||
intf->my_addr = rsp->data[2];
|
||||
intf->target_addr = intf->my_addr;
|
||||
lprintf(LOG_DEBUG, "Discovered IPMB address = 0x%x", intf->my_addr);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -183,7 +180,7 @@ ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
intf->target_addr != intf->my_addr) {
|
||||
/* use IPMB address if needed */
|
||||
ipmb_addr.slave_addr = intf->target_addr;
|
||||
_req.addr = (char *) &ipmb_addr;
|
||||
_req.addr = (unsigned char *) &ipmb_addr;
|
||||
_req.addr_len = sizeof(ipmb_addr);
|
||||
lprintf(LOG_DEBUG, "Sending request to "
|
||||
"IPMB target @ 0x%x", intf->target_addr);
|
||||
@ -191,8 +188,8 @@ ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
/* otherwise use system interface */
|
||||
lprintf(LOG_DEBUG+2, "Sending request to "
|
||||
"System Interface");
|
||||
bmc_addr.lun = req->msg.lun;
|
||||
_req.addr = (char *) &bmc_addr;
|
||||
bmc_addr.lun = req->msg.lun;
|
||||
_req.addr = (unsigned char *) &bmc_addr;
|
||||
_req.addr_len = sizeof(bmc_addr);
|
||||
}
|
||||
|
||||
@ -226,7 +223,7 @@ ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
recv.addr = (char *) &addr;
|
||||
recv.addr = (unsigned char *) &addr;
|
||||
recv.addr_len = sizeof(addr);
|
||||
recv.msg.data = rsp.data;
|
||||
recv.msg.data_len = sizeof(rsp.data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user