util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lslogins: Fix discrepancies of SYS_UID_MIN
@ 2019-04-24  4:03 Stanislav Brabec
  2019-04-24  9:36 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Stanislav Brabec @ 2019-04-24  4:03 UTC (permalink / raw)
  To: util-linux

util-linux does not contain useradd. Its most popular implementation
comes from shadow. SYS_UID_MIN is one of common parameters. Its hardcoded
fallback value is equal to 101 in shadow useradd (see
shadow-4.6/libmisc/find_new_uid.c: get_ranges()), but 201 in
login-utils/lslogins.c.

Let lslogins use the same fallback as useradd from shadow.

Hopefully most distros define its custom value of SYS_UID_MIN in
/etc/login.defs, so this problem is not visible.

login-utils/lslogins.1 does not mention its default at all. Add a
reference and improve text of lslogins(1) to prevent off-by-one
interpretation.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
---
 login-utils/lslogins.1 | 6 +++---
 login-utils/lslogins.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/login-utils/lslogins.1 b/login-utils/lslogins.1
index 5aa14c706..857d2dffd 100644
--- a/login-utils/lslogins.1
+++ b/login-utils/lslogins.1
@@ -92,9 +92,9 @@ Display information related to login by password (see
also \fB\-afL).
 Raw output (no columnation).
 .TP
 \fB\-s\fR, \fB\-\-system\-accs\fR
-Show system accounts.  These are by default all accounts with a UID
below 1000
-(non-inclusive), with the exception of either nobody or nfsnobody (UID
65534).
-This hardcoded default maybe overwritten by parameters SYS_UID_MIN and
SYS_UID_MAX in
+Show system accounts.  These are by default all accounts with a UID
between 101 and 999
+(inclusive), with the exception of either nobody or nfsnobody (UID 65534).
+This hardcoded default may be overwritten by parameters SYS_UID_MIN and
SYS_UID_MAX in
 the file /etc/login.defs.
 .TP
 \fB\-\-time\-format\fR \fItype\fP
diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c
index c913cf2d8..0c558f24f 100644
--- a/login-utils/lslogins.c
+++ b/login-utils/lslogins.c
@@ -74,7 +74,7 @@ static int lslogins_flag;
 
 #define UL_UID_MIN 1000
 #define UL_UID_MAX 60000
-#define UL_SYS_UID_MIN 201
+#define UL_SYS_UID_MIN 101
 #define UL_SYS_UID_MAX 999
 
 /* we use the value of outmode to determine
-- 
2.21.0

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                         e-mail: sbrabec@suse.com
Křižíkova 148/34 (Corso IIa)                    tel: +420 284 084 060
186 00 Praha 8-Karlín                          fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] lslogins: Fix discrepancies of SYS_UID_MIN
  2019-04-24  4:03 [PATCH] lslogins: Fix discrepancies of SYS_UID_MIN Stanislav Brabec
@ 2019-04-24  9:36 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2019-04-24  9:36 UTC (permalink / raw)
  To: Stanislav Brabec; +Cc: util-linux

On Wed, Apr 24, 2019 at 06:03:21AM +0200, Stanislav Brabec wrote:
>  login-utils/lslogins.1 | 6 +++---
>  login-utils/lslogins.c | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)

Applied (manually, patch has been malformed by your email client),
thanks!

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-24  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-24  4:03 [PATCH] lslogins: Fix discrepancies of SYS_UID_MIN Stanislav Brabec
2019-04-24  9:36 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).