mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 17:50:20 +00:00
encode topic before using hashlib
This commit is contained in:
parent
3e46f5143d
commit
805c5eeb08
1 changed files with 5 additions and 4 deletions
|
@ -532,9 +532,10 @@ class AsyncZeroMQPubChannel(salt.transport.mixins.auth.AESPubClientMixin, salt.t
|
|||
payload = self.serial.loads(messages[0])
|
||||
# 2 includes a header which says who should do it
|
||||
elif messages_len == 2:
|
||||
if (self.opts.get('__role') != 'syndic' and messages[0] not in ('broadcast', self.hexid)) or \
|
||||
(self.opts.get('__role') == 'syndic' and messages[0] not in ('broadcast', 'syndic')):
|
||||
log.debug('Publish received for not this minion: %s', messages[0])
|
||||
message_target = salt.utils.stringutils.to_str(messages[0])
|
||||
if (self.opts.get('__role') != 'syndic' and message_target not in ('broadcast', self.hexid)) or \
|
||||
(self.opts.get('__role') == 'syndic' and message_target not in ('broadcast', 'syndic')):
|
||||
log.debug('Publish received for not this minion: %s', message_target)
|
||||
raise tornado.gen.Return(None)
|
||||
payload = self.serial.loads(messages[1])
|
||||
else:
|
||||
|
@ -916,7 +917,7 @@ class ZeroMQPubServerChannel(salt.transport.server.PubServerChannel):
|
|||
log.trace('Sending filtered data over publisher %s', pub_uri)
|
||||
# zmq filters are substring match, hash the topic
|
||||
# to avoid collisions
|
||||
htopic = salt.utils.stringutils.to_bytes(hashlib.sha1(topic).hexdigest())
|
||||
htopic = salt.utils.stringutils.to_bytes(hashlib.sha1(salt.utils.stringutils.to_bytes(topic)).hexdigest())
|
||||
pub_sock.send(htopic, flags=zmq.SNDMORE)
|
||||
pub_sock.send(payload)
|
||||
log.trace('Filtered data has been sent')
|
||||
|
|
Loading…
Add table
Reference in a new issue