shadow-maint / shadow

Upstream shadow tree
Other
305 stars 232 forks source link

Some patches from #876 #888

Closed alejandro-colomar closed 10 months ago

alejandro-colomar commented 10 months ago

These are the patches that I reviewed from that PR.

Cc: @stoeckmann

alejandro-colomar commented 10 months ago

v1b changes:

$ git range-diff ddbd3a36..gh/ts shadow/master..ts
1:  3699966d ! 1:  1f022177 lib/, src/: Remove SCALE definition
    @@ Commit message
         in source code and remove unneeded calculations.

         Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
    +    Link: <https://github.com/shadow-maint/shadow/pull/876>
         Signed-off-by: Alejandro Colomar <alx@kernel.org>

      ## lib/age.c ##
2:  f1743d43 ! 2:  ac6cb8ad src/passwd.c: Switch to day precision
    @@ Commit message
         signed integer overflow.

         Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
    +    Link: <https://github.com/shadow-maint/shadow/pull/876>
         Signed-off-by: Alejandro Colomar <alx@kernel.org>

      ## src/passwd.c ##
3:  c0a463ea ! 3:  05fd4899 src/passwd.c: Add overflow check
    @@ Commit message
         src/passwd.c: Add overflow check

         Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
    +    Link: <https://github.com/shadow-maint/shadow/pull/876>
         Signed-off-by: Alejandro Colomar <alx@kernel.org>

      ## src/passwd.c ##
4:  cdeb8852 ! 4:  0ac323dc src/: Fix long/time_t handling
    @@ Commit message
         since their long data type is still 32 bit.

         Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
    +    Link: <https://github.com/shadow-maint/shadow/pull/876>
         Signed-off-by: Alejandro Colomar <alx@kernel.org>

      ## src/pwck.c ##
alejandro-colomar commented 10 months ago

v2 changes:

$ git range-diff shadow/master gh/ts ts
1:  1f022177 = 1:  1f022177 lib/, src/: Remove SCALE definition
2:  ac6cb8ad ! 2:  6440e0ab src/passwd.c: Switch to day precision
    @@ src/passwd.c: static void check_password (const struct passwd *pw, const struct
     -          time_t ok;
     -          ok = (time_t) sp->sp_lstchg * DAY;
     +          long now, ok;
    -+          now = time (NULL) / DAY;
    ++          now = time(NULL) / DAY;
     +          ok = sp->sp_lstchg;
                if (sp->sp_min > 0) {
     -                  ok += (time_t) sp->sp_min * DAY;
3:  05fd4899 < -:  -------- src/passwd.c: Add overflow check
-:  -------- > 3:  ec794928 src/passwd.c: Add overflow check
4:  0ac323dc = 4:  711b8a27 src/: Fix long/time_t handling
alejandro-colomar commented 10 months ago

v2b changes:

$ git range-diff shadow/master gh/ts ts
1:  1f022177 = 1:  1f022177 lib/, src/: Remove SCALE definition
2:  6440e0ab = 2:  6440e0ab src/passwd.c: Switch to day precision
3:  ec794928 ! 3:  93db9c97 src/passwd.c: Add overflow check
    @@ Commit message

         Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
         Link: <https://github.com/shadow-maint/shadow/pull/876>
    +    Co-developed-by: Alejandro Colomar <alx@kernel.org>
         Signed-off-by: Alejandro Colomar <alx@kernel.org>

      ## src/passwd.c ##
4:  711b8a27 = 4:  2e63ceeb src/: Fix long/time_t handling