From 8d4a2257b9bfd26d64bd283af28efccbfda1c79a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tuncay=20=C3=87OLAK?= Date: Mon, 4 Oct 2021 14:42:21 +0300 Subject: [PATCH] password param fixed for ad --- src/base/messaging/anonymous_messenger.py | 7 ++++--- src/base/registration/execute_sssd_ad_authentication.py | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/base/messaging/anonymous_messenger.py b/src/base/messaging/anonymous_messenger.py index 6af5105..b2fc7e5 100644 --- a/src/base/messaging/anonymous_messenger.py +++ b/src/base/messaging/anonymous_messenger.py @@ -103,12 +103,13 @@ class AnonymousMessenger(ClientXMPP): dn = str(j['agentDn']) self.logger.debug('Registration status: ' + str(status)) is_password = False - for key, value in j.items(): + body_without_password = json.loads(str(msg['body'])) + for key, value in body_without_password.items(): if "password" in key.lower(): - j[key] = "********" + body_without_password[key] = "********" is_password = True if is_password: - self.logger.info('---------->Received message: {0}'.format(str(j))) + self.logger.info('---------->Received message: {0}'.format(str(body_without_password))) else: self.logger.info('---------->Received message: {0}'.format(str(msg['body']))) diff --git a/src/base/registration/execute_sssd_ad_authentication.py b/src/base/registration/execute_sssd_ad_authentication.py index e95fd8d..1440292 100644 --- a/src/base/registration/execute_sssd_ad_authentication.py +++ b/src/base/registration/execute_sssd_ad_authentication.py @@ -362,6 +362,7 @@ class ExecuteSSSDAdAuthentication: try: process = subprocess.Popen(command, stdin=stdin, env=env, cwd=cwd, stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=shell) + self.logger.debug('Executing command for ad registration') if result is True: result_code = process.wait() p_out = process.stdout.read().decode("unicode_escape") @@ -370,5 +371,5 @@ class ExecuteSSSDAdAuthentication: else: return None, None, None except Exception as e: - return 1, 'Could not execute command' + return 1, 'Error Message: {0}'.format(str(e)), ''