diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2014-06-02 15:27:10 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2014-06-02 15:27:10 +0100 |
commit | 6501013bb780161e941f5e078a6ed7052f670a51 (patch) | |
tree | dcdb356c986e24d84f4dd6b5f8f1ea8d65e067f6 /tests/path | |
parent | 23182c4f13fbadc9b7c2ab75c1ca249d5ba987d1 (diff) | |
download | sos-6501013bb780161e941f5e078a6ed7052f670a51.tar.gz |
Make sure grub password regex handles all cases
The regex to match passwords in grub.conf needs to handle both
the --md5 and non-md5 cases and to apply the substitution only
to the secret part (password or password hash).
This needs to deal with the fact that python will return 'None'
for unmatched pattern groups leading to an exception in re.subn()
if not all referenced groups match for a given string (in contrast
to e.g. the perl approach of treating these groups as the empty
string).
Make this explicit by using an empty alternate in the possibly
unmatched '--md5' group:
r"(password\s*)(--md5\s*|\s*)(.*)",
r"\1\2********"
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Diffstat (limited to 'tests/path')
0 files changed, 0 insertions, 0 deletions