From owner-freebsd-questions@FreeBSD.ORG Fri Jul 16 10:22:04 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC5AA1065673; Fri, 16 Jul 2010 10:22:04 +0000 (UTC) (envelope-from rehsack@googlemail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 15CEC8FC15; Fri, 16 Jul 2010 10:22:03 +0000 (UTC) Received: by bwz12 with SMTP id 12so1191506bwz.13 for ; Fri, 16 Jul 2010 03:22:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=gr4Lb6MQcfiNACCkXqZtMZqDXZ6kpyPpn0eFnBqE93Q=; b=L9LYiEPrIE5gTfmSqGikacYXMALDMSYhPfWa2P16yEgNA4G2Ca9VHeDVUb4TFrIBuh USXvTRz87Y/h97G9diWlTfIWIsyYRrpDy3p5Ck1QkAXMH6+qSuyOvBoOgTg5XyH6hjK0 ji35uKm6jKnZTA+AVwj/N+tFE61i+9NO9493I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=J6K1W5cR9lIvAmPvZjghZXMlrXAZXQo+xy0lySC+IJR2N3VUIdL5WtDR7HC532t3a6 dB2mYv4qqg6sGB/rwFsQZmXDEMubMXFENXMpMbEUGopvlltxB2hwK3xYaa7HcUxKARqO wJUZMt8mPYh+Ib6flIovOi2GXlyRI8ACMrjqg= Received: by 10.204.160.66 with SMTP id m2mr773644bkx.69.1279275722848; Fri, 16 Jul 2010 03:22:02 -0700 (PDT) Received: from waldorf.muppets.liwing.de (p4FF86EBD.dip.t-dialin.net [79.248.110.189]) by mx.google.com with ESMTPS id a11sm10314714bkc.12.2010.07.16.03.22.01 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 16 Jul 2010 03:22:02 -0700 (PDT) Message-ID: <4C4032BC.90608@netbsd.org> Date: Fri, 16 Jul 2010 10:21:48 +0000 From: Jens Rehsack User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.9) Gecko/20100409 Thunderbird/3.0.4 MIME-Version: 1.0 To: Ashish SHUKLA References: <20100715172615.GC5485@dan.emsphone.com> <86tyo0qd19.fsf@chateau.d.if> <20100716043056.GF5485@dan.emsphone.com> <86d3unrfgu.fsf@chateau.d.if> <4C401B31.4000402@netbsd.org> <8639vjrdru.fsf@chateau.d.if> <4C402689.7070005@netbsd.org> <86wrsvpx0v.fsf@chateau.d.if> In-Reply-To: <86wrsvpx0v.fsf@chateau.d.if> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Dan Nelson , freebsd-questions@freebsd.org Subject: Re: getpwent bug? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2010 10:22:04 -0000 On 07/16/10 09:59, Ashish SHUKLA wrote: > Jens Rehsack writes: >> On 07/16/10 09:12, Ashish SHUKLA wrote: >>> Jens Rehsack writes: >>> >>> [...] >>> >>>> I cached the entires - I rate setpwent as to dangerous. >>> >>> dangerous ? why ? > >> Because it modifies something - and I might not know the source. >> getpwent(3) delivers entries from yp, too (or LDAP) etc. - and >> when I call setpwent(3) for such an entry, what happens then? > >> Long explanation for: I do not know the consequences - and that's >> why I rate it dangerous as workaround. > > ,---- an excerpt from getpwent(3) [...] > `---- > > I can't see anything which says about modifying NSS database. AFAIK none of > the NSS routines allow you to write on database, you've to use the database > specific method to modify the database. You're absolutely right - I never took a deeper look, because I always was only interested to read the (user|group) data and expected setpwent to modify such an entry. A quick look into Stevens "Advanced Programming in the UNIX environment" could had enlighten myself. Sorry that I didn't RTFM carefully. Best regards and many, many thanks, Jens