Skip to content

Commit 62347a1

Browse files
mgr/smb: use a private constant for hidden value indicator
When the password filter hides a value we replace it with a string of asterisks - indicating that there was a value here. Move it to a constant so it can be reused later. Signed-off-by: John Mulligan <[email protected]>
1 parent d54fabc commit 62347a1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/pybind/mgr/smb/resources.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
ConversionOp = Tuple[PasswordFilter, PasswordFilter]
3333

34+
_MASKED = '*' * 16
35+
3436

3537
def _get_intent(data: Simplified) -> Intent:
3638
"""Helper function that returns the intent value from a data dict."""
@@ -644,7 +646,7 @@ def _password_convert(pvalue: str, operation: ConversionOp) -> str:
644646
if operation == (PasswordFilter.NONE, PasswordFilter.BASE64):
645647
pvalue = base64.b64encode(pvalue.encode("utf8")).decode("utf8")
646648
elif operation == (PasswordFilter.NONE, PasswordFilter.HIDDEN):
647-
pvalue = "*" * 16
649+
pvalue = _MASKED
648650
elif operation == (PasswordFilter.BASE64, PasswordFilter.NONE):
649651
pvalue = base64.b64decode(pvalue.encode("utf8")).decode("utf8")
650652
else:

0 commit comments

Comments
 (0)