NetBSD Problem Report #32591

From juan@xtrarom.org  Sun Jan 22 09:04:16 2006
Return-Path: <juan@xtrarom.org>
Received: from xtrarom.org (unknown [84.77.240.0])
	by narn.netbsd.org (Postfix) with ESMTP id B1D0363B90E
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 22 Jan 2006 09:04:14 +0000 (UTC)
Message-Id: <20060122090413.6E211C985@xtrarom.org>
Date: Sun, 22 Jan 2006 10:04:13 +0100 (CET)
From: juan@xtrarom.org
Reply-To: juan@xtrarom.org
To: gnats-bugs@netbsd.org
Subject: cap_mkdb(1) does not update properly db files?
X-Send-Pr-Version: 3.95

>Number:         32591
>Category:       bin
>Synopsis:       cap_mkdb(1) does not update properly db files?
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 22 09:05:00 +0000 2006
>Closed-Date:    Sat Nov 02 19:41:27 +0000 2013
>Last-Modified:  Sat Nov 02 19:41:27 +0000 2013
>Originator:     Juan RP
>Release:        NetBSD 3.99.15
>Organization:
dunno
>Environment:
System: NetBSD Nocturno 3.99.15 NetBSD 3.99.15 (Nocturno) #445: Sun Jan 22 09:31:27 CET 2006 juan@Nocturno:/home/juan/build/obj/sys/arch/i386/compile/Nocturno i386
Architecture: i386
Machine: i386
>Description:

1) We must create one class for login.conf, like this:

fooclass:fooclassdescr:\
        :maxproc=12:\
        :shell=/bin/sh:

2) Assign the new class to a random user:

$ usermod -L fooclass user

3) cap_mkdb /etc/login.conf
4) the user will log in with the shell /bin/sh.
5) modify /etc/login.conf and try to change the shell to /bin/ksh.
6) cap_mkdb /etc/login.conf again.
7) log in with the user and it will have the same shell as before.

Conclussion: cap_mkdb won't update the /etc/login.conf.db with
the new changes.

>How-To-Repeat:

	goto 1
>Fix:

>Release-Note:

>Audit-Trail:
From: Christoph Badura <bad@bsd.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/32591: cap_mkdb(1) does not update properly db files?
Date: Thu, 4 Sep 2008 00:49:08 +0200

 I noticed the same problme today with a simpler setup.
 I just added "datasize=384m" to the default class.  And ran
 "cap_mkdb /etc/login.conf".

 I see this under NetBSD 3.1/i386 but the bug seems to be present in all
 versions.

 There was an attempt to work around this in rev 1.22 of cap_mkdb.c but
 that handles only the case where the name of the output file is derived from
 the first input file and the ".db" file doesn't exist already.

 When the ".db" file does exist the following happens:

 cap_mkdb keeps calling cgetnext() to parse the input files.
 cgetnext() calls getent() internally passing the names of the input files
 as the db_array parameter and -1 as the fd parameter.  This causes getent()
 to iterate over the db_array file names and opening them, trying to dbopen
 the ".db" version first.  When it succeeds to open the ".db" it seem to
 pull out the old record for the current key and that will be stored in the
 new ".db" file hence preventing changes to existing records.

 The proper fix is to prevent getent() from opening the ".db" files for the
 input files of cap_mkdb when being called from cap_mkdb.

 How to repeat:

 echo "foo:bar" >/tmp/foo
 cap_mkdb /tmp/foo
 db -NSb hash /tmp/foo.db
 echo "foo:baz" >/tmp/foo
 cap_mkdb /tmp/foo
 db -NSb hash /tmp/foo.db

 --chris

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/32591 CVS commit: src/usr.bin/cap_mkdb
Date: Tue, 26 Mar 2013 16:58:35 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Tue Mar 26 20:58:35 UTC 2013

 Modified Files:
 	src/usr.bin/cap_mkdb: cap_mkdb.c

 Log Message:
 PR/32591: JuanRP: Also remove the file we are going to be building to prevent
 it from being used as input.


 To generate a diff of this commit:
 cvs rdiff -u -r1.28 -r1.29 src/usr.bin/cap_mkdb/cap_mkdb.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/32591 CVS commit: [netbsd-6] src/usr.bin/cap_mkdb
Date: Sun, 31 Mar 2013 20:39:39 +0000

 Module Name:	src
 Committed By:	riz
 Date:		Sun Mar 31 20:39:39 UTC 2013

 Modified Files:
 	src/usr.bin/cap_mkdb [netbsd-6]: cap_mkdb.c

 Log Message:
 Pull up following revision(s) (requested by gdt in ticket #858):
 	usr.bin/cap_mkdb/cap_mkdb.c: revision 1.28
 	usr.bin/cap_mkdb/cap_mkdb.c: revision 1.29
 Move assignment out of assertion in cap_mkdb.
 PR/32591: JuanRP: Also remove the file we are going to be building to prevent
 it from being used as input.


 To generate a diff of this commit:
 cvs rdiff -u -r1.27 -r1.27.4.1 src/usr.bin/cap_mkdb/cap_mkdb.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 07 Oct 2013 04:35:12 +0000
State-Changed-Why:
Is this fixed?


State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 02 Nov 2013 19:41:27 +0000
State-Changed-Why:
Submitter's mail is bouncing; I could try to rake up a newer address, but
I think we can jsut conclude this is fixed and let it go.


>Unformatted:
 kordex@gmail.com
 gdt@NetBSD.org

 See also bin/41660, which on 2009-07-01 reports the same issue on
 netbsd-5.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.