Re: SSH on armv5tel: "You don't exist, go away!"



maurizio.crozzoli@xxxxxxxxx schreef:
In fact we have verified that the problem is related to the routinne
you suggest: getpwuid. We have verified that the implementation of the
same routine provided by BusyBox is working correctly but when a call
to that routine comes from outside BB we get an error: we have to
think of another implmentation (bugged!!!) that is called from the
rest of the system outside BB which is self-consistent.

Weird. Maybe you could get some more clues by compiling the following on that machine with "gcc -o getpwuidtest -g /path/to/code.c":

===CUT===
#include <stdlib.h>
#include <stdio.h>
#include <pwd.h>
#include <errno.h>
#include <sys/types.h>

char *explainError(int num);

int main(int argc, char **argv)
{
struct passwd *user_root = getpwuid(0);
if(!user_root)
{
printf("Errno: %d\n", errno);
printf("Desc: %s", explainError(errno));
exit(1);
}
struct passwd *user_me = getpwuid(getuid());
if(!user_me)
{
printf("Errno: %d\n", errno);
printf("Descr: %s\n", explainError(errno));
exit(2);
}
printf("All is well\n");
return 0;
}

char *explainError(int num)
{
char *errstr;

switch(num)
{
case 0:
return ("User not found");
case EINTR:
return ("A signal was caught.");
case EIO:
return ("I/O error.");
case EMFILE:
return ("The maximum number of files was open already in the calling \
process.");
case ENFILE:
return ("The maximum number of files was open already in the system.");
case ENOMEM:
return ("Insufficient memory to allocate passwd structure.");
case ERANGE:
return ("Insufficient buffer space supplied.");
case EPERM:
return ("EPERM");
case EBADF:
return ("EBADF");
case ESRCH:
return ("ESRCH");
case ENOENT:
return ("ENOENT");
default:
sprintf(errstr, "Unknown error: %d", num);
return errstr;
}
}
===END CUT===

Disclaimer: code crufted up in <10 minutes and only used once on one machine (also to debug ssh).

If you run ./getpwuidtest, you should see what goes wrong with getpwuid. If nothing goes wrong, the linking is probably incorrect.

We do not know where the bugged routine is within the whole system, we
just can suppose it should be inside a lib file. Any suggestion would
be greatly appreciated...

It's in glibc (aka the library file /lib/ld-linux.so.2). I strongly recommend against trying to compile/install this yourself without using a package manager, though.

For the time being we are planning to find&replace each call to
getpwuid within the SSH source code with a call to a working routine
such as the one derived from BB.

BusyBox, like almost every linux binary, is almost certainly also compiled against glibc on your system (confirm this with "ldd /path/to/busybox").
.