Subject: lib/25504: login_cap(): sbsize is of type size not number
To: None <gnats-bugs@gnats.NetBSD.org>
From: Christian Biere <christianbiere@gmx.de>
List: netbsd-bugs
Date: 05/09/2004 01:40:00
>Number:         25504
>Category:       lib
>Synopsis:       login_cap(): sbsize is of type size not number
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 08 23:41:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Christian Biere
>Release:        NetBSD 2.0E
>Organization:
>Environment:
System: NetBSD cyclonus 2.0E NetBSD 2.0E (STARSCREAM) #0: Sat Apr 24 19:43:57 CEST 2004 bin@cyclonus:/usr/obj/sys/arch/i386/compile/STARSCREAM i386
Architecture: i386
Machine: i386
>Description:
login.conf(5) claims that sbsize is of type size but the actual code uses
type number which means it doesn't like the suffix after the value e.g.,
k for Kibi, m for Mibi etc. This bug was fixed a couple of years ago in
FreeBSD and introduced in NetBSD a few weeks ago. ;) It's unlikely that
many people use this because it isn't really explained in the manpages
AFAICS.

>How-To-Repeat:
Add :sbsize=16m: to a class in /etc/login.conf and start a session of
that class. Note the warnings in /var/log/authlog and that ulimit -a
still shows unlimited for the sbsize resource.

>Fix:

I haven't tested the following but I think it's sufficient.

Index: login_cap.c
===================================================================
RCS file: /cvsroot/src/lib/libutil/login_cap.c,v
retrieving revision 1.17
diff -u -u -r1.17 login_cap.c
--- login_cap.c	23 Apr 2004 15:23:26 -0000	1.17
+++ login_cap.c	8 May 2004 23:24:45 -0000
@@ -425,7 +425,7 @@
 	{ RLIMIT_NPROC,		R_CNUMB, "maxproc", },
 	{ RLIMIT_NOFILE,	R_CNUMB, "openfiles", },
 	{ RLIMIT_CORE,		R_CSIZE, "coredumpsize", },
-	{ RLIMIT_SBSIZE,	R_CNUMB, "sbsize", },
+	{ RLIMIT_SBSIZE,	R_CSIZE, "sbsize", },
 	{ -1, 0, 0 }
 };
 
>Release-Note:
>Audit-Trail:
>Unformatted: