mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH 0/2] Implement fgetspent
@ 2013-11-21  3:13 Michael Forney
  2013-11-21  3:13 ` [PATCH 1/2] shadow: Move spent parsing to internal function Michael Forney
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Michael Forney @ 2013-11-21  3:13 UTC (permalink / raw)
  To: musl

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.

Michael Forney (2):
  shadow: Move spent parsing to internal function
  shadow: Implement fgetspent

 src/passwd/fgetspent.c  | 11 ++++++++++-
 src/passwd/getspnam_r.c | 34 +---------------------------------
 src/passwd/parsespent.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 src/passwd/pwf.h        |  2 +-
 4 files changed, 54 insertions(+), 35 deletions(-)
 create mode 100644 src/passwd/parsespent.c

-- 
1.8.4.2



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-11-24  6:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-21  3:13 [PATCH 0/2] Implement fgetspent 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 ` [PATCH 0/2] " Rich Felker

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).