Subject: Re: Fwd: libc without YP
To: Luke Mewburn <lukem@NetBSD.org>
From: Greg A. Woods <woods@weird.com>
List: tech-toolchain
Date: 11/28/2003 03:09:02
[ On Friday, November 28, 2003 at 08:19:32 (+1100), Luke Mewburn wrote: ]
> Subject: Re: Fwd: libc without YP
>
> Some points:
>
> * The compat routine needs to exist _especially_ in the default
> case, since the default for passwd: is "compat".
Well, no, not for me it's not! ;-)
If I'm not mistaken the comments in my updated template nsswitch.conf
correctly reflect the implemenation as I build it:
$ cat /usr/src/etc/nsswitch.conf
# $NetBSD: nsswitch.conf,v 1.5 1999/10/24 12:36:52 lukem Exp $
#
# nsswitch.conf(5) -
# name service switch configuration file
#
# NOTE: rename or remove this file if you're not changing anything in it
# These are the defaults in libc
#
#group: files
#hosts: files dns
#networks: files dns
#passwd: files
#shells: files
# List of supported sources for each database
#
# group: files
# hosts: dns, files
# networks: dns, files
# passwd: files
# shells: files
On i386:
$ size getpwent.o
text data bss dec hex filename
1300 0 96 1396 574 getpwent.o
$ nm getpwent.o
000002dc t __hashpw
00000254 t __initdb
U _dbopen
00000224 T _endpwent
00000134 T _getpwent
0000016c T _getpwnam
000001b8 T _getpwuid
00000000 t _local_getpw
U _nsdispatch
00000048 b _pw_db
00000054 b _pw_flags
0000004c b _pw_keynum
00000020 b _pw_passwd
00000050 b _pw_stayopen
000001f4 T _setpassent
00000210 T _setpwent
U _syslog
U abort
00000008 b buf.38
00000000 r compatsrc
00000018 r dtab.12
00000040 r dtab.16
00000064 r dtab.20
00000224 W endpwent
U free
U geteuid
00000134 W getpwent
0000016c W getpwnam
000001b8 W getpwuid
00000004 b max.37
U memmove
U realloc
000001f4 W setpassent
00000210 W setpwent
00000000 b warned.33
> * There is no point doing
> #ifdef YP
> NS_NIS_CB(_nis_getpw, NULL)
> #endif
> since the definition for NS_NIS_CB() already does the right
> thing if YP isn't defined. (See <nsswitch.h>)
I'm not sure if I noticed this, or whether I just thought it was too
much magic to depend upon. I'm not sure what to think now.
> * The compat code is for more than just YP (it's also for HESIOD),
> so doing
> #ifdef YP
> NS_NIS_CB(_nis_getpw, NULL)
> NS_COMPAT_CB(_compat_getpwent, NULL)
> #endif
> is not correct _anyway_.
Yes, well, given I turn off both HESIOD and YP, I don't want any of it
wasting time and space for me. I should have noted that....
This, and probably more places, might be fixed to allow HESOID without
YP and vice versa with a judiciously placed #ifdef _PASSWD_COMPAT
All the #ifdef's elsewhere still get really rather ugly though, even
with the magic disappearing act in those macros.
> * We generally try to avoid "whitespace cleanups" in the same
> commit as "functionality changes".
Yeah, well I sure as heck wasn't going to edit my local changes just to
undo cleanups that were in the same diff hunks. I was even going to
leave in the isolated hunks containing whitespace cleanups too, but in
the end I whacked them out.
> * "cvs diff -p" is our friend :-)
Hmmmm.....
> In short, I don't think this diff is necessary or correct.
I guess it's correct for all combinations of -D defines, but it sure
works well for me! ;-)
Without my changes the size of the resulting code is not sufficiently
reduced to meet my goals. I really only need/want "hosts" and
"networks" sources to be configurable though even those I don't really
expect to have to change on any production server.
--
Greg A. Woods
+1 416 218-0098 VE3TCP RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com> Secrets of the Weird <woods@weird.com>