This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: [RFC] per-user ~/.hosts file
- From: Raphaël Droz <raphael dot droz+floss at gmail dot com>
- To: libc-help at sourceware dot org
- Date: Thu, 27 Oct 2011 09:10:49 +0200
- Subject: Re: [RFC] per-user ~/.hosts file
- References: <20110311132456.GA7398@b1b1.lan>
simple ping as no answer given yet to this message:
( http://sourceware.org/ml/libc-help/2011-03/msg00002.html )
On Fri, Mar 11, 2011 at 02:24:58PM +0100, Raphaël Droz wrote:
> Hello,
>
> I started working on a nss library aimed to resolve hostnames according to
> a user "hosts" file (in $HOME/.hosts) [1]
>
> Of course, one has to be root to change /etc/nsswitch.conf in order to
> use a ~/.hosts file so the real use is limited
> (the reason why such code never landed on the ML before today :p ?)
>
> Anyway it may be useful for completion, to easily give aliases to
> friends during ad-hoc lan-parties or when rsync'ing its home between
> several machines (while keeping host aliases) and... it may be seen as a
> didactic step in setting-up per-user dns :)
>
>
> In this attempt to reuse the /etc/hosts parser, I ended up with a
> copy of some files from glibc/nss/ and a patch (attached) [2]
>
> Other than that, there is just a map-file and two functions which just
> call glibc ones.
>
> What I would really like now are advises on how I may have played nicer
> with the glibc. I was a bit disappointed when I realized I was not able
> to really use shared libraries.
>
> Why glibc #defines DATAFILE, is it for performance reasons only ?
> simplicity ? Would it be an enhancement to make this "files-XXX"
> nss-databases related functions more reusable ?
>
>
> Thank you in advance for reviews and suggestions.
>
>
> Raphaël
>
>
>
> [1] http://gitorious.org/nss-dothosts/nss-hostslocal/trees/master
> As stated in the README I took the liberty to use the "template"
> initially provided on https://github.com/apetresc/nss-hostslocal
>
> [2] generated from git diff 63d53..HEAD glibc/*.*
> The files come from glibc 2.11.2