[BusyBox] OpenSSH on BusyBox

Vladimir N. Oleynik dzo at simtreas.ru
Wed Dec 18 08:25:12 UTC 2002


Nick Fedchik wrote:
> 
> On Wed, 18 Dec 2002, Vladimir N. Oleynik wrote:
> 
> > Nick,
> I change the code fragmet to debug, but it was useless:
>         /* Get user data. */
>         pw = getpwuid(original_real_uid);
>         if (!pw) {
>                 log("You don't exist, go away!");
>                 exit(1);
>         }
> 
> ~ # ssh
> getpwuid: Success
> You don't exist, go away!
> 
> > On target presend?
> > /etc/nsswitch.conf on target presend?
> # /etc/nsswitch.conf
> passwd:         file
> group:          file
> shadow:         file
> hosts:          file
> 
> > > and IADM all getXXent is inside the libnss_files-2.2.5.so.
> > > Also see `ldd ssh' output in one of my prev msgs.
> > ldd can`t show dynamic loaded library in runtime
> ~ # ltrace ssh
> __libc_start_main(0x0804b710, 1, 0xbffffed4, 0x0804a6b0, 0x0806fb90
> <unfinished>SSLeay(0, 0, 0xbffffe68, 0x0804b737, 0xbfffff8a)  = 0x0090608f
> getuid(0, 0, 0xbffffe68, 0x0804b737, 0xbfffff8a)  = 0
> geteuid(0, 0, 0xbffffe68, 0x0804b737, 0xbfffff8a) = 0
> getuid(0xbfffff8a, 0, 0, 0xbffffd2c, 0)           = 0
> geteuid(0xbfffff8a, 0, 0, 0xbffffd2c, 0)          = 0
> __errno_location(0xbfffff8a, 0, 0, 0xbffffd2c, 0) = 0x4026b540
> seteuid(0, 0, 0, 0xbffffd2c, 0)                   = 0
> getpwuid(0, 0, 0, 0xbffffd2c, 0)                  = 0
> __errno_location(0, 0, 0, 0xbffffd2c, 0)          = 0x4026b540
> strerror(0, 0, 0, 0xbffffd2c, 0)                  = 0x402614f8
> vsnprintf(0xbffff860, 1024, 0x08070ffe, 0xbffffca4, 0) = 17
> fprintf(0x402682c0, 0x0807560b, 0xbffff860, 6, 0getpwuid: Success
> ) = 19
> vsnprintf(0xbffff860, 1024, 0x080711c8, 0xbffffca4, 0) = 25
> fprintf(0x402682c0, 0x0807560b, 0xbffff860, 6, 0You don't exist, go away!
> ) = 27
> exit(1, 0x402614f8, 0, 0xbffffd2c, 0 <unfinished ...>
> +++ exited (status 1) +++

Hmm. 
You can see approximately this line also:

open("/etc/nsswitch.conf", O_RDONLY)    = 3
fstat(3, {...})                         = 0
mmap()                                  = 0x124000
read(3, "#\n# /etc/nsswitch.conf\n#\n# An"..., 4096) = 1204
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0x124000, 4096)                  = 0
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat(3, {...})                         = 0
mmap()                                  = 0x124000
close(3)                                = 0
open("/lib/libnss_files.so.2", O_RDONLY) = 3
fstat(3, {st_mode=03, st_size=62, ...}) = 0
read(3, "\3\0\0\0\320\0\0\0\332\0\0\0\3\0"..., 4096) = 4096
mmap(0x12a, 3, PROT_READ|PROT_WRITE|PROT_EXEC|0x140, 0x5 /* MAP_???
*/|MAP_FIXED|MAP_GROWSDOWN|
0x40, 3, 0x168) = 0x257000
mprotect(0x25e000, 3684, PROT_NONE)     = 0
mmap(0x174, 3, PROT_READ|PROT_EXEC|0x180,
MAP_SHARED|MAP_FIXED|MAP_GROWSDOWN|0x80, 3, 0x1a2) =
0x25e000
close(3)                                = 0
munmap(0x124000, 20359)                 = 0
open("/etc/passwd", O_RDONLY)           = 3
fcntl(3, F_GETFD)                       = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
fstat(3, {...})                         = 0
mmap()                                  = 0x124000
read(3, "root:x:0:0::/root:/bin/bash\nbin"..., 4096) = 977
close(3)                                = 0

....



--w
vodz



More information about the busybox mailing list