For normal (I haven't tried MD5) password encryption, passwd -l prepends a bang (!) to the encrypted password entry in /etc/shadow, which effectively "locks" the password. But passwd -u fails to get back the original password for one that is locked -- rather, in addition to removing the bang, it adds an extra character at the end of the encrypted password, rendering it unusable.
This bug is duplicated as #6083.
*** Bug 6083 has been marked as a duplicate of this bug. ***
The bug occurs _only_ if, while the given account was locked, the user with the locked account tries to change his password. What he usually does ... ;) Afterwards, unlocking the password - no error message - followed by an 'passwd -S user' will report 'no password set', but the user will stay locked out with a bad shadow entry till an mercyful root will change user's password. Maybe this will help to solve the issue ?
Additional info; no, it isn't related to trying to change the password, sorry. Here a typical sequence to reproduce the error: [root@teddy /quantum]# grep pppcicu /etc/shadow pppcicu:I0mddrVwXE5zQ:10994:0:99999:15:10:-1:134537660 [root@teddy /quantum]# passwd -l pppcicu Changing password for user pppcicu Locking password for user pppcicu passwd: Success [root@teddy /quantum]# grep pppcicu /etc/shadow pppcicu:!I0mddrVwXE5zQ:10994:0:99999:15:10:-1:134530044 [root@teddy /quantum]# passwd -u pppcicu Changing password for user pppcicu Unlocking password for user pppcicu passwd: Success [root@teddy /quantum]# grep pppcicu /etc/shadow pppcicu:I0mddrVwXE5zQncz:/ww:10994:0:99999:15:10:-1:134530044 [root@teddy /quantum]# A new field showed up in /etc/shadow. Deleting it will make the account usable. Maybe further environment data is needed ?
Fixed in 6.2.