Red Hat Bugzilla – Bug 815516
pam remember can check wrong username if it is a substring of another username
Last modified: 2013-02-21 05:36:56 EST
+++ This bug was initially created as a clone of Bug #768087 +++ Description of problem: The remember functionality of pam_unix can compare against the wrong username’s old passwords if the username is a substring of another username. The substring must be at the beginning of both usernames for this to occur. For example, a username ‘test’ will look at the old passwords of ‘test123’. Version-Release number of selected component (if applicable): pam-0.99.6.2-6.el5_5.2.i386.rpm How reproducible: Always Steps to Reproduce: 1. Make sure remember=8 or something similar is enabled on pam_unix in the password stack 2. Create a user ‘test1’ and change the password a few times 3. Create a user ‘test’ and change the password to a previous password of test1 Actual results: The password change is denied, however, it should not have been. Expected results: The password change is allowed. Additional info: You can see the erroneous code in pam_unix_passwd.c inside of the pam_unix module directory (in function save_old_password): while (fgets(buf, 16380, opwfile)) { if (!strncmp(buf, forwho, strlen(forwho))) { The fix is to search for a line that starts with the username followed immediately by a colon. The same erroneous code exists in "pam_unix_passwd.c" in function check_old_password: while (fgets(buf, 16380, opwfile)) { if (!strncmp(buf, forwho, strlen(forwho))) {
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2013-0521.html