From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4270 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH 0/2] Implement fgetspent Date: Sat, 23 Nov 2013 16:08:16 -0500 Message-ID: <20131123210816.GY24286@brightrain.aerifal.cx> References: <1385003621-10289-1-git-send-email-mforney@mforney.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1385240908 26926 80.91.229.3 (23 Nov 2013 21:08:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Nov 2013 21:08:28 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4274-gllmg-musl=m.gmane.org@lists.openwall.com Sat Nov 23 22:08:32 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1VkKRM-00022Z-4B for gllmg-musl@plane.gmane.org; Sat, 23 Nov 2013 22:08:32 +0100 Original-Received: (qmail 10095 invoked by uid 550); 23 Nov 2013 21:08:29 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 10087 invoked from network); 23 Nov 2013 21:08:29 -0000 Content-Disposition: inline In-Reply-To: <1385003621-10289-1-git-send-email-mforney@mforney.org> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4270 Archived-At: On Wed, Nov 20, 2013 at 07:13:39PM -0800, Michael Forney wrote: > Hi Rich, > > It turns out that one more function, fgetspent, is needed for the common > shadow+pam_unix setup used in many desktop systems. Otherwise, when > changing your password, pam_unix will attempt to enumerate through the > shadow entries with fgetspent, rewriting them as it goes (and replacing > the entry to be updated). This leaves you with a shadow file containing > only the updated entry. > > In the first patch, I moved spent parsing to an internal function, > __parsespent. I opted to use __parsespent instead of __getspent_a > (similar to the passwd and group functions) for several reasons: > > - To minimize the changes necessary to getspnam_r > - To avoid the extra memcpy as in getpw_r > - It seemed like a more self-contained function (which didn't rely > on the source of the entry). > - It would make it easier to implement sgetspent if we ever wanted > that (though, so far, I haven't found anything that requires this) > > However, if this is not desired, I can send a new patch which uses a > function __getspent_a, similar to __get{pw,gr}ent_a. Overall I like this, but I don't see any advantage to putting __parsespent in a separate file. On the surface it appears to reduce dependencies for static linking, but any real-world use of fgetspent would already depend on most of the functions getspnam_r depends on. On the other hand, each additional file contributes to build time, static library size (from elf header overhead), and potentially hitting the command line limits on the ar/ld command lines. If you don't have any objections, how about leaving the parsing code in getspnam_r.c and only adding a new file for fgetspent? Rich