Refresh patches and include upstream patch for getdate

Include https://github.com/shadow-maint/shadow/pull/1214 to fix
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1095430 in the
way upstream intends to fix it.

Gbp-Dch: full
This commit is contained in:
Chris Hofstaedtler
2025-02-24 23:21:38 +01:00
parent df34dc0271
commit 47ba166e47
14 changed files with 412 additions and 137 deletions
@@ -1,28 +0,0 @@
From: Chris Hofstaedtler <zeha@debian.org>
Date: Sun, 16 Feb 2025 20:21:35 +0100
Subject: Revert "lib/strtoday.c: strtoday(): Fix calculation"
This reverts commit 1175932c0c86ee46ee298fd9cfa01653a2ba3a27.
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1095430
---
lib/strtoday.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/strtoday.c b/lib/strtoday.c
index 01f2e9b..f947778 100644
--- a/lib/strtoday.c
+++ b/lib/strtoday.c
@@ -67,9 +67,10 @@ long strtoday (const char *str)
return retdate;
}
- t = get_date(str, NULL);
+ t = get_date (str, NULL);
if ((time_t) - 1 == t) {
return -2;
}
- return t / DAY;
+ /* convert seconds to days since 1970-01-01 */
+ return (t + DAY / 2) / DAY;
}
+2 -2
View File
@@ -7,7 +7,7 @@ Subject: Define LOGIN_NAME_MAX on HURD
1 file changed, 6 insertions(+)
diff --git a/lib/chkname.c b/lib/chkname.c
index bee2e6b..c3fb552 100644
index 57d6d96..6af55a9 100644
--- a/lib/chkname.c
+++ b/lib/chkname.c
@@ -29,6 +29,12 @@
@@ -22,4 +22,4 @@ index bee2e6b..c3fb552 100644
+
#include "defines.h"
#include "chkname.h"
#include "string/strcmp/streq.h"
#include "string/ctype/strisascii/strisdigit.h"
@@ -12,7 +12,7 @@ upstream.
create mode 100644 man/man8/shadowconfig.8
diff --git a/man/Makefile.am b/man/Makefile.am
index 1405509..0e88fea 100644
index f34ed7a..2523e84 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -36,6 +36,7 @@ man_MANS = \
@@ -17,7 +17,7 @@ configuration files shipped in Debian (debian/default/useradd).
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/man/useradd.8.xml b/man/useradd.8.xml
index 001e7d1..4888100 100644
index eda1fef..38f2c68 100644
--- a/man/useradd.8.xml
+++ b/man/useradd.8.xml
@@ -248,7 +248,7 @@
@@ -30,10 +30,10 @@ index 001e7d1..4888100 100644
</listitem>
</varlistentry>
diff --git a/src/useradd.c b/src/useradd.c
index 7623dab..954b329 100644
index ee52aaf..5e4eb2c 100644
--- a/src/useradd.c
+++ b/src/useradd.c
@@ -96,14 +96,14 @@ static const char Prog[] = "useradd";
@@ -97,14 +97,14 @@ static const char Prog[] = "useradd";
/*
* These defaults are used if there is no defaults file.
*/
@@ -11,7 +11,7 @@ Status wrt upstream: Debian specific patch.
2 files changed, 12 insertions(+)
diff --git a/man/useradd.8.xml b/man/useradd.8.xml
index 4888100..17987a6 100644
index 38f2c68..9009d83 100644
--- a/man/useradd.8.xml
+++ b/man/useradd.8.xml
@@ -82,6 +82,12 @@
@@ -12,7 +12,7 @@ Fixes: #166793
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/lib/commonio.c b/lib/commonio.c
index 4d83e83..51e6300 100644
index b7c9a2d..309efa0 100644
--- a/lib/commonio.c
+++ b/lib/commonio.c
@@ -21,6 +21,7 @@
@@ -24,7 +24,7 @@ index 4d83e83..51e6300 100644
#include "alloc/malloc.h"
#include "alloc/reallocf.h"
@@ -953,12 +954,23 @@ int commonio_close (struct commonio_db *db)
if (errors != 0)
if (errors)
goto fail;
} else {
+ struct group *grp;
@@ -48,7 +48,7 @@ index 4d83e83..51e6300 100644
if (SNPRINTF(buf, "%s+", db->filename) == -1)
diff --git a/lib/sgroupio.c b/lib/sgroupio.c
index acb140d..6ffccd1 100644
index 9805761..e3c0458 100644
--- a/lib/sgroupio.c
+++ b/lib/sgroupio.c
@@ -210,7 +210,7 @@ static struct commonio_db gshadow_db = {
@@ -3,7 +3,7 @@ Date: Tue, 6 Aug 2024 00:27:13 +0200
Subject: Stop building programs we do not install
---
man/Makefile.am | 16 ----------------
man/Makefile.am | 15 ---------------
man/cs/Makefile.am | 9 ---------
man/da/Makefile.am | 3 ---
man/de/Makefile.am | 10 ----------
@@ -21,10 +21,10 @@ Subject: Stop building programs we do not install
man/zh_CN/Makefile.am | 10 ----------
man/zh_TW/Makefile.am | 2 --
src/Makefile.am | 7 +++----
18 files changed, 3 insertions(+), 122 deletions(-)
18 files changed, 3 insertions(+), 121 deletions(-)
diff --git a/man/Makefile.am b/man/Makefile.am
index 0e88fea..18c012d 100644
index 2523e84..05a0c86 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -13,8 +13,6 @@ man_MANS = \
@@ -36,7 +36,7 @@ index 0e88fea..18c012d 100644
man3/getspnam.3 \
man1/gpasswd.1 \
man8/groupadd.8 \
@@ -25,22 +23,16 @@ man_MANS = \
@@ -25,19 +23,14 @@ man_MANS = \
man8/grpconv.8 \
man8/grpunconv.8 \
man5/gshadow.5 \
@@ -55,11 +55,8 @@ index 0e88fea..18c012d 100644
- man1/sg.1 \
man3/shadow.3 \
man5/shadow.5 \
- man5/suauth.5 \
man8/useradd.8 \
man8/userdel.8 \
man8/usermod.8 \
@@ -82,8 +74,6 @@ man_XMANS = \
@@ -82,8 +75,6 @@ man_XMANS = \
chpasswd.8.xml \
chsh.1.xml \
expiry.1.xml \
@@ -68,7 +65,7 @@ index 0e88fea..18c012d 100644
getsubids.1.xml \
gpasswd.1.xml \
groupadd.8.xml \
@@ -96,12 +86,9 @@ man_XMANS = \
@@ -96,12 +87,9 @@ man_XMANS = \
login.1.xml \
login.access.5.xml \
login.defs.5.xml \
@@ -81,7 +78,7 @@ index 0e88fea..18c012d 100644
passwd.1.xml \
passwd.5.xml \
porttime.5.xml \
@@ -109,9 +96,6 @@ man_XMANS = \
@@ -109,9 +97,6 @@ man_XMANS = \
pwconv.8.xml \
shadow.3.xml \
shadow.5.xml \
@@ -531,7 +528,7 @@ index c36ed2c..6fb6a15 100644
man8/userdel.8 \
man8/usermod.8
diff --git a/src/Makefile.am b/src/Makefile.am
index d4e6f3a..78722ad 100644
index 6981815..5ca78ed 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,8 +26,8 @@ AM_CFLAGS = $(LIBBSD_CFLAGS)
@@ -11,10 +11,10 @@ Upstream PR 1158 will remove them, probably in the forky timeframe.
4 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/newusers.c b/src/newusers.c
index 5e78dd9..964e668 100644
index e3685ef..16abd81 100644
--- a/src/newusers.c
+++ b/src/newusers.c
@@ -125,7 +125,7 @@ static void usage (int status)
@@ -127,7 +127,7 @@ static void usage (int status)
"\n"
"Options:\n"),
Prog);
@@ -23,7 +23,7 @@ index 5e78dd9..964e668 100644
#ifndef USE_PAM
(void) fprintf (usageout,
_(" -c, --crypt-method METHOD the crypt method (one of %s)\n"),
@@ -658,6 +658,9 @@ static void process_flags (int argc, char **argv)
@@ -660,6 +660,9 @@ static void process_flags (int argc, char **argv)
switch (c) {
case 'b':
allow_bad_names = true;
@@ -34,7 +34,7 @@ index 5e78dd9..964e668 100644
#ifndef USE_PAM
case 'c':
diff --git a/src/pwck.c b/src/pwck.c
index ae7ddad..8805422 100644
index b485a5a..e20be0f 100644
--- a/src/pwck.c
+++ b/src/pwck.c
@@ -133,7 +133,7 @@ usage (int status)
@@ -57,10 +57,10 @@ index ae7ddad..8805422 100644
case 'h':
usage (E_SUCCESS);
diff --git a/src/useradd.c b/src/useradd.c
index 92f8054..f5169b3 100644
index 5e4eb2c..be9ec2e 100644
--- a/src/useradd.c
+++ b/src/useradd.c
@@ -894,7 +894,7 @@ static void usage (int status)
@@ -895,7 +895,7 @@ static void usage (int status)
"\n"
"Options:\n"),
Prog, Prog, Prog);
@@ -69,7 +69,7 @@ index 92f8054..f5169b3 100644
(void) fputs (_(" -b, --base-dir BASE_DIR base directory for the home directory of the\n"
" new account\n"), usageout);
#ifdef WITH_BTRFS
@@ -1240,6 +1240,9 @@ static void process_flags (int argc, char **argv)
@@ -1241,6 +1241,9 @@ static void process_flags (int argc, char **argv)
break;
case 201:
allow_bad_names = true;
@@ -80,7 +80,7 @@ index 92f8054..f5169b3 100644
case 'c':
if (!VALID (optarg)) {
diff --git a/src/usermod.c b/src/usermod.c
index 24c5a4d..a06f2dc 100644
index 7ea1a72..3e9e046 100644
--- a/src/usermod.c
+++ b/src/usermod.c
@@ -383,7 +383,7 @@ usage (int status)
@@ -1,17 +1,19 @@
From: Chris Hofstaedtler <zeha@debian.org>
Date: Mon, 24 Feb 2025 12:01:18 +0100
Subject: configure: always pick /usr/bin/passwd
Subject: configure.ac: be deterministic about passwd location
Improve reproducibility, without Build-Depend:ing on ourselves.
Forwarded: https://github.com/shadow-maint/shadow/issues/1224
---
configure.ac | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/configure.ac b/configure.ac
index a7388e7..2a6591a 100644
index 36c57d8..94fef7e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -150,13 +150,7 @@ AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$shadow_cv_logdir/lastlog",
@@ -115,13 +115,7 @@ AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$shadow_cv_logdir/lastlog",
AC_DEFINE_UNQUOTED(FAILLOG_FILE, "$shadow_cv_logdir/faillog",
[Path for faillog file.])
@@ -22,7 +24,7 @@ index a7388e7..2a6591a 100644
- shadow_cv_passwd_dir=/bin
-fi])
-AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",
+AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$prefix/bin/passwd",
+AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$exec_prefix/bin/passwd",
[Path to passwd program.])
AC_ARG_ENABLE(shadowgrp,
+3 -5
View File
@@ -6,13 +6,11 @@ debian/tests-disable-su.patch
debian/Adapt-login.defs-for-Debian.patch
debian/Define-LOGIN_NAME_MAX-on-HURD.patch
debian/Stop-building-programs-we-do-not-install.patch
debian/configure-always-pick-usr-bin-passwd.patch
upstream/a015e919834c90b99947829c6c823f7fe93a8097-E_BAD_NAME.patch
upstream/man-useradd.8.xml-Document-new-exit-code-19-E_BAD_NAME.patch
debian/Warn-when-badname-and-variants-are-given.patch
debian/configure.ac-be-deterministic-about-passwd-location.patch
upstream/Revert-lib-src-Use-local-time-for-human-readable-dates.patch
Revert-lib-strtoday.c-strtoday-Fix-calculation.patch
Warn-when-badname-and-variants-are-given.patch
upstream/src-chfn.c-Partially-revert-lib-src-Use-strsep-3-instead-.patch
upstream/src-chfn.c-Use-stpsep-instead-of-its-pattern.patch
upstream/src-chfn.c-Add-local-variable-to-refer-to-the-separated-f.patch
upstream/src-chfn.c-copy_field-Rename-local-variable.patch
upstream/lib-getdate.y-Ignore-time-zone-information-and-use-UTC.patch
@@ -56,10 +56,10 @@ index b70e989..fe3308d 100644
return;
}
diff --git a/src/chage.c b/src/chage.c
index a7933e0..67e7e77 100644
index aed8e5b..e2902a7 100644
--- a/src/chage.c
+++ b/src/chage.c
@@ -243,7 +243,7 @@ print_day_as_date(long day)
@@ -238,7 +238,7 @@ print_day_as_date(long day)
return;
}
@@ -1,38 +0,0 @@
From: Alejandro Colomar <alx@kernel.org>
Date: Thu, 5 Dec 2024 17:38:54 +0100
Subject: [PATCH] src/useradd.c: E_BAD_NAME: Use a different error code for
bad login names
Wrappers like adduser(8) want to do their own stuff if the login name is
bad. For that, they need to be able to differentiate such an error.
Closes: <https://github.com/shadow-maint/shadow/issues/1103>
Suggested-by: Chris Hofstaedtler <zeha@debian.org>
Cc: Marc 'Zugschlus' Haber <mh+githubvisible@zugschlus.de>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Bug-Debian: 1074306
---
src/useradd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/useradd.c b/src/useradd.c
index 954b329..92f8054 100644
--- a/src/useradd.c
+++ b/src/useradd.c
@@ -201,6 +201,7 @@ static bool home_added = false;
#define E_SUB_UID_UPDATE 16 /* can't update the subordinate uid file */
#define E_SUB_GID_UPDATE 18 /* can't update the subordinate gid file */
#endif /* ENABLE_SUBIDS */
+#define E_BAD_NAME 19 /* Bad login name */
#define DGROUP "GROUP"
#define DGROUPS "GROUPS"
@@ -1549,7 +1550,7 @@ static void process_flags (int argc, char **argv)
user_name, AUDIT_NO_ID,
SHADOW_AUDIT_FAILURE);
#endif
- exit (E_BAD_ARG);
+ exit (E_BAD_NAME);
}
if (!dflg) {
char *uh;
@@ -0,0 +1,375 @@
From: Alejandro Colomar <alx@kernel.org>
Date: Tue, 18 Feb 2025 00:41:56 +0100
Subject: lib/getdate.y: Ignore time-zone information and use UTC
There is exactly one caller of this function, and it wants a date, not a
time. It is useless to be able to parse local dates, because we
ultimately store a UTC date. To avoid confusion, unconditionally use
UTC. Since this code had important bugs regarding offset, we can safely
assume that no existing users rely on being able to use their local
date (this never worked correctly).
Also, the code parsing time zones was quite bad.
Link: <https://github.com/shadow-maint/shadow/issues/1202>
Link: <https://github.com/shadow-maint/shadow/issues/1209>
Reported-by: Chris Hofstaedtler <zeha@debian.org>
Reported-by: Tim Parenti <tim@timtimeonline.com>
Reported-by: Lee Garrett <lgarrett@rocketjump.eu>
Cc: Gus Kenion <https://github.com/kenion>
Cc: Michael Vetter <jubalh@iodoru.org>
Cc: Paul Eggert <eggert@cs.ucla.edu>
Cc: Iker Pedrosa <ipedrosa@redhat.com>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
lib/getdate.y | 225 +++-------------------------------------------------------
1 file changed, 10 insertions(+), 215 deletions(-)
diff --git a/lib/getdate.y b/lib/getdate.y
index 20b1f5f..5b1d88d 100644
--- a/lib/getdate.y
+++ b/lib/getdate.y
@@ -92,8 +92,6 @@
static int yylex (void);
static int yyerror (const char *s);
-#define EPOCH 1970
-#define HOUR(x) ((x) * 60)
#define MAX_BUFF_LEN 128 /* size of buffer to read the date into */
@@ -128,8 +126,6 @@ static int yyHaveDate;
static int yyHaveDay;
static int yyHaveRel;
static int yyHaveTime;
-static int yyHaveZone;
-static int yyTimezone;
static int yyDay;
static int yyHour;
static int yyMinutes;
@@ -151,13 +147,13 @@ static int yyRelYear;
enum _MERIDIAN Meridian;
}
-%token tAGO tDAY tDAY_UNIT tDAYZONE tDST tHOUR_UNIT tID
+%token tAGO tDAY tDAY_UNIT tHOUR_UNIT tID
%token tMERIDIAN tMINUTE_UNIT tMONTH tMONTH_UNIT
-%token tSEC_UNIT tSNUMBER tUNUMBER tYEAR_UNIT tZONE
+%token tSEC_UNIT tSNUMBER tUNUMBER tYEAR_UNIT
-%type <Number> tDAY tDAY_UNIT tDAYZONE tHOUR_UNIT tMINUTE_UNIT
+%type <Number> tDAY tDAY_UNIT tHOUR_UNIT tMINUTE_UNIT
%type <Number> tMONTH tMONTH_UNIT
-%type <Number> tSEC_UNIT tSNUMBER tUNUMBER tYEAR_UNIT tZONE
+%type <Number> tSEC_UNIT tSNUMBER tUNUMBER tYEAR_UNIT
%type <Meridian> tMERIDIAN o_merid
%%
@@ -169,9 +165,6 @@ spec : /* NULL */
item : time {
yyHaveTime++;
}
- | zone {
- yyHaveZone++;
- }
| date {
yyHaveDate++;
}
@@ -200,10 +193,6 @@ time : tUNUMBER tMERIDIAN {
yyHour = $1;
yyMinutes = $3;
yyMeridian = MER24;
- yyHaveZone++;
- yyTimezone = ($4 < 0
- ? -$4 % 100 + (-$4 / 100) * 60
- : - ($4 % 100 + ($4 / 100) * 60));
}
| tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid {
yyHour = $1;
@@ -216,22 +205,6 @@ time : tUNUMBER tMERIDIAN {
yyMinutes = $3;
yySeconds = $5;
yyMeridian = MER24;
- yyHaveZone++;
- yyTimezone = ($6 < 0
- ? -$6 % 100 + (-$6 / 100) * 60
- : - ($6 % 100 + ($6 / 100) * 60));
- }
- ;
-
-zone : tZONE {
- yyTimezone = $1;
- }
- | tDAYZONE {
- yyTimezone = $1 - 60;
- }
- |
- tZONE tDST {
- yyTimezone = $1 - 60;
}
;
@@ -484,91 +457,6 @@ static TABLE const OtherTable[] = {
{ NULL, 0, 0 }
};
-/* The timezone table. */
-static TABLE const TimezoneTable[] = {
- { "gmt", tZONE, HOUR ( 0) }, /* Greenwich Mean */
- { "ut", tZONE, HOUR ( 0) }, /* Universal (Coordinated) */
- { "utc", tZONE, HOUR ( 0) },
- { "wet", tZONE, HOUR ( 0) }, /* Western European */
- { "bst", tDAYZONE, HOUR ( 0) }, /* British Summer */
- { "wat", tZONE, HOUR ( 1) }, /* West Africa */
- { "at", tZONE, HOUR ( 2) }, /* Azores */
- { "ast", tZONE, HOUR ( 4) }, /* Atlantic Standard */
- { "adt", tDAYZONE, HOUR ( 4) }, /* Atlantic Daylight */
- { "est", tZONE, HOUR ( 5) }, /* Eastern Standard */
- { "edt", tDAYZONE, HOUR ( 5) }, /* Eastern Daylight */
- { "cst", tZONE, HOUR ( 6) }, /* Central Standard */
- { "cdt", tDAYZONE, HOUR ( 6) }, /* Central Daylight */
- { "mst", tZONE, HOUR ( 7) }, /* Mountain Standard */
- { "mdt", tDAYZONE, HOUR ( 7) }, /* Mountain Daylight */
- { "pst", tZONE, HOUR ( 8) }, /* Pacific Standard */
- { "pdt", tDAYZONE, HOUR ( 8) }, /* Pacific Daylight */
- { "yst", tZONE, HOUR ( 9) }, /* Yukon Standard */
- { "ydt", tDAYZONE, HOUR ( 9) }, /* Yukon Daylight */
- { "hst", tZONE, HOUR (10) }, /* Hawaii Standard */
- { "hdt", tDAYZONE, HOUR (10) }, /* Hawaii Daylight */
- { "cat", tZONE, HOUR (10) }, /* Central Alaska */
- { "ahst", tZONE, HOUR (10) }, /* Alaska-Hawaii Standard */
- { "nt", tZONE, HOUR (11) }, /* Nome */
- { "idlw", tZONE, HOUR (12) }, /* International Date Line West */
- { "cet", tZONE, -HOUR (1) }, /* Central European */
- { "met", tZONE, -HOUR (1) }, /* Middle European */
- { "mewt", tZONE, -HOUR (1) }, /* Middle European Winter */
- { "mest", tDAYZONE, -HOUR (1) }, /* Middle European Summer */
- { "mesz", tDAYZONE, -HOUR (1) }, /* Middle European Summer */
- { "swt", tZONE, -HOUR (1) }, /* Swedish Winter */
- { "sst", tDAYZONE, -HOUR (1) }, /* Swedish Summer */
- { "fwt", tZONE, -HOUR (1) }, /* French Winter */
- { "fst", tDAYZONE, -HOUR (1) }, /* French Summer */
- { "eet", tZONE, -HOUR (2) }, /* Eastern Europe, USSR Zone 1 */
- { "bt", tZONE, -HOUR (3) }, /* Baghdad, USSR Zone 2 */
- { "zp4", tZONE, -HOUR (4) }, /* USSR Zone 3 */
- { "zp5", tZONE, -HOUR (5) }, /* USSR Zone 4 */
- { "zp6", tZONE, -HOUR (6) }, /* USSR Zone 5 */
- { "wast", tZONE, -HOUR (7) }, /* West Australian Standard */
- { "wadt", tDAYZONE, -HOUR (7) }, /* West Australian Daylight */
- { "cct", tZONE, -HOUR (8) }, /* China Coast, USSR Zone 7 */
- { "jst", tZONE, -HOUR (9) }, /* Japan Standard, USSR Zone 8 */
- { "east", tZONE, -HOUR (10) }, /* Eastern Australian Standard */
- { "eadt", tDAYZONE, -HOUR (10) }, /* Eastern Australian Daylight */
- { "gst", tZONE, -HOUR (10) }, /* Guam Standard, USSR Zone 9 */
- { "nzt", tZONE, -HOUR (12) }, /* New Zealand */
- { "nzst", tZONE, -HOUR (12) }, /* New Zealand Standard */
- { "nzdt", tDAYZONE, -HOUR (12) }, /* New Zealand Daylight */
- { "idle", tZONE, -HOUR (12) }, /* International Date Line East */
- { NULL, 0, 0 }
-};
-
-/* Military timezone table. */
-static TABLE const MilitaryTable[] = {
- { "a", tZONE, HOUR ( 1) },
- { "b", tZONE, HOUR ( 2) },
- { "c", tZONE, HOUR ( 3) },
- { "d", tZONE, HOUR ( 4) },
- { "e", tZONE, HOUR ( 5) },
- { "f", tZONE, HOUR ( 6) },
- { "g", tZONE, HOUR ( 7) },
- { "h", tZONE, HOUR ( 8) },
- { "i", tZONE, HOUR ( 9) },
- { "k", tZONE, HOUR ( 10) },
- { "l", tZONE, HOUR ( 11) },
- { "m", tZONE, HOUR ( 12) },
- { "n", tZONE, HOUR (- 1) },
- { "o", tZONE, HOUR (- 2) },
- { "p", tZONE, HOUR (- 3) },
- { "q", tZONE, HOUR (- 4) },
- { "r", tZONE, HOUR (- 5) },
- { "s", tZONE, HOUR (- 6) },
- { "t", tZONE, HOUR (- 7) },
- { "u", tZONE, HOUR (- 8) },
- { "v", tZONE, HOUR (- 9) },
- { "w", tZONE, HOUR (-10) },
- { "x", tZONE, HOUR (-11) },
- { "y", tZONE, HOUR (-12) },
- { "z", tZONE, HOUR ( 0) },
- { NULL, 0, 0 }
-};
-
@@ -621,7 +509,6 @@ static int ToYear (int Year)
static int LookupWord (char *buff)
{
register char *p;
- register char *q;
register const TABLE *tp;
int i;
bool abbrev;
@@ -670,16 +557,6 @@ static int LookupWord (char *buff)
}
}
- for (tp = TimezoneTable; tp->name; tp++)
- if (streq(buff, tp->name))
- {
- yylval.Number = tp->value;
- return tp->type;
- }
-
- if (streq(buff, "dst"))
- return tDST;
-
for (tp = UnitsTable; tp->name; tp++)
if (streq(buff, tp->name))
{
@@ -708,32 +585,6 @@ static int LookupWord (char *buff)
return tp->type;
}
- /* Military timezones. */
- if (buff[1] == '\0' && isalpha (*buff))
- {
- for (tp = MilitaryTable; tp->name; tp++)
- if (streq(buff, tp->name))
- {
- yylval.Number = tp->value;
- return tp->type;
- }
- }
-
- /* Drop out any periods and try the timezone table again. */
- for (i = 0, p = q = buff; !streq(q, ""); q++)
- if (*q != '.')
- *p++ = *q;
- else
- i++;
- stpcpy(p, "");
- if (0 != i)
- for (tp = TimezoneTable; NULL != tp->name; tp++)
- if (streq(buff, tp->name))
- {
- yylval.Number = tp->value;
- return tp->type;
- }
-
return tID;
}
@@ -796,34 +647,14 @@ yylex (void)
#define TM_YEAR_ORIGIN 1900
-/* Yield A - B, measured in seconds. */
-static long difftm (struct tm *a, struct tm *b)
-{
- int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
- int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
- long days = (
- /* difference in day of year */
- a->tm_yday - b->tm_yday
- /* + intervening leap days */
- + ((ay >> 2) - (by >> 2))
- - (ay / 100 - by / 100)
- + ((ay / 100 >> 2) - (by / 100 >> 2))
- /* + difference in years * 365 */
- + (long) (ay - by) * 365
- );
- return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
- + (a->tm_min - b->tm_min))
- + (a->tm_sec - b->tm_sec));
-}
-
time_t get_date (const char *p, const time_t *now)
{
- struct tm tm, tm0, *tmp;
+ struct tm tm, *tmp;
time_t Start;
yyInput = p;
Start = now ? *now : time(NULL);
- tmp = localtime (&Start);
+ tmp = gmtime(&Start);
yyYear = tmp->tm_year + TM_YEAR_ORIGIN;
yyMonth = tmp->tm_mon + 1;
yyDay = tmp->tm_mday;
@@ -841,10 +672,9 @@ time_t get_date (const char *p, const time_t *now)
yyHaveDay = 0;
yyHaveRel = 0;
yyHaveTime = 0;
- yyHaveZone = 0;
if (yyparse ()
- || yyHaveTime > 1 || yyHaveZone > 1 || yyHaveDate > 1 || yyHaveDay > 1)
+ || yyHaveTime > 1 || yyHaveDate > 1 || yyHaveDay > 1)
return -1;
tm.tm_year = ToYear (yyYear) - TM_YEAR_ORIGIN + yyRelYear;
@@ -866,39 +696,12 @@ time_t get_date (const char *p, const time_t *now)
tm.tm_hour += yyRelHour;
tm.tm_min += yyRelMinutes;
tm.tm_sec += yyRelSeconds;
- tm.tm_isdst = -1;
- tm0 = tm;
+ tm.tm_isdst = 0;
- Start = mktime (&tm);
+ Start = timegm(&tm);
if (Start == (time_t) -1)
{
-
- /* Guard against falsely reporting errors near the time_t boundaries
- when parsing times in other time zones. For example, if the min
- time_t value is 1970-01-01 00:00:00 UTC and we are 8 hours ahead
- of UTC, then the min localtime value is 1970-01-01 08:00:00; if
- we apply mktime to 1970-01-01 00:00:00 we will get an error, so
- we apply mktime to 1970-01-02 08:00:00 instead and adjust the time
- zone by 24 hours to compensate. This algorithm assumes that
- there is no DST transition within a day of the time_t boundaries. */
- if (yyHaveZone)
- {
- tm = tm0;
- if (tm.tm_year <= EPOCH - TM_YEAR_ORIGIN)
- {
- tm.tm_mday++;
- yyTimezone -= 24 * 60;
- }
- else
- {
- tm.tm_mday--;
- yyTimezone += 24 * 60;
- }
- Start = mktime (&tm);
- }
-
- if (Start == (time_t) -1)
return Start;
}
@@ -906,19 +709,11 @@ time_t get_date (const char *p, const time_t *now)
{
tm.tm_mday += ((yyDayNumber - tm.tm_wday + 7) % 7
+ 7 * (yyDayOrdinal - (0 < yyDayOrdinal)));
- Start = mktime (&tm);
+ Start = timegm(&tm);
if (Start == (time_t) -1)
return Start;
}
- if (yyHaveZone)
- {
- long delta = yyTimezone * 60L + difftm (&tm, gmtime (&Start));
- if ((Start + delta < Start) != (delta < 0))
- return -1; /* time_t overflow */
- Start += delta;
- }
-
return Start;
}
@@ -1,31 +0,0 @@
From: Marc Haber <mh+debian-packages@zugschlus.de>
Date: Thu, 5 Dec 2024 18:54:17 +0100
Subject: man/useradd.8.xml: Document new exit code 19 (E_BAD_NAME)
Link: <https://github.com/shadow-maint/shadow/issues/1103>
Link: <https://github.com/shadow-maint/shadow/pull/1141>
Signed-off-by: Marc 'Zugschlus' Haber <mh+githubvisible@zugschlus.de>
Cc: Chris Hofstaedtler <zeha@debian.org>
Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
man/useradd.8.xml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/man/useradd.8.xml b/man/useradd.8.xml
index 17987a6..dbdd9b1 100644
--- a/man/useradd.8.xml
+++ b/man/useradd.8.xml
@@ -898,6 +898,12 @@
<para>can't update SELinux user mapping</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><replaceable>19</replaceable></term>
+ <listitem>
+ <para>invalid user or group name</para>
+ </listitem>
+ </varlistentry>
</variablelist>
</para>
</refsect1>