Skip to content

Commit

Permalink
Refactor: pylint rrequires more complexity.
Browse files Browse the repository at this point in the history
  • Loading branch information
nichtsfrei committed Dec 10, 2024
1 parent 377449e commit b59c433
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ospd_openvas/preferencehandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,11 @@ def prepare_scan_params_for_openvas(self, ospd_params: Dict[str, Dict]):
if prefs_val:
self.kbdb.add_scan_preferences(self.scan_id, prefs_val)

def disable_message(self, disabled: str) -> str:
"""Return a string with the message for exclusive services."""
disabled = "Disabled {}".format(disabled)
return disabled + ": KRB5 and SMB credentials are mutually exclusive."

def build_credentials_as_prefs(self, credentials: Dict) -> List[str]:
"""Parse the credential dictionary.
Arguments:
Expand All @@ -586,6 +591,7 @@ def build_credentials_as_prefs(self, credentials: Dict) -> List[str]:
A list with the credentials in string format to be
added to the redis KB.
"""

cred_prefs_list = []
krb5_set = False
smb_set = False
Expand Down Expand Up @@ -669,7 +675,7 @@ def build_credentials_as_prefs(self, credentials: Dict) -> List[str]:
elif service == 'smb':
if krb5_set:
self.errors.append(
"Disabled SMB: Kerberos and SMB credentials are mutually exclusive."
self.disable_message("SMB")
)
continue
smb_set = True
Expand All @@ -682,7 +688,7 @@ def build_credentials_as_prefs(self, credentials: Dict) -> List[str]:
elif service == 'krb5':
if smb_set:
self.errors.append(
"Disabled KRB5: Kerberos and SMB credentials are mutually exclusive."
self.disable_message("KRB5")
)
continue
krb5_set = True
Expand Down

0 comments on commit b59c433

Please sign in to comment.