Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#15769 - 28/08/2000 13:32 Why would getprotoent () fail?
hamzy
journeyman

Registered: 11/08/2000
Posts: 51
Loc: TX, USA
Hello,

I was wondering why getprotoent() fails. I am trying to figure this out because trying to get ftp to work, gives the message "ftp: ftp/tcp: unknown service"

I believe that this is coming from getprotobyname ("tcp").

both /etc/services and /etc/protocols exist and are readable:

empeg:/empeg/bin# ls -l /etc/services
-rw-r--r-- 1 0 0 12961 Feb 21 1999 /etc/services
empeg:/empeg/bin# ls -l /etc/protocols
-rw-r--r-- 1 0 0 1702 Feb 21 1999 /etc/protocols
empeg:/empeg/bin# grep ftp /etc/services 2>/dev/nul
ftp-data 20/tcp
ftp 21/tcp
tftp 69/udp
sftp 115/tcp
venus-se 2431/udp # udp sftp side effect
codasrv-se 2433/udp # udp sftp side effect
empeg:/empeg/bin# grep tcp /etc/protocols 2>/dev/nul
tcp 6 TCP # transmission control

I know there is extra junk in these files. I'll fix them later.

I wrote a small test case:

#include <netdb.h>
#include <stdio.h>

int
main (int argc, char *argv[])
{
struct protoent *pe;

printf ("Hello world!\n");

while (NULL != (pe = getprotoent ()))
{
printf("pe = { %s }\n", pe->p_name);
}

return 0;
}

which returns the following on empeg:

empeg:/empeg/bin# /drive0/fids/9ac0
Hello world!

On a RH 6.2 system, it returns:

Hello world!
pe = { ip }
pe = { icmp }
pe = { igmp }
pe = { ggp }
pe = { ipencap }
pe = { st }
pe = { tcp }
pe = { egp }
pe = { pup }
pe = { udp }
pe = { hmp }
pe = { xns-idp }
pe = { rdp }
pe = { iso-tp4 }
pe = { xtp }
pe = { ddp }
pe = { idpr-cmtp }
pe = { rspf }
pe = { vmtp }
pe = { ospf }
pe = { ipip }
pe = { encap }

These are the following files that I have installed on the empeg from ftp://ftp.jimpick.com/pub/debian/arm/image/debian-image_990822.tar.gz
with the command tar -xvzpf /drive0/fids/9aa0 etc/protocols etc/services sbin/ifconfig bin/ping usr/bin/ftp lib/libreadline.so.2.1 lib/libreadline.so.2 lib/libncurses.so.4.2 lib/libncurses.so.4 usr/sbin/inetd usr/sbin/tcpd usr/sbin/in.ftpd etc/inetd.conf

Perhaps I should be using a different set of files?


Top
#15770 - 28/08/2000 16:00 Re: Why would getprotoent () fail? [Re: hamzy]
hamzy
journeyman

Registered: 11/08/2000
Posts: 51
Loc: TX, USA
Ok.
By extracting the entire tarball, running chroot from there, I can start up ftp.

Since I am trying to figure out a minimal set of files to extract, I must be missing a couple of files or libraries, or something...


Top
#15771 - 29/08/2000 02:00 Re: Why would getprotoent () fail? [Re: hamzy]
kim
member

Registered: 21/07/1999
Posts: 140
Loc: Helsinki, Finland
I was wondering why getprotoent() fails. I am trying to figure this out because trying to get ftp to work, gives the message "ftp: ftp/tcp: unknown service"

I believe that this is coming from getprotobyname ("tcp").

both /etc/services and /etc/protocols exist and are readable:


It fails because it can't find the following files:

/lib/libnss_compat.so.2
/lib/libnss_db.so.2
/lib/libnss_dns.so.2
/lib/libnss_files.so.2
/lib/libnss_hesiod.so.2
/lib/libnss_nis.so.2
/lib/libnss_nisplus.so.2
/lib/libresolv.so.2

After those files are in place, it should work.

Kim


Top
#15772 - 29/08/2000 08:02 Re: Why would getprotoent () fail? [Re: kim]
hamzy
journeyman

Registered: 11/08/2000
Posts: 51
Loc: TX, USA
Kewl!

Thank you very much! How did you know what files were missing? I was using ldd but it only told me the following:
empeg:/empeg/bin# ldd `which ftp`
libreadline.so.2 => /lib/libreadline.so.2 (0x40001000)
libncurses.so.4 => /lib/libncurses.so.4 (0x4003d000)
libc.so.6 => /lib/libc.so.6 (0x4008a000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaaa000)


Top
#15773 - 29/08/2000 12:56 Re: Why would getprotoent () fail? [Re: hamzy]
kim
member

Registered: 21/07/1999
Posts: 140
Loc: Helsinki, Finland
Thank you very much! How did you know what files were missing? I was using ldd but it only told me the following:

Well, believe it or not but I had to peek into the glibc functions on the source code level to figure it out. So I was fighting with those files for *many* hours.

Kim


Top