Bug 251760
| Summary: | Account expiration date increments by one | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | ray hammond <ray.hammond77> |
| Component: | system-config-users | Assignee: | Nils Philippsen <nphilipp> |
| Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | low | Docs Contact: | |
| Priority: | low | ||
| Version: | 7 | ||
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | i386 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | 1.2.64-1.fc7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2007-09-18 03:20:26 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
ray hammond
2007-08-10 21:58:33 UTC
I couldn't reproduce this on system-config-users-1.2.61. Would you please check this with the version from updates-testing? Thanks. I have installed system-config-users-1.2.61 from the update-testing repo. I did this using the following command: yum --enablerepo=updates-testing install system-config-users This installed version 1.2.61-1.fc7, I followed the steps above and the date was still incremented by one everytime I re-opened the properties dialog. I have recorded my actions into an avi file, accessible from: http://homepage.ntlworld.com/ray.hammond/fedora/fedora7/Fedora-Bug-251760.avi Hope it helps. Also could the problem be related to my timezone? I am currenlty in Bristish Summer Time (BST) Hmm, I can't see the video either, but that may be a problem here. I don't think the timezone is a problem, I'm in CEST (UTC+2) now, but setting TZ=Europe/London and running s-c-users didn't result in what you described. - Are all other packages on the system updated? - After setting the expiration date to 2008-03-29, what is the 8th (second to last) field in /etc/shadow for that user? Sorry about the video, only works in MS Media player (whoops!). .
I have installed FC7 again and performed a full yum update. ("yum update -y")
I now have version 1.2.60 of system-config-users. By default /etc/shadow
contains the following:
rhh:$1$/QBT94Ih$P6YV1/Nh7VJZqyWtWP6mY0:13733:0:99999:7:::
After following the steps 1 to 5 /etc/shadow contains:
rhh:$1$/QBT94Ih$P6YV1/Nh7VJZqyWtWP6mY0:13733:0:99999:7::14698:
After re-opening the properties dialog and pressing OK /etc/shadow contains the
following:
rhh:$1$/QBT94Ih$P6YV1/Nh7VJZqyWtWP6mY0:13733:0:99999:7::14699:
After a little bit of digging I've traced my problem to:
/usr/share/system-config-users/userProperties.py
This file is shipped with the system-config-users rpm (you certainly know that
already).
Line 219, the ‘if’ statement, which is related to the expiration setting and its
nested statements are as follows:
if int(expire[0]) != -1:
self.accountExpireCheck.set_active(True)
days = int(self.userEnt.get(libuser.SHADOWEXPIRE)[0] +1)
tmp = days * int(secondsPerDay)
age = time.localtime(tmp)
year = str(age[0])
month = str(age[1])
day = str(age[2])
self.accountMonthEntry.set_text(month)
self.accountDayEntry.set_text(day)
self.accountYearEntry.set_text(year)
Check out the following line (extracted from above).
days = int(self.userEnt.get(libuser.SHADOWEXPIRE)[0] +1)
Why plus one? If I put the following line in ‘print days’, after the offending
line, sure enough the debug shows that the days variable is increased by one
every time. I then removed the plus one section of code i.e.
days = int(self.userEnt.get(libuser.SHADOWEXPIRE)[0])
The ‘days’ variable remained the same (correct value) in the /etc/shadow file
and utility.
Hope that helps a little.
Oh. That's some scary code you've dug up there. I can now reproduce the problem and it is indeed dependent on the timezone that's set. It's kind of a rounding error where it (hah!) sometimes subtracts 1 from the calculated number of days when storing and sometimes not. When loading the value (which is "days since beginning of the epoch", i.e. since 1970-01-01), it is incremented by 1, compensating for the subtraction that happened -- or not. system-config-users-1.2.64 keeps the expiration date stable, it should hit updates-testing soon. system-config-users-1.2.64-1.fc7 has been pushed to the Fedora 7 testing repository. If problems still persist, please make note of it in this bug report. system-config-users-1.2.64-1.fc7 has been pushed to the Fedora 7 stable repository. If problems still persist, please make note of it in this bug report. |