diff options
author | Eric Windisch <eric@cloudscaling.com> | 2013-01-28 12:32:34 -0500 |
---|---|---|
committer | Eric Windisch <eric@cloudscaling.com> | 2013-01-28 12:36:33 -0500 |
commit | 4f917794a7ff995021a1292dbeb3920a398e0bfe (patch) | |
tree | 16840ebb403952d2cff05f630a3703e30d009336 /openstack/common/rpc/impl_zmq.py | |
parent | 416e92d728b351a5ffbbbf0dda4973d41b1a7947 (diff) | |
download | oslo-4f917794a7ff995021a1292dbeb3920a398e0bfe.tar.gz oslo-4f917794a7ff995021a1292dbeb3920a398e0bfe.tar.xz oslo-4f917794a7ff995021a1292dbeb3920a398e0bfe.zip |
Dict args safe processing.
Improve safety of dict args
in process()
Change-Id: I0eae36ca6566c1b60f0a01ebee57ae8a7530fcb1
Diffstat (limited to 'openstack/common/rpc/impl_zmq.py')
-rw-r--r-- | openstack/common/rpc/impl_zmq.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/openstack/common/rpc/impl_zmq.py b/openstack/common/rpc/impl_zmq.py index ee313eb..b759b46 100644 --- a/openstack/common/rpc/impl_zmq.py +++ b/openstack/common/rpc/impl_zmq.py @@ -321,21 +321,22 @@ class ConsumerBase(object): return [result] def process(self, style, target, proxy, ctx, data): + data.setdefault('version', None) + data.setdefault('args', {}) + # Method starting with - are # processed internally. (non-valid method name) - method = data['method'] + method = data.get('method') + if not method: + LOG.error(_("RPC message did not include method.")) + return # Internal method # uses internal context for safety. - if data['method'][0] == '-': - # For reply / process_reply - method = method[1:] - if method == 'reply': - self.private_ctx.reply(ctx, proxy, **data['args']) + if method == '-reply': + self.private_ctx.reply(ctx, proxy, **data['args']) return - data.setdefault('version', None) - data.setdefault('args', {}) proxy.dispatch(ctx, data['version'], data['method'], **data['args']) |