mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
ID: 3522731 - 'lib/ipmi_sol.c' - ipmi_get_sol_info() returns always 0
PROPER - Commit fixes ipmi_get_sol_info()'s return value, so (-1) is returned on error, eg. response is NULL. It doesn't matter whether it is first or last response, we bail out immediately. Commit also fixes missing argument to one lprintf() and indentation(spaces->tabs). This bug is connected with ``ID: 1835038 - 'lib/ipmi_sol.c' - ipmi_get_sol_info() returns always 0''. Reported by: Duncan Idaho
This commit is contained in:
parent
a974ab2c69
commit
122e11a2e8
@ -208,7 +208,6 @@ ipmi_get_sol_info(
|
|||||||
req.msg.data_len = 4;
|
req.msg.data_len = 4;
|
||||||
req.msg.data = data;
|
req.msg.data = data;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* set in progress
|
* set in progress
|
||||||
*/
|
*/
|
||||||
@ -219,8 +218,12 @@ ipmi_get_sol_info(
|
|||||||
data[3] = 0x00; /* block selector */
|
data[3] = 0x00; /* block selector */
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
|
if (rsp == NULL) {
|
||||||
|
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
||||||
|
val2str(data[1], sol_parameter_vals));
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
if (NULL != rsp) {
|
|
||||||
switch (rsp->ccode) {
|
switch (rsp->ccode) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
if (rsp->data_len == 2) {
|
if (rsp->data_len == 2) {
|
||||||
@ -240,11 +243,7 @@ ipmi_get_sol_info(
|
|||||||
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
||||||
val2str(data[1], sol_parameter_vals),
|
val2str(data[1], sol_parameter_vals),
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
|
||||||
val2str(data[1], sol_parameter_vals));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -257,8 +256,12 @@ ipmi_get_sol_info(
|
|||||||
data[3] = 0x00; /* block selector */
|
data[3] = 0x00; /* block selector */
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
|
if (rsp == NULL) {
|
||||||
|
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
||||||
|
val2str(data[1], sol_parameter_vals));
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
if (NULL != rsp) {
|
|
||||||
switch (rsp->ccode) {
|
switch (rsp->ccode) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
if (rsp->data_len == 2) {
|
if (rsp->data_len == 2) {
|
||||||
@ -278,11 +281,7 @@ ipmi_get_sol_info(
|
|||||||
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
||||||
val2str(data[1], sol_parameter_vals),
|
val2str(data[1], sol_parameter_vals),
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
|
||||||
val2str(data[1], sol_parameter_vals));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -295,7 +294,12 @@ ipmi_get_sol_info(
|
|||||||
data[3] = 0x00; /* block selector */
|
data[3] = 0x00; /* block selector */
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (NULL != rsp) {
|
if (rsp == NULL) {
|
||||||
|
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
||||||
|
val2str(data[1], sol_parameter_vals));
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
switch (rsp->ccode) {
|
switch (rsp->ccode) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
if (rsp->data_len == 2) {
|
if (rsp->data_len == 2) {
|
||||||
@ -317,11 +321,7 @@ ipmi_get_sol_info(
|
|||||||
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
||||||
val2str(data[1], sol_parameter_vals),
|
val2str(data[1], sol_parameter_vals),
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
|
||||||
val2str(data[1], sol_parameter_vals));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -334,7 +334,12 @@ ipmi_get_sol_info(
|
|||||||
data[3] = 0x00; /* block selector */
|
data[3] = 0x00; /* block selector */
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (NULL != rsp) {
|
if (rsp == NULL) {
|
||||||
|
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
||||||
|
val2str(data[1], sol_parameter_vals));
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
switch (rsp->ccode) {
|
switch (rsp->ccode) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
if (rsp->data_len == 3) {
|
if (rsp->data_len == 3) {
|
||||||
@ -355,11 +360,7 @@ ipmi_get_sol_info(
|
|||||||
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
||||||
val2str(data[1], sol_parameter_vals),
|
val2str(data[1], sol_parameter_vals),
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
|
||||||
val2str(data[1], sol_parameter_vals));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -372,7 +373,12 @@ ipmi_get_sol_info(
|
|||||||
data[3] = 0x00; /* block selector */
|
data[3] = 0x00; /* block selector */
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (NULL != rsp) {
|
if (rsp == NULL) {
|
||||||
|
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
||||||
|
val2str(data[1], sol_parameter_vals));
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
switch (rsp->ccode) {
|
switch (rsp->ccode) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
if (rsp->data_len == 3) {
|
if (rsp->data_len == 3) {
|
||||||
@ -393,11 +399,7 @@ ipmi_get_sol_info(
|
|||||||
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
||||||
val2str(data[1], sol_parameter_vals),
|
val2str(data[1], sol_parameter_vals),
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
|
||||||
val2str(data[1], sol_parameter_vals));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -410,7 +412,12 @@ ipmi_get_sol_info(
|
|||||||
data[3] = 0x00; /* block selector */
|
data[3] = 0x00; /* block selector */
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (NULL != rsp) {
|
if (rsp == NULL) {
|
||||||
|
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
||||||
|
val2str(data[1], sol_parameter_vals));
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
switch (rsp->ccode) {
|
switch (rsp->ccode) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
if (rsp->data_len == 2) {
|
if (rsp->data_len == 2) {
|
||||||
@ -430,11 +437,7 @@ ipmi_get_sol_info(
|
|||||||
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
||||||
val2str(data[1], sol_parameter_vals),
|
val2str(data[1], sol_parameter_vals),
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
|
||||||
val2str(data[1], sol_parameter_vals));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -447,7 +450,12 @@ ipmi_get_sol_info(
|
|||||||
data[3] = 0x00; /* block selector */
|
data[3] = 0x00; /* block selector */
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (NULL != rsp) {
|
if (rsp == NULL) {
|
||||||
|
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
||||||
|
val2str(data[1], sol_parameter_vals));
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
switch (rsp->ccode) {
|
switch (rsp->ccode) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
if (rsp->data_len == 2) {
|
if (rsp->data_len == 2) {
|
||||||
@ -467,11 +475,7 @@ ipmi_get_sol_info(
|
|||||||
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
||||||
val2str(data[1], sol_parameter_vals),
|
val2str(data[1], sol_parameter_vals),
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
|
||||||
val2str(data[1], sol_parameter_vals));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -484,7 +488,12 @@ ipmi_get_sol_info(
|
|||||||
data[3] = 0x00; /* block selector */
|
data[3] = 0x00; /* block selector */
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (NULL != rsp) {
|
if (rsp == NULL) {
|
||||||
|
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
||||||
|
val2str(data[1], sol_parameter_vals));
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
switch (rsp->ccode) {
|
switch (rsp->ccode) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
if (rsp->data_len == 2) {
|
if (rsp->data_len == 2) {
|
||||||
@ -505,11 +514,7 @@ ipmi_get_sol_info(
|
|||||||
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
||||||
val2str(data[1], sol_parameter_vals),
|
val2str(data[1], sol_parameter_vals),
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
|
||||||
val2str(data[1], sol_parameter_vals));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -522,7 +527,12 @@ ipmi_get_sol_info(
|
|||||||
data[3] = 0x00; /* block selector */
|
data[3] = 0x00; /* block selector */
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (NULL != rsp) {
|
if (rsp == NULL) {
|
||||||
|
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
||||||
|
val2str(data[1], sol_parameter_vals));
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
switch (rsp->ccode) {
|
switch (rsp->ccode) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
if (rsp->data_len == 3) {
|
if (rsp->data_len == 3) {
|
||||||
@ -535,23 +545,23 @@ ipmi_get_sol_info(
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x80:
|
case 0x80:
|
||||||
if( intf->session != NULL ){
|
if( intf->session != NULL ) {
|
||||||
lprintf(LOG_ERR, "Info: SOL parameter '%s' not supported - defaulting to %d", val2str(data[1], sol_parameter_vals), intf->session->port);
|
lprintf(LOG_ERR, "Info: SOL parameter '%s' not supported - defaulting to %d",
|
||||||
|
val2str(data[1], sol_parameter_vals), intf->session->port);
|
||||||
params->payload_port = intf->session->port;
|
params->payload_port = intf->session->port;
|
||||||
} else {
|
} else {
|
||||||
lprintf(LOG_ERR, "Info: SOL parameter '%s' not supported - can't determine which payload port to use on NULL session" );
|
lprintf(LOG_ERR,
|
||||||
return -1;
|
"Info: SOL parameter '%s' not supported - can't determine which "
|
||||||
|
"payload port to use on NULL session",
|
||||||
|
val2str(data[1], sol_parameter_vals));
|
||||||
|
return (-1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
lprintf(LOG_ERR, "Error requesting SOL parameter '%s': %s",
|
||||||
val2str(data[1], sol_parameter_vals),
|
val2str(data[1], sol_parameter_vals),
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
|
|
||||||
val2str(data[1], sol_parameter_vals));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user