From 208ca4376095b9026ce66dc1b88ea2a7683a9392 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 28 Mar 2018 10:55:59 -0700 Subject: [PATCH] [hostcfgd] Fix a bug that tacacs key is wrongly modified (#1536) --- files/image_config/hostcfgd/hostcfgd | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/files/image_config/hostcfgd/hostcfgd b/files/image_config/hostcfgd/hostcfgd index 25cfa7c714..8c03f2234a 100755 --- a/files/image_config/hostcfgd/hostcfgd +++ b/files/image_config/hostcfgd/hostcfgd @@ -5,6 +5,7 @@ import os import sys import subprocess import syslog +import copy import jinja2 from swsssdk import ConfigDBConnector @@ -155,15 +156,17 @@ class HostConfigDaemon: def tacacs_server_handler(self, key, data): self.aaacfg.tacacs_server_update(key, data) - if data.has_key('passkey'): - data['passkey'] = obfuscate(data['passkey']) - syslog.syslog(syslog.LOG_DEBUG, 'value for {} changed to {}'.format(key, data)) + log_data = copy.deepcopy(data) + if log_data.has_key('passkey'): + log_data['passkey'] = obfuscate(log_data['passkey']) + syslog.syslog(syslog.LOG_DEBUG, 'value of {} changed to {}'.format(key, log_data)) def tacacs_global_handler(self, key, data): self.aaacfg.tacacs_global_update(key, data) - if data.has_key('passkey'): - data['passkey'] = obfuscate(data['passkey']) - syslog.syslog(syslog.LOG_DEBUG, 'value for {} changed to {}'.format(key, data)) + log_data = copy.deepcopy(data) + if log_data.has_key('passkey'): + log_data['passkey'] = obfuscate(log_data['passkey']) + syslog.syslog(syslog.LOG_DEBUG, 'value of {} changed to {}'.format(key, log_data)) def start(self): self.config_db.subscribe('AAA', lambda table, key, data: self.aaa_handler(key, data))