[384] in Hesiod
glibc-2.1 nss_hesiod.so fails UID/GID lookups
daemon@ATHENA.MIT.EDU (Troy Benjegerdes)
Mon May 10 13:53:13 1999
Date: Mon, 10 May 1999 12:52:13 -0500 (CDT)
From: Troy Benjegerdes <hozer@drgw.net>
To: hesiod@MIT.EDU, Mark Kettenis <kettenis@delius.kettenis.nl>
Message-Id: <Pine.LNX.4.04.9905101240250.7827-100000@narn.local.drgw.net>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
I followed the directions in README.hesiod that came with glibc-2.1.1, and
set up a nameserver, etc. However, UID and GID lookups don't work.
This occurs on both PPC and Intel systems. (The intel box is running
Red Hat 6.0).
'getpwnam' works fine, but 'getpwuid' does not. I modified 'whoami.c' to
test this out, and have done a little bit GDB tracing in glibc, but I have
decided it would be more productive to ask someone than to try and figure
it out myself.
(getpwnam generates the correct DNS lookup, while getpwuid generates
nothing, as far as I can tell)
#include <sys/types.h>
#include <pwd.h>
#include <getopt.h>
#include "system.h"
/* The name this program was run with. */
char *program_name;
int
main (int argc, char **argv)
{
register struct passwd *pw;
register uid_t uid;
int c;
pw = getpwnam("troy");
if (pw){
printf("uid= %d\n", pw->pw_uid);
} else {
printf("no UID for 'troy'\n");
exit (1);
}
uid = pw->pw_uid;
pw = getpwuid (uid);
if (pw)
{
puts (pw->pw_name);
exit (0);
}
fprintf (stderr, _("%s: cannot find username for UID %u\n"),
program_name, (unsigned) uid);
exit (1);
}
--------------------------------------------------------------------------
| Troy Benjegerdes | troy@microux.com | hozer@drgw.net |
| Unix is user friendly... You just have to be friendly to it first. |
| This message composed with 100% free software. http://www.gnu.org |
--------------------------------------------------------------------------