Bug#93362: getpwuid() doesn't work
Package: boot-floppies
Version: N/A; reported 2001-04-09
Severity: critical
This is the root cause of the 'id -u' problem. I don't believe the problem is
with busybox, I think we are missing something on our filesystem, a library, a
config file, I don't know which.
At the end of this messages I have a program that demonstrates the problem.
Test it on a working system and you get something like:
# ./a.out
you are root
#
Test it is a chroot'ed root.bin[1] and you get:
# ./a.out
failure.
#
#include <stdlib.h>
#include <pwd.h>
#include<sys/types.h>
#include <stdio.h>
int
main ()
{
struct passwd *myuser;
myuser = getpwuid (0);
if (myuser != NULL)
printf ("you are %s\n", myuser->pw_name);
else
printf ("failure.\n");
return 0;
}
[1] : What I mean by a chroot'ed root.bin is something like this:
# gunzip -c -S "" root.bin > root.ext2
# mount root.ext2 /mnt/chroot/ -t ext2 -o loop
# cd /mnt/chroot/
# chroot . bin/sh
-- System Information
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux ruff 2.2.17 #2 Sat Dec 30 11:46:38 PST 2000 i686
Reply to: