Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Adam Osuchowski
Kea
Commits
7bb418a5
Commit
7bb418a5
authored
Aug 02, 2017
by
Tomek Mrugalski
🛰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[5314] Fix for segfault, courtesy of Marcin
- applied the patch provided as ticket attachment
parent
b0aea8ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
22 deletions
+9
-22
src/lib/config/hooked_command_mgr.cc
src/lib/config/hooked_command_mgr.cc
+9
-12
src/lib/config/hooked_command_mgr.h
src/lib/config/hooked_command_mgr.h
+0
-10
No files found.
src/lib/config/hooked_command_mgr.cc
View file @
7bb418a5
...
...
@@ -7,6 +7,7 @@
#include <cc/command_interpreter.h>
#include <config/hooked_command_mgr.h>
#include <config/config_log.h>
#include <hooks/callout_handle.h>
#include <hooks/hooks_manager.h>
#include <hooks/server_hooks.h>
#include <boost/pointer_cast.hpp>
...
...
@@ -19,7 +20,7 @@ namespace isc {
namespace
config
{
HookedCommandMgr
::
HookedCommandMgr
()
:
BaseCommandMgr
()
,
callout_handle_
(
HooksManager
::
createCalloutHandle
())
{
:
BaseCommandMgr
()
{
}
bool
...
...
@@ -31,25 +32,25 @@ HookedCommandMgr::delegateCommandToHookLibrary(const std::string& cmd_name,
ConstElementPtr
hook_response
;
if
(
HooksManager
::
commandHandlersPresent
(
cmd_name
))
{
callout_handle
_
=
HooksManager
::
createCalloutHandle
();
CalloutHandlePtr
callout_handle
=
HooksManager
::
createCalloutHandle
();
// Set status to normal.
callout_handle
_
->
setStatus
(
CalloutHandle
::
NEXT_STEP_CONTINUE
);
callout_handle
->
setStatus
(
CalloutHandle
::
NEXT_STEP_CONTINUE
);
// Delete previously set arguments.
callout_handle
_
->
deleteAllArguments
();
callout_handle
->
deleteAllArguments
();
ConstElementPtr
command
=
original_cmd
?
original_cmd
:
createCommand
(
cmd_name
,
params
);
// And pass it to the hook library.
callout_handle
_
->
setArgument
(
"command"
,
command
);
callout_handle
_
->
setArgument
(
"response"
,
hook_response
);
callout_handle
->
setArgument
(
"command"
,
command
);
callout_handle
->
setArgument
(
"response"
,
hook_response
);
HooksManager
::
callCommandHandlers
(
cmd_name
,
*
callout_handle
_
);
HooksManager
::
callCommandHandlers
(
cmd_name
,
*
callout_handle
);
// The callouts should set the response.
callout_handle
_
->
getArgument
(
"response"
,
hook_response
);
callout_handle
->
getArgument
(
"response"
,
hook_response
);
answer
=
boost
::
const_pointer_cast
<
Element
>
(
hook_response
);
...
...
@@ -63,10 +64,6 @@ ConstElementPtr
HookedCommandMgr
::
handleCommand
(
const
std
::
string
&
cmd_name
,
const
ConstElementPtr
&
params
,
const
ConstElementPtr
&
original_cmd
)
{
if
(
!
callout_handle_
)
{
isc_throw
(
Unexpected
,
"callout handle not configured for the Command "
"Manager: this is a programming error"
);
}
// The 'list-commands' is a special case. Hook libraries do not implement
// this command. We determine what commands are supported by the hook
...
...
src/lib/config/hooked_command_mgr.h
View file @
7bb418a5
...
...
@@ -9,7 +9,6 @@
#include <cc/data.h>
#include <config/base_command_mgr.h>
#include <hooks/callout_handle.h>
namespace
isc
{
namespace
config
{
...
...
@@ -47,13 +46,6 @@ public:
protected:
/// @brief Returns callout handle to the derived class.
///
/// @return const pointer to the callout handle.
const
isc
::
hooks
::
CalloutHandlePtr
&
getCalloutHandle
()
const
{
return
(
callout_handle_
);
}
/// @brief Handles the command within the hooks libraries.
///
/// This method checks if the hooks libraries are installed which implement
...
...
@@ -91,8 +83,6 @@ protected:
const
isc
::
data
::
ConstElementPtr
&
params
,
const
isc
::
data
::
ConstElementPtr
&
original_cmd
);
/// @brief Pointer to a callout handle used by this class.
isc
::
hooks
::
CalloutHandlePtr
callout_handle_
;
};
}
// end of namespace isc::config
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment