"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/server/core/session.cpp" between
netxms-3.1.352.tar.gz and netxms-3.1.361.tar.gz

About: NetXMS is a multi-platform open source network management and monitoring system.

session.cpp  (netxms-3.1.352):session.cpp  (netxms-3.1.361)
skipping to change at line 14953 skipping to change at line 14953
* Add notification channel * Add notification channel
*/ */
void ClientSession::addNotificationChannel(NXCPMessage *request) void ClientSession::addNotificationChannel(NXCPMessage *request)
{ {
NXCPMessage msg; NXCPMessage msg;
msg.setCode(CMD_REQUEST_COMPLETED); msg.setCode(CMD_REQUEST_COMPLETED);
msg.setId(request->getId()); msg.setId(request->getId());
if (m_systemAccessRights & SYSTEM_ACCESS_SERVER_CONFIG) if (m_systemAccessRights & SYSTEM_ACCESS_SERVER_CONFIG)
{ {
TCHAR name[MAX_OBJECT_NAME]; TCHAR name[MAX_OBJECT_NAME];
TCHAR driverName[MAX_OBJECT_NAME];
request->getFieldAsString(VID_NAME, name, MAX_OBJECT_NAME); request->getFieldAsString(VID_NAME, name, MAX_OBJECT_NAME);
request->getFieldAsString(VID_DRIVER_NAME, driverName, MAX_OBJECT_NAME); if (name[0] != 0)
if (name[0] != 0 || driverName[0] != 0)
{ {
if (!IsNotificationChannelExists(name)) TCHAR driverName[MAX_OBJECT_NAME];
request->getFieldAsString(VID_DRIVER_NAME, driverName, MAX_OBJECT_NAME)
;
if (driverName[0] != 0)
{ {
TCHAR description[MAX_NC_DESCRIPTION]; if (!IsNotificationChannelExists(name))
request->getFieldAsString(VID_DESCRIPTION, description, MAX_NC_DESCR {
IPTION); TCHAR description[MAX_NC_DESCRIPTION];
char *configuration = request->getFieldAsMBString(VID_XML_CONFIG, NU request->getFieldAsString(VID_DESCRIPTION, description, MAX_NC_DE
LL, 0); SCRIPTION);
CreateNotificationChannelAndSave(name, description, driverName, conf char *configuration = request->getFieldAsMBString(VID_XML_CONFIG,
iguration); NULL, 0);
msg.setField(VID_RCC, RCC_SUCCESS); CreateNotificationChannelAndSave(name, description, driverName, c
NotifyClientSessions(NX_NOTIFICATION_CHANNEL_CHANGED, 0); onfiguration);
writeAuditLog(AUDIT_SYSCFG, true, 0, _T("Created new notification ch msg.setField(VID_RCC, RCC_SUCCESS);
annel %s"), name); NotifyClientSessions(NX_NOTIFICATION_CHANNEL_CHANGED, 0);
writeAuditLog(AUDIT_SYSCFG, true, 0, _T("Created new notification
channel %s"), name);
}
else
{
msg.setField(VID_RCC, RCC_CHANNEL_ALREADY_EXIST);
}
} }
else else
{ {
msg.setField(VID_RCC, RCC_CHANNEL_ALREADY_EXIST); msg.setField(VID_RCC, RCC_INVALID_DRIVER_NAME);
} }
} }
else else
{ {
msg.setField(VID_RCC, RCC_INVALID_CHANNEL_NAME_OR_DRIVER); msg.setField(VID_RCC, RCC_INVALID_CHANNEL_NAME);
} }
} }
else else
{ {
writeAuditLog(AUDIT_SYSCFG, false, 0, _T("Access denied on new notificatio n channel creation")); writeAuditLog(AUDIT_SYSCFG, false, 0, _T("Access denied on new notificatio n channel creation"));
msg.setField(VID_RCC, RCC_ACCESS_DENIED); msg.setField(VID_RCC, RCC_ACCESS_DENIED);
} }
sendMessage(&msg); sendMessage(&msg);
} }
skipping to change at line 14997 skipping to change at line 15004
* Update notificaiton channel * Update notificaiton channel
*/ */
void ClientSession::updateNotificationChannel(NXCPMessage *request) void ClientSession::updateNotificationChannel(NXCPMessage *request)
{ {
NXCPMessage msg; NXCPMessage msg;
msg.setCode(CMD_REQUEST_COMPLETED); msg.setCode(CMD_REQUEST_COMPLETED);
msg.setId(request->getId()); msg.setId(request->getId());
if (m_systemAccessRights & SYSTEM_ACCESS_SERVER_CONFIG) if (m_systemAccessRights & SYSTEM_ACCESS_SERVER_CONFIG)
{ {
TCHAR name[MAX_OBJECT_NAME]; TCHAR name[MAX_OBJECT_NAME];
TCHAR driverName[MAX_OBJECT_NAME];
request->getFieldAsString(VID_NAME, name, MAX_OBJECT_NAME); request->getFieldAsString(VID_NAME, name, MAX_OBJECT_NAME);
request->getFieldAsString(VID_DRIVER_NAME, driverName, MAX_OBJECT_NAME); if (name[0] != 0)
if (name[0] != 0 || driverName[0] != 0)
{ {
if (IsNotificationChannelExists(name)) TCHAR driverName[MAX_OBJECT_NAME];
request->getFieldAsString(VID_DRIVER_NAME, driverName, MAX_OBJECT_NAME)
;
if (driverName[0] != 0)
{ {
TCHAR description[MAX_NC_DESCRIPTION]; if (IsNotificationChannelExists(name))
request->getFieldAsString(VID_DESCRIPTION, description, MAX_NC_DESCR {
IPTION); TCHAR description[MAX_NC_DESCRIPTION];
char *configuration = request->getFieldAsMBString(VID_XML_CONFIG, NU request->getFieldAsString(VID_DESCRIPTION, description, MAX_NC_DE
LL, 0); SCRIPTION);
UpdateNotificationChannel(name, description, driverName, configurati char *configuration = request->getFieldAsMBString(VID_XML_CONFIG,
on); NULL, 0);
msg.setField(VID_RCC, RCC_SUCCESS); UpdateNotificationChannel(name, description, driverName, configur
NotifyClientSessions(NX_NOTIFICATION_CHANNEL_CHANGED, 0); ation);
MemFree(configuration); msg.setField(VID_RCC, RCC_SUCCESS);
writeAuditLog(AUDIT_SYSCFG, true, 0, _T("Updated configuration of no NotifyClientSessions(NX_NOTIFICATION_CHANNEL_CHANGED, 0);
tification channel %s"), name); MemFree(configuration);
writeAuditLog(AUDIT_SYSCFG, true, 0, _T("Updated configuration of
notification channel %s"), name);
}
else
{
msg.setField(VID_RCC, RCC_NO_CHANNEL_NAME);
}
} }
else else
{ {
msg.setField(VID_RCC, RCC_NO_CHANNEL_NAME); msg.setField(VID_RCC, RCC_INVALID_DRIVER_NAME);
} }
} }
else else
{ {
msg.setField(VID_RCC, RCC_INVALID_CHANNEL_NAME_OR_DRIVER); msg.setField(VID_RCC, RCC_INVALID_CHANNEL_NAME);
} }
} }
else else
{ {
writeAuditLog(AUDIT_SYSCFG, false, 0, _T("Access denied on notification ch annel update")); writeAuditLog(AUDIT_SYSCFG, false, 0, _T("Access denied on notification ch annel update"));
msg.setField(VID_RCC, RCC_ACCESS_DENIED); msg.setField(VID_RCC, RCC_ACCESS_DENIED);
} }
sendMessage(&msg); sendMessage(&msg);
} }
skipping to change at line 15109 skipping to change at line 15123
} }
else else
{ {
MemFree(name); MemFree(name);
msg.setField(VID_RCC, RCC_NO_CHANNEL_NAME); msg.setField(VID_RCC, RCC_NO_CHANNEL_NAME);
} }
} }
else else
{ {
MemFree(name); MemFree(name);
msg.setField(VID_RCC, RCC_INVALID_CHANNEL_NAME_OR_DRIVER); msg.setField(VID_RCC, RCC_INVALID_CHANNEL_NAME);
} }
} }
else else
{ {
writeAuditLog(AUDIT_SYSCFG, false, 0, _T("Access denied on notification ch annel rename")); writeAuditLog(AUDIT_SYSCFG, false, 0, _T("Access denied on notification ch annel rename"));
msg.setField(VID_RCC, RCC_ACCESS_DENIED); msg.setField(VID_RCC, RCC_ACCESS_DENIED);
} }
sendMessage(&msg); sendMessage(&msg);
} }
 End of changes. 13 change blocks. 
36 lines changed or deleted 52 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)