Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jul 2002 13:08:51 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Ruslan Ermilov <ru@FreeBSD.ORG>
Cc:        current@FreeBSD.ORG, net@FreeBSD.ORG
Subject:   Re: NIS and getpwent(3)
Message-ID:  <20020730180851.GC95493@dan.emsphone.com>
In-Reply-To: <20020730160931.GA27626@sunbay.com>
References:  <20020730160931.GA27626@sunbay.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Jul 30), Ruslan Ermilov said:
> [Sorry for x-posting, not sure where this is more relevant.]
> 
> I have hit the following nasty problem with
> /etc/periodic/daily/300.calendar while using NIS.  We have our NIS
> database distributed with all shells switched off to /sbin/nologin,
> and overriding shells as necessary on machines where we need it. 
> Something like this:
> 
> +ru:::::::::/bin/tcsh
> +:::::::::
> 
> The problem is that the "ru" entry is reported by getpwent(3) twice,
> first with /bin/tcsh shell, and second with the /sbin/nologin shell.
> The net effect is that you get your calendar mail twice.
> 
> Is this the correct behavior of getpwent(3), and then what do we do
> with calendar(1), or getpwent(3) is in trouble?  (I've checked that
> on both 4.x and 5.0.)

It looks like the correct behaviour.  The nsswitch.conf manpage on
FreeBSD actually mentions the possibility of duplication, and I've seen
it on BSD, Tru64, Solaris, and Linux.  The Solaris manpages for
getpwnam and nsswitch.conf say that getpwent+nswwitch is inefficient
and is discouraged, but they don't suggest any alternatives.

http://docs.sun.com/?q=getpwent&p=/doc/816-0213/6m6ne381v&a=view
http://docs.sun.com/?q=getpwent&p=/doc/816-0219/6m6njqbaf&a=view

I guess the best solution would be to keep a list of uids that have
already been processed by calendar, and ignore duplicates.

-- 
	Dan Nelson
	dnelson@allantgroup.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020730180851.GC95493>