Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a97598c

Browse files
*: Remove support for 'sp_max'
Whenever we were reading it, let's assume it contains a -1 (the integer representation of an empty field). Whenever we were writing it, let's write a -1. Signed-off-by: Alejandro Colomar <[email protected]>
1 parent c3870a9 commit a97598c

4 files changed

Lines changed: 4 additions & 29 deletions

File tree

lib/shadow/shadow/sgetspent.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,7 @@ sgetspent(const char *s)
6767

6868
spwd.sp_lstchg = -1;
6969
spwd.sp_min = -1;
70-
71-
/*
72-
* Get the maximum number of days a password is valid.
73-
*/
74-
75-
if (streq(fields[4], ""))
76-
spwd.sp_max = -1;
77-
else if (a2sl(&spwd.sp_max, fields[4], NULL, 0, 0, LONG_MAX) == -1)
78-
return NULL;
70+
spwd.sp_max = -1;
7971

8072
/*
8173
* If there are only OFIELDS fields (this is a SVR3.2 /etc/shadow

lib/shadowmem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
/* The libc might define other fields. They won't be copied. */
3434
sp->sp_lstchg = -1;
3535
sp->sp_min = -1;
36-
sp->sp_max = spent->sp_max;
36+
sp->sp_max = -1;
3737
sp->sp_warn = spent->sp_warn;
3838
sp->sp_inact = spent->sp_inact;
3939
sp->sp_expire = spent->sp_expire;

man/shadow.5.xml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -116,23 +116,7 @@
116116
<varlistentry>
117117
<term><emphasis role="bold">maximum password age</emphasis></term>
118118
<listitem>
119-
<para>
120-
The maximum password age is the number of days after which the
121-
user must change their password.
122-
</para>
123-
<para>
124-
After this number of days has elapsed, the password may still be valid.
125-
The user is prompted to change their password at the next login.
126-
</para>
127-
<para>
128-
An empty field means that there are no maximum password age,
129-
no password warning period, and no password inactivity period
130-
(see below).
131-
</para>
132-
<para>
133-
If the maximum password age is lower than the minimum password
134-
age, the user cannot change her password.
135-
</para>
119+
<para>This field should be empty.</para>
136120
</listitem>
137121
</varlistentry>
138122
<varlistentry>

src/passwd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,9 @@ static void print_status (const struct passwd *pw)
410410

411411
sp = prefix_getspnam (pw->pw_name); /* local, no need for xprefix_getspnam */
412412
if (NULL != sp) {
413-
(void) printf ("%s %s never -1 %ld %ld %ld\n",
413+
(void) printf ("%s %s never -1 -1 %ld %ld\n",
414414
pw->pw_name,
415415
pw_status (sp->sp_pwdp),
416-
sp->sp_max,
417416
sp->sp_warn,
418417
sp->sp_inact);
419418
} else if (NULL != pw->pw_passwd) {

0 commit comments

Comments
 (0)