mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: [PATCH 0/2] Implement fgetspent
Date: Sat, 23 Nov 2013 16:08:16 -0500	[thread overview]
Message-ID: <20131123210816.GY24286@brightrain.aerifal.cx> (raw)
In-Reply-To: <1385003621-10289-1-git-send-email-mforney@mforney.org>

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


      parent reply	other threads:[~2013-11-23 21:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21  3:13 Michael Forney
2013-11-21  3:13 ` [PATCH 1/2] shadow: Move spent parsing to internal function Michael Forney
2013-11-24  6:17   ` [PATCH v2 " Michael Forney
2013-11-21  3:13 ` [PATCH 2/2] shadow: Implement fgetspent Michael Forney
2013-11-23 21:08 ` Rich Felker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131123210816.GY24286@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).