mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: Design for extensible passwd[/shadow?] db support
Date: Mon, 13 Aug 2012 15:50:32 -0400	[thread overview]
Message-ID: <20120813195032.GZ27715@brightrain.aerifal.cx> (raw)
In-Reply-To: <58cedf3a99d2a7eb61d861abdb8c1840@exys.org>

On Mon, Aug 13, 2012 at 09:38:57PM +0200, Arvid E. Picciani wrote:
> On Mon, 13 Aug 2012 15:28:33 -0400, Rich Felker wrote:
> 
> >It reads it because ls -l prints the owners of files, and seeing a
> >username rather than a number is a lot more informative.
> 
> Oh yeah. Now it would be really horrible to have it build up an ldap
> connection each time you do "ls". People do that in tight loops in
> scripts
> and expect it to have semi-guaranteed runtime properties.

It only does the lookup with -l, and good implementations of ls will
cache the last user lookup (or maybe the last N for some large value
of N) to avoid being slow. Keep in mind, even without any remote
query, getpwuid_r has to parse the entire /etc/passwd file every time
it's called, which is not fast, so apps have a good reason to be doing
caching already.

glibc has a solution for this problem in the form of nscd, one of the
other solutions I proposed. It's a daemon whose purpose was just to
cache lookup results, but since the lookups are performed in the
daemon rather than the client, it could also be used as a translating
proxy to add support for arbitrary backends/protocols.

I have no idea how ugly the nscd protocol is, but if it's clean, I
think we could simply adopt it. musl-native systems would of course
need a new nscd (since the original one is part of glibc and depends
on the libnss mess) but musl binaries running on glibc systems could
even use the existing host nscd. Anyway, to determine if this solution
makes sense, somebody needs to do a bit of research into the nscd
protocol and how bad it is...

> Can we at least have compile-time modules for this, so a
> system-designer
> can choose between different implementations? Maybe then having ldab
> in there
> directly isn't so bad at all. Hidding away the ldap problems in another
> daemon sounds like an attempt to make a one-size-fits-all.

The problem with this is when you copy or static-linked busybox onto a
system that needs non-flat-file user lookups, and it fails to work
right...

I'm actually interesting in making _some_ features in musl
compile-time switchable, but only when they have a large size impact
that would affect really tiny embedded usage. The only examples that
come to mind so far are iconv charsets and crypt hashes. And in this
case, the option would not be to remove the interfaces entirely, only
to remove support for unneeded charsets (in the case of iconv) or
unneeded hashes (in the case of crypt).

I don't think removing ~50 lines of passwd entry lookup code would be
of much benefit for cutting down size, whereas every switch is an
addtional complexity cost (e.g. for cases that must be tested).

Rich


  reply	other threads:[~2012-08-13 19:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-12  5:38 Rich Felker
2012-08-12 15:16 ` Jeremy Huntwork
2012-08-12 17:27   ` Rich Felker
2012-08-12 17:34 ` Rich Felker
2012-08-12 19:10 ` Arvid E. Picciani
2012-08-12 20:56   ` Rich Felker
2012-08-13  9:41     ` Arvid E. Picciani
2012-08-13 12:27       ` Luca Barbato
2012-08-13 12:46         ` Kurt H Maier
2012-08-13 13:50       ` Rich Felker
2012-08-13 19:22         ` Arvid E. Picciani
2012-08-13 19:28           ` Rich Felker
2012-08-13 19:38             ` Arvid E. Picciani
2012-08-13 19:50               ` Rich Felker [this message]
2012-08-13 20:14                 ` Arvid E. Picciani
2012-08-13 21:03                   ` Rich Felker
2012-08-13 22:10                 ` Luca Barbato
2012-08-13  0:26 idunham
2012-08-13  0:31 ` Rich Felker
2012-08-13 10:45   ` Daniel Cegiełka
2012-08-13 13:46     ` Rich Felker

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=20120813195032.GZ27715@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).