This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] per-user ~/.hosts file


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

Attachment: nss.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]