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").
.



Relevant Pages

  • Re: Why is the pointer passed into the function still NULL?
    ... The routine can modify those named parameters, ... void get_table (char ** table) { ...
    (comp.lang.c)
  • Re: why the usage of gets() is dangerous.
    ... routine receives a char, and answere with 'this is lower case'. ... Assuming the original data is a string, the calling routine will ... No, a pointer to char was passed, and that is a pointer to a byte within a larger object. ... So go back to DOS because the memory protection in Windows does not work all the time, get rid of lifeboats from cruise ships because sometimes they fail and so on. ...
    (comp.lang.c)
  • Exception raised in GCI subroutine: Access Violation
    ... The routine aborts with an 'Exception raised inGCIsubroutine: ... int (since theGCIwon't support BOOL) ... I char* ... I BOOL (ditto) ...
    (comp.databases.pick)
  • Re: Why Case Sensitive?
    ... Now I could write a custom routine that would parse the options and extract the filenames. ... char *ramaangleset; ... However normally I would expect to control the options format myself. ...
    (comp.lang.c)
  • Re: SSH on armv5tel: "You dont exist, go away!"
    ... On Apr 17, 12:57 am, Steven Mocking ... corresponding line for your userid in /etc/passwd ... same routine provided by BusyBox is working correctly but when a call ... getpwuid within the SSH source code with a call to a working routine ...
    (comp.security.ssh)