summaryrefslogtreecommitdiffstats
path: root/sensorhandler.cpp
diff options
context:
space:
mode:
authorTom <tomjoseph@in.ibm.com>2016-09-06 17:21:23 +0530
committerTom Joseph <tomjoseph@in.ibm.com>2017-01-17 16:52:30 +0530
commit0573237f4521a0087153cded38814461c8978262 (patch)
tree94e7345d7b34c81a436ab6c7e46554762e0a0718 /sensorhandler.cpp
parent9e5232e59573ae4ddc6dd2064a813fd650dd0695 (diff)
downloadphosphor-host-ipmid-0573237f4521a0087153cded38814461c8978262.tar.gz
phosphor-host-ipmid-0573237f4521a0087153cded38814461c8978262.zip
Add privilege level for each IPMI command
Change-Id: I07f160c6ea83dc91f46e21f263c4cf994aff081d Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
Diffstat (limited to 'sensorhandler.cpp')
-rw-r--r--sensorhandler.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index 457849e..a40196c 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -49,7 +49,6 @@ struct sensorreadingresp_t {
uint8_t indication[2];
} __attribute__ ((packed)) ;
-
// Use a lookup table to find the interface name of a specific sensor
// This will be used until an alternative is found. this is the first
// step for mapping IPMI
@@ -249,7 +248,6 @@ final:
return 0;
}
-
uint8_t dbus_to_sensor_type(char *p) {
sensorTypemap_t *s = g_SensorTypeMap;
@@ -453,17 +451,25 @@ ipmi_ret_t ipmi_sen_wildcard(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
void register_netfn_sen_functions()
{
+ // <Wildcard Command>
printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_SENSOR, IPMI_CMD_WILDCARD);
- ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_WILDCARD, NULL, ipmi_sen_wildcard);
+ ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_WILDCARD, NULL, ipmi_sen_wildcard,
+ PRIVILEGE_USER);
+ // <Get Sensor Type>
printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_TYPE);
- ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_TYPE, NULL, ipmi_sen_get_sensor_type);
+ ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_TYPE, NULL, ipmi_sen_get_sensor_type,
+ PRIVILEGE_USER);
+ // <Set Sensor Reading and Event Status>
printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_SENSOR, IPMI_CMD_SET_SENSOR);
- ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_SET_SENSOR, NULL, ipmi_sen_set_sensor);
+ ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_SET_SENSOR, NULL, ipmi_sen_set_sensor,
+ PRIVILEGE_OPERATOR);
+ // <Get Sensor Reading>
printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_READING);
- ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_READING, NULL, ipmi_sen_get_sensor_reading);
+ ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_READING, NULL,
+ ipmi_sen_get_sensor_reading, PRIVILEGE_USER);
return;
}
OpenPOWER on IntegriCloud