#50156 Ticket 50155 - password history check has no way to just check the current password
Closed by spichugi. Opened by mreynolds.
mreynolds/389-ds-base ticket50155  into  master

Download 50156.patch

Description:

Currently if you set passwordinhistory 1, it checks the last recorded password and the current password. To get it to just check the current password we need to allow "0" in passwordinhistory. Then only check the current password, and not the entry's passwordHistory attributes (if any).

https://pagure.io/389-ds-base/issue/50155

While you're touching it, it could be worth changing "long" to int32_t here (similar with retVal), but not necessary

Hey,

I think this is the kind of change that requires a test case to show that it hasn't broken the existing functions (Which I think exists), but also that we add a test case for the 0 case.

I also commented that there is a possible code cleanup, but it's not required.

Thanks,

Hey,
I think this is the kind of change that requires a test case to show that it hasn't broken the existing functions (Which I think exists), but also that we add a test case for the 0 case.

Agreed, I'll work on that tomorrow, and the code cleanup!

I also commented that there is a possible code cleanup, but it's not required.
Thanks,

Thank you!

@mreynolds just a dummy remark. pw_inhistory is used as the number of password kept in the history array (update_pw_history). Have you tested that when it is set to 0, the all history is not cleared ?

@mreynolds, rereading the ticket description I realize that clear of the history array was the not a concern. My understanding is that the ticket is to have the ability to reject a password update if the new value/current value are the same.
A concern is that we can not have both: ability to reject update if new_value=current_value AND new_value exist in history array. I feel I am missing something here.

@mreynolds just a dummy remark. pw_inhistory is used as the number of password kept in the history array (update_pw_history). Have you tested that when it is set to 0, the all history is not cleared ?

I have it works fine

@mreynolds, rereading the ticket description I realize that clear of the history array was the not a concern. My understanding is that the ticket is to have the ability to reject a password update if the new value/current value are the same.
A concern is that we can not have both: ability to reject update if new_value=current_value AND new_value exist in history array. I feel I am missing something here.

If you set passwordinhistry to "0", it only checks the current password, if you set it to "1" it checks the last password and the current password, etc. The only behavior change is when you use "0", in that case it never checks the entry's attributes, just the current password.

rebased onto 74a9cdb6f68b9932542389fdb2992103b645c7ea

rebased onto 2e50629e0792379c463c28318ff69da35e5c33fb

Changes made, and CI test updated. Please review...

I think we should use UserAccounts for all of these operations...

There is no need in these try-except blocks because the test case fails it will report all of the information to the output including a stack trace.

rebased onto d68fcc7d5cdaa5522dac6afc2c151b593f190bdf

I think we should use UserAccounts for all of these operations...

Done, also had to add a new function to Accounts class to rebind on the same connection. Please review

rebased onto 7cf40d15a679711f91e84e0400079ecab3fd3414

Ohhh as a follow up, when you write the test, run the code with asan too please :)

Ohhh as a follow up, when you write the test, run the code with asan too please :)

Test was written up, but I can not test it anymore because setup-ds.pl is currently broken. I'll test it once that all gets straightened out. Do you still require a ASAN run for this patch (the CI was passing)?

@mreynolds Anytime I touch the C code, I run it with ASAN. It's caught so many mistakes of my own that it's invaluable when used with testing. I think it would be great for you to run it with ASAN as tthat would help give you more confidence in the code changes :)

rebased onto cab38f97f9d59f5d725d2f5bc0768692e2c61ac0

ASAN tests pass, merging...

Pull-Request has been merged by mreynolds

Thank you!

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3215

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

Metadata